You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David Arnold <da...@northcoast.com> on 2004/07/11 00:16:29 UTC

Hmmmm....

All,

I am not used to seeing this behavior, so I thought I'd ask. I make a
change to my httpd.conf:

PerlModule ModPerl::Rules2
<Location /mod_perl_rules2>
        SetHandler perl-script
        PerlHandler ModPerl::Rules2
        PerlSendHeader On
</Location>

Then I try to restart server:

[root@scinux apache]# bin/apachectl graceful
bin/apachectl graceful: configuration broken, ignoring restart
bin/apachectl graceful: (run 'apachectl configtest' for details)
[root@scinux apache]# bin/apachectl configtest
Syntax error on line 971 of /usr/local/apache/conf/httpd.conf:
Can't use global $= in "my" at /home/darnold/modperl//ModPerl/Rules2.pm
line 9, near "my $="
syntax error at /home/darnold/modperl//ModPerl/Rules2.pm line 9, near
"$=shift"
Global symbol "$f" requires explicit package name at
/home/darnold/modperl//ModPerl/Rules2.pm line 10.
Global symbol "$r" requires explicit package name at
/home/darnold/modperl//ModPerl/Rules2.pm line 11.
Compilation failed in require at (eval 13) line 3.

I am wondering why it's trying to run the file Rules2.pm. Why doesn't it
just restart then wait to report the error when I attempt to access
scinux.redwoods/mod_perl_rules2?

Here's Rules2.pm:

package ModPerl::Rules2;
# File: ModPerl/Rules2.pm

use strict;
use Apache::Reload;
use Apache::Constants qw(:common);

sub handler {
    my $=shift;
    $f->send_http_header('text/plain');
    $r->print("Mod_Perl Rules Bigtime!\n");
    return OK;
}
1;



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Hmmmm....

Posted by David Arnold <da...@northcoast.com>.
Stas,

No, I did notice the error. It's just that I've been alternating back and
forth from modperl2 to 1 that I cannot keep straight all the events that
are happening. I knew there was an error in Rules2.pm, but it felt strange
that is showed up when I was restarting the server. But, I later concluded,
with some help from Fred,  it must be becuase of the line

PerlModule ModPerl::Rules2

that I have in httpd.conf.


At 10:51 PM 7/10/04 -0700, Stas Bekman wrote:
>David Arnold wrote:
>
>did you actually look at the error message?
>
>> Can't use global $= in "my" at /home/darnold/modperl//ModPerl/Rules2.pm
>> line 9, near "my $="
>> syntax error at /home/darnold/modperl//ModPerl/Rules2.pm line 9, near
>> "$=shift"
>
>> sub handler {
>>     my $=shift;
>
>That should be:
>
>   my $r = shift;
>
>-- 
>__________________________________________________________________
>Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
>http://stason.org/     mod_perl Guide ---> http://perl.apache.org
>mailto:stas@stason.org http://use.perl.org http://apacheweek.com
>http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Hmmmm....

Posted by fr...@taperfriendlymusic.org.
> I am wondering why it's trying to run the file Rules2.pm. Why doesn't it
> just restart then wait to report the error when I attempt to access
> scinux.redwoods/mod_perl_rules2?

Mod_Perl compiles all library modules and loads them into memory when the
Apache server is started.  That is why mod_perl applications are so much
faster than CGI applications, which compile at runtime.

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Hmmmm....

Posted by Andy Armstrong <an...@hexten.net>.
David Arnold wrote:
> I am wondering why it's trying to run the file Rules2.pm. Why doesn't it
> just restart then wait to report the error when I attempt to access
> scinux.redwoods/mod_perl_rules2?

It's not trying to run it - it's trying to compile it.

sub handler {
     my $=shift;

That's the error. You can't have a scalar called just '$'.

     $f->send_http_header('text/plain');
     $r->print("Mod_Perl Rules Bigtime!\n");
     return OK;
}
1;

-- 
Andy Armstrong


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Hmmmm....

Posted by Stas Bekman <st...@stason.org>.
David Arnold wrote:

did you actually look at the error message?

> Can't use global $= in "my" at /home/darnold/modperl//ModPerl/Rules2.pm
> line 9, near "my $="
> syntax error at /home/darnold/modperl//ModPerl/Rules2.pm line 9, near
> "$=shift"

> sub handler {
>     my $=shift;

That should be:

   my $r = shift;

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html