Write PerlPostReadRequestHandler

Write PerlPostReadRequestHandler

am 19.05.2011 10:30:06 von Marco

This is a multi-part message in MIME format.
--------------090208040204010601070300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I tried to write an handler to be execute in the PostReadRequest phase
of the http request cycle.
here's the simple code (it is only a test):

#file:touch.pl
#-------------
use strict;
use warnings;

use Apache::ServerUtil ();
use Apache::RequestIO ();

my $r = shift;
$r->content_type('text/plain');

$r->print("ciao mondo");

I add to the end of httpd.conf file this:

Alias /perl/ /home/marcolino/perlScript/

SetHandler perl-script
PerlResponseHandler touch.pl
Allow from all

PerlPostReadRequestHandler touch.pl

But I'm a little confused on what I wrote. I followed the ufficial guide
but it was not very clear.
When I link to http://localhost:81/ it gives me an INTERNAL ERROR.
The error_log file contains:

Warning: Use of "require" without parentheses is ambiguous at (eval 3)
line 1.
[Thu May 19 10:00:08 2011] [error] [client 127.0.0.1] failed to resolve
handler `touch.pl': Can't locate touchpl in @INC (@INC contains:
/etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl . /usr/local/apache) at (eval 3) line 1.\n
........(and more error of the same type).......

Had some solve this problem or had someone write a
PerlPostReadRequestHandler?

Thanks


--------------090208040204010601070300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit








Hi,

I tried to write an handler to be execute in the PostReadRequest
phase of the http request cycle.

here's the simple code (it is only a test):



#

  #-------------

  use strict;

  use warnings;

 

  use Apache::ServerUtil ();

  use Apache::RequestIO ();

 

  my $r = shift;

  $r->content_type('text/plain');

 

  $r->print("<html><body>ciao
mondo</body></html>");



I add to the end of httpd.conf file this:



Alias /perl/ /home/marcolino/perlScript/

<Location /perl/ >

     SetHandler perl-script

     PerlResponseHandler touch.pl

     Allow from all

</Location> 

PerlPostReadRequestHandler touch.pl



But I'm a little confused on what I wrote. I followed the ufficial
guide but it was not very clear.

When I link to it gives me an INTERNAL ERROR.

The error_log file contains:



Warning: Use of "require" without parentheses is ambiguous at (eval
3) line 1.

[Thu May 19 10:00:08 2011] [error] [client 127.0.0.1] failed to
resolve handler `touch.pl': Can't locate touchpl in @INC (@INC
contains: /etc/perl /usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .
/usr/local/apache) at (eval 3) line 1.\n

.......(and more error of the same type).......



Had some solve this problem or had someone write a
PerlPostReadRequestHandler?



Thanks






--------------090208040204010601070300--

Re: Write PerlPostReadRequestHandler

am 19.05.2011 16:05:31 von rafiq

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

---1384987354-487606302-1305813931=:11074
Content-Type: TEXT/PLAIN; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

http://perl.apache.org/docs/2.0/user/intro/start_fast.html

On Thu, 19 May 2011, marco wrote:

> Hi,
> I tried to write an handler to be execute in the PostReadRequest phase of=
the http request cycle.
> #file:touch.pl
..
>      PerlResponseHandler touch.pl
..
> PerlPostReadRequestHandler touch.pl
^^^^^^^^
This should be the package name of a module on your @INC path.

> But I'm a little confused on what I wrote. I followed the ufficial guide =
but it was not very clear.
You might want to look at=20
http://perl.apache.org/docs/2.0/user/intro/start_fast.html again.

Good luck.

R.

---1384987354-487606302-1305813931=:11074--

Re: Write PerlPostReadRequestHandler

am 19.05.2011 16:32:47 von aw

Raf wrote:
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html
>
> On Thu, 19 May 2011, marco wrote:
>
>> Hi,
>> I tried to write an handler to be execute in the PostReadRequest phase
>> of the http request cycle.
>> #file:touch.pl
> ...
>> PerlResponseHandler touch.pl
> ...
>> PerlPostReadRequestHandler touch.pl
> ^^^^^^^^
> This should be the package name of a module on your @INC path.
>
>> But I'm a little confused on what I wrote. I followed the ufficial
>> guide but it was not very clear.
> You might want to look at
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html again.
>

