Trying to configure Apache2::Request

Trying to configure Apache2::Request

am 10.02.2008 07:57:43 von Mag Gam

------=_Part_28483_6532347.1202626663624
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have installed Apache2::Request via CPAN, but i keep getting this message
in my error_log

[error] Global symbol "$r" requires explicit package name at
/var/www/perl/doc.pl line 10.\n

Apache configuration looks like this:
LoadModule perl_module modules/mod_perl.so
LoadModule apreq_module modules/mod_apreq2.so



AddHandler perl-script .pl
PerlResponseHandler ModPerl::Registry Apache2::Request
PerlOptions +ParseHeaders +GlobalRequest
Options +ExecCGI
DirectoryIndex new_home.pl

PerlModule Apache2::Request



doc.pl looks like this:
#!/usr/bin/perl -w
use strict;
use CGI;
use APR::Request::Apache2 ();


print "Content-type: text/html\n\n";
print "Hello";

my $req = Apache2::Request->new($r, POST_MAX => "1M");


Any thoughts?

TIA

------=_Part_28483_6532347.1202626663624
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have installed Apache2::Request via CPAN, but i keep getting this message in my error_log

[error] Global symbol "$r" requires explicit package name at /var/www/perl/doc.pl line 10.\n

Apache configuration looks like this:

LoadModule perl_module modules/mod_perl.so
LoadModule apreq_module   modules/mod_apreq2.so


<Directory /var/www/perl>
    AddHandler perl-script .pl
    PerlResponseHandler ModPerl::Registry Apache2::Request

    PerlOptions +ParseHeaders +GlobalRequest
    Options +ExecCGI
    DirectoryIndex new_home.pl
</Directory>
    PerlModule Apache2::Request



doc.pl looks like this:
#!/usr/bin/perl -w

use strict;
use CGI;
use APR::Request::Apache2 ();


print "Content-type: text/html\n\n";
print "Hello";

my $req = Apache2::Request->new($r, POST_MAX => "1M");



Any thoughts?

TIA


------=_Part_28483_6532347.1202626663624--

Re: Trying to configure Apache2::Request

am 10.02.2008 18:06:30 von Perrin Harkins

On Feb 10, 2008 1:57 AM, Mag Gam wrote:
> doc.pl looks like this:
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> use APR::Request::Apache2 ();
>
>
> print "Content-type: text/html\n\n";
> print "Hello";

my $r = shift;

> my $req = Apache2::Request->new($r, POST_MAX => "1M");

Also, don't print your Content-type header. Use CGI or $r to do it.

- Perrin

Re: Trying to configure Apache2::Request

am 10.02.2008 18:14:35 von Mag Gam

------=_Part_29036_11688193.1202663675158
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Nice, Thanks!

Just figured this out...



A known disadvantage to Perl method calls is that they are slower than
direct function calls. It is possible to resolve method calls at
compile time, rather than runtime, making method calls just as fast as
subroutine calls. However, there is certain information required for
method look ups that are only known at runtime. To work around this,
compile-time hints can be used, for example:
my Apache2::Request $r = shift;
Tells the Perl compiler to expect an object in the C
class to be assigned to C<$r>. A patch has already been submitted to
use this information so method calls can be resolved at compile time.
However, the implementation does not take into account sub-classing of
the typed object. Since the mod_perl API consists mainly of methods,
it would be advantageous to re-visit the patch to find an acceptable
solution.




On Feb 10, 2008 12:06 PM, Perrin Harkins wrote:

> On Feb 10, 2008 1:57 AM, Mag Gam wrote:
> > doc.pl looks like this:
> > #!/usr/bin/perl -w
> > use strict;
> > use CGI;
> > use APR::Request::Apache2 ();
> >
> >
> > print "Content-type: text/html\n\n";
> > print "Hello";
>
> my $r = shift;
>
> > my $req = Apache2::Request->new($r, POST_MAX => "1M");
>
> Also, don't print your Content-type header. Use CGI or $r to do it.
>
> - Perrin
>

------=_Part_29036_11688193.1202663675158
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Nice, Thanks!

 

Just figured this out...


 

 

A known disadvantage to Perl method calls is that they are slower than
direct function calls.  It is possible to resolve method calls at
compile time, rather than runtime, making method calls just as fast as

subroutine calls.  However, there is certain information required for
method look ups that are only known at runtime.  To work around this,
compile-time hints can be used, for example:

 my Apache2::Request $r = shift;

Tells the Perl compiler to expect an object in the C<Apache2::Request>
class to be assigned to C<$r>.  A patch has already been submitted to
use this information so method calls can be resolved at compile time.

However, the implementation does not take into account sub-classing of
the typed object.  Since the mod_perl API consists mainly of methods,
it would be advantageous to re-visit the patch to find an acceptable
solution.


 

 


 

On Feb 10, 2008 12:06 PM, Perrin Harkins <> wrote:


On Feb 10, 2008 1:57 AM, Mag Gam <> wrote:
> doc.pl looks like this:
> #!/usr/bin/perl -w
>  use strict;
> use CGI;

> use APR::Request::Apache2 ();
>
>
> print "Content-type: text/html\n\n";
> print "Hello";

my $r = shift;


> my $req = Apache2::Request->new($r, POST_MAX => "1M");

Also, don't print your Content-type header.  Use CGI or $r to do it.

- Perrin




------=_Part_29036_11688193.1202663675158--

Re: Trying to configure Apache2::Request

am 10.02.2008 18:31:23 von Perrin Harkins

On Feb 10, 2008 12:14 PM, Mag Gam wrote:
> my Apache2::Request $r = shift;
> Tells the Perl compiler to expect an object in the C
> class to be assigned to C<$r>. A patch has already been submitted to
> use this information so method calls can be resolved at compile time.

That didn't work out. You should not do this. Just use the normal
"my $r" syntax.

- Perrin