More precisely, the section : "Handler Modules"

The steps there are exactly what you need to do.

Look carefully at the example perl code.
- rename your script to "touch.pm" (a convention, for mod_perl handler modules)
- change your script a bit, to resemble the example, with the

sub handler {
....
}
1;

That "1;" at the end is very important.
Also important is that your handler subroutine should return "OK" to Apache.

Also change
PerlPostReadRequestHandler touch.pl
to
PerlPostReadRequestHandler touch

Re: Write PerlPostReadRequestHandler

am 19.05.2011 16:47:56 von Marco

This is a multi-part message in MIME format.
--------------040401030104030603030601
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Il 19/05/2011 16.32, André Warnier ha scritto:
> Raf wrote:
>> http://perl.apache.org/docs/2.0/user/intro/start_fast.html
>>
>> On Thu, 19 May 2011, marco wrote:
>>
>>> Hi,
>>> I tried to write an handler to be execute in the PostReadRequest
>>> phase of the http request cycle.
>>> #file:touch.pl
>> ...
>>> PerlResponseHandler touch.pl
>> ...
>>> PerlPostReadRequestHandler touch.pl
>> ^^^^^^^^
>> This should be the package name of a module on your @INC path.
>>
>>> But I'm a little confused on what I wrote. I followed the ufficial
>>> guide but it was not very clear.
>> You might want to look at
>> http://perl.apache.org/docs/2.0/user/intro/start_fast.html again.
>>
>
> More precisely, the section : "Handler Modules"
>
> The steps there are exactly what you need to do.
>
> Look carefully at the example perl code.
> - rename your script to "touch.pm" (a convention, for mod_perl
> handler modules)
> - change your script a bit, to resemble the example, with the
>
> sub handler {
> ...
> }
> 1;
>
> That "1;" at the end is very important.
> Also important is that your handler subroutine should return "OK" to
> Apache.
>
> Also change
> PerlPostReadRequestHandler touch.pl
> to
> PerlPostReadRequestHandler touch
>
>
>
>
Hi Andrè,
thanks for your help.
The code I have written is the follow:

*#touch.pm
use strict;
use warnings;

use Apache2::ServerUtil ();
use Apache2::RequestIO ();

sub handler{
my $r = shift;
$r->content_type('text/plain');
$r->print("

ciao mondo");
}
1;*

When I access to http://localhost:81/ on my Apache server, i have a
white page and the *error_log* file contains:

Warning: PHP Startup: Unable to load dynamic library
'ext/msql.so' - ext/msql.so: cannot open shared object file: No such
file or directory in Unknown on line 0

failed to resolve handler touch

What's the matter?
I don't understand what is the problem!!

Any suggests is appreciated.



--------------040401030104030603030601
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit




http-equiv="Content-Type">



Il 19/05/2011 16.32, André Warnier ha scritto:
Raf
wrote:







On Thu, 19 May 2011, marco wrote:




Hi,


I tried to write an handler to be execute in the
PostReadRequest phase of the http request cycle.


#



...


     PerlResponseHandler touch.pl



...


PerlPostReadRequestHandler touch.pl



                             ^^^^^^^^


This should be the package name of a module on your @INC path.




But I'm a little confused on what I
wrote. I followed the ufficial guide but it was not very
clear.



You might want to look at

again.







More precisely, the section : "Handler Modules"




The steps there are exactly what you need to do.




Look carefully at the example perl code.


- rename your script to "touch.pm"  (a convention, for mod_perl
handler modules)


- change your script a bit, to resemble the example, with the




sub handler {


...


}


1;




That "1;" at the end is very important.


Also important is that your handler subroutine should return "OK"
to Apache.




Also change


PerlPostReadRequestHandler touch.pl


to


PerlPostReadRequestHandler touch











Hi Andrè,

thanks for your help.

The code I have written is the follow:

 

#touch.pm 

  use strict;

  use warnings;

 

  use Apache2::ServerUtil ();

  use Apache2::RequestIO ();



  sub handler{

      my $r = shift;

      $r->content_type('text/plain');

      $r->print("<html><body><h1>ciao
mondo</h1</body></html>");

   }

   1;




When I access to on my Apache server, i have a
white page and the error_log file contains:



<b>Warning</b>:  PHP Startup: Unable to load dynamic
library 'ext/msql.so' - ext/msql.so: cannot open shared object file:
No such file or directory in <b>Unknown</b> on line
<b>0</b><br />

failed to resolve handler touch



What's the matter?

I don't understand what is the problem!!



Any suggests is appreciated.








--------------040401030104030603030601--

Re: Write PerlPostReadRequestHandler

am 19.05.2011 17:02:18 von Marco

This is a multi-part message in MIME format.
--------------060002000602080001050208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Il 19/05/2011 16.47, marco ha scritto:
> Il 19/05/2011 16.32, André Warnier ha scritto:
>> Raf wrote:
>>> http://perl.apache.org/docs/2.0/user/intro/start_fast.html
>>>
>>> On Thu, 19 May 2011, marco wrote:
>>>
>>>> Hi,
>>>> I tried to write an handler to be execute in the PostReadRequest
>>>> phase of the http request cycle.
>>>> #file:touch.pl
>>> ...
>>>> PerlResponseHandler touch.pl
>>> ...
>>>> PerlPostReadRequestHandler touch.pl
>>> ^^^^^^^^
>>> This should be the package name of a module on your @INC path.
>>>
>>>> But I'm a little confused on what I wrote. I followed the ufficial
>>>> guide but it was not very clear.
>>> You might want to look at
>>> http://perl.apache.org/docs/2.0/user/intro/start_fast.html again.
>>>
>>
>> More precisely, the section : "Handler Modules"
>>
>> The steps there are exactly what you need to do.
>>
>> Look carefully at the example perl code.
>> - rename your script to "touch.pm" (a convention, for mod_perl
>> handler modules)
>> - change your script a bit, to resemble the example, with the
>>
>> sub handler {
>> ...
>> }
>> 1;
>>
>> That "1;" at the end is very important.
>> Also important is that your handler subroutine should return "OK" to
>> Apache.
>>
>> Also change
>> PerlPostReadRequestHandler touch.pl
>> to
>> PerlPostReadRequestHandler touch
>>
>>
>>
>>
> Hi Andrè,
> thanks for your help.
> The code I have written is the follow:
>
> *#touch.pm
> use strict;
> use warnings;
>
> use Apache2::ServerUtil ();
> use Apache2::RequestIO ();
>
> sub handler{
> my $r = shift;
> $r->content_type('text/plain');
> $r->print("

ciao mondo");
> }
> 1;*
>
> When I access to http://localhost:81/ on my Apache server, i have a
> white page and the *error_log* file contains:
>
> Warning: PHP Startup: Unable to load dynamic library
> 'ext/msql.so' - ext/msql.so: cannot open shared object file: No such
> file or directory in Unknown on line 0

> failed to resolve handler touch
>
> What's the matter?
> I don't understand what is the problem!!
>
> Any suggests is appreciated.
>
>
Sorry, i have posted the wrong code. The *correct* one is the follow,
(as you suggest me there is OK):

* #touch.pm
#-------------
use strict;
use warnings;

use Apache2::ServerUtil ();
use Apache2::RequestIO ();
use Apache2::Const -compile => 'OK';
sub handler{
open (MYFILE, '>> /home/marcolino/pippo');
print MYFILE "Marco on Apache\n";
close (MYFILE);
#my $r = shift;
#$r->content_type('text/plain');
#$r->print("

ciao mondo");
return OK;
}
1;*

With this code the server give me the same error(white page + in the
error_log file it prints "*failed to resolve handler touch*")

What can i solve this?


--------------060002000602080001050208
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit




http-equiv="Content-Type">


Il 19/05/2011 16.47, marco ha scritto:

http-equiv="Content-Type">

Il 19/05/2011 16.32, André Warnier ha scritto:
Raf
wrote:

class="moz-txt-link-freetext"
href="http://perl.apache.org/docs/2.0/user/intro/start_fast. html">http://perl.apache.org/docs/2.0/user/intro/start_fast. html





On Thu, 19 May 2011, marco wrote:



Hi,

I tried to write an handler to be execute in the
PostReadRequest phase of the http request cycle.

# href="file:touch.pl">file:touch.pl


...

     PerlResponseHandler touch.pl


...

PerlPostReadRequestHandler touch.pl


                             ^^^^^^^^

This should be the package name of a module on your @INC path.




But I'm a little confused on what I
wrote. I followed the ufficial guide but it was not very
clear.


You might want to look at class="moz-txt-link-freetext"
href="http://perl.apache.org/docs/2.0/user/intro/start_fast. html">http://perl.apache.org/docs/2.0/user/intro/start_fast. html

again.






More precisely, the section : "Handler Modules"



The steps there are exactly what you need to do.



Look carefully at the example perl code.

- rename your script to "touch.pm"  (a convention, for mod_perl
handler modules)

- change your script a bit, to resemble the example, with the



sub handler {

...

}

1;



That "1;" at the end is very important.

Also important is that your handler subroutine should return
"OK" to Apache.



Also change

PerlPostReadRequestHandler touch.pl

to

PerlPostReadRequestHandler touch










Hi Andrè,

thanks for your help.

The code I have written is the follow:

 

#touch.pm 

  use strict;

  use warnings;

 

  use Apache2::ServerUtil ();

  use Apache2::RequestIO ();



  sub handler{

      my $r = shift;

      $r->content_type('text/plain');

      $r->print("<html><body><h1>ciao
mondo</h1</body></html>");

   }

   1;




When I access to class="moz-txt-link-freetext" href="http://localhost:81/">http://localhost:81/
on my Apache server, i have a white page and the error_log
file contains:



<b>Warning</b>:  PHP Startup: Unable to load dynamic
library 'ext/msql.so' - ext/msql.so: cannot open shared object
file: No such file or directory in <b>Unknown</b> on
line <b>0</b><br />

failed to resolve handler touch



What's the matter?

I don't understand what is the problem!!



Any suggests is appreciated.






Sorry, i have posted the wrong code. The correct one is the
follow, (as you suggest me there is OK):



 #touch.pm

  #-------------

  use strict;

  use warnings;

 

  use Apache2::ServerUtil ();

  use Apache2::RequestIO ();

  use Apache2::Const -compile => 'OK';

  sub handler{

      open (MYFILE, '>> /home/marcolino/pippo');

      print MYFILE "Marco on Apache\n";

      close (MYFILE);   

      #my $r = shift;

      #$r->content_type('text/plain');

      #$r->print("<html><body><h1>ciao
mondo</h1</body></html>");

    return OK;   

   }

   1;




With this code the server give me the same error(white page + in the
error_log file it prints "failed to resolve handler touch")



What can i solve this?






--------------060002000602080001050208--

Re: Write PerlPostReadRequestHandler

am 20.05.2011 11:16:16 von rafiq

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

---1384987354-232411140-1305882976=:11074
Content-Type: TEXT/PLAIN; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Marco,

On Thu, 19 May 2011, marco wrote:

> Il 19/05/2011 16.47, marco ha scritto:
> Il 19/05/2011 16.32, Andr? Warnier ha scritto:
> On Thu, 19 May 2011, marco wrote:
> ...
> PerlPostReadRequestHandler touch.pl
>
>                   =
           ^^^^^^^^
> This should be the package name of a module on your @IN=
C path.
>
> - rename your script to "touch.pm"=A0 (a convention, for mod_=
perl handler modules)
> Sorry, i have posted the wrong code. The correct one is the follow, (as y=
ou suggest me there is OK):
> =A0#touch.pm
> =A0 #-------------

>=20
> With this code the server give me the same error(white page + in the=20
> error_log file it prints "failed to resolve handler touch")

See perldoc perlmod (http://perldoc.perl.org/perlmod.html) You need=20
to implement a perl module and I'd recommend some study into modularising=
=20
perl prior to your diving into implementing a custom handler.

Good luck.
Raf

---1384987354-232411140-1305882976=:11074--