You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jan Theofel <th...@etes.de> on 2002/11/24 18:18:35 UTC
Subroutine main redefined?
Hello,
I have a very simple perl script which I try to run with
Apache::PerlRun. After changing the directory section in the apache
configuration file and a restart I get no repsonse to my client and the
error file fills with:
[Sun Nov 24 17:59:45 2002] shop.pl: Subroutine main redefined at
/home/www/[...]/shop/engine/shop.pl line 19.
Google found some problems and solutions for that, but they all seemed
to be for Apache::Registry and not for Apache::PerlRun.
Here's the script (a few comments snipped away):
--- snip ---
#!/usr/bin/perl -w
use strict;
use eqtools;
use eqdbtools;
&main;
1;
sub main {
# -- create a new session --
&open_db();
my $sid = &create_session();
&track_request($sid, "?THIS_IS_A_NEW_SESSION");
&close_db();
# -- forward the browser to the following page --
if($sid ne "")
{
print "Status: 302 Moved\n";
print "Location: /static.pl?sid=$sid&page=home\n\n";
}
else
{
&fatal_db_error("FATAL ERROR CREATING A NEW SESSION!", "-");
}
}
--- snap ---
And here is the section form my apache configuration file:
--- snip ---
<Directory "/home/www/[...]/shop/engine">
AllowOverride AuthConfig
Order allow,deny
Allow from all
SetHandler perl-script
PerlHandler Apache::PerlRun
Options +ExecCGI -Includes
PerlSendHeader off
</Directory>
--- snap ---
I already tried to rename the sub "main" into something other
("eqmain"), but that didn't help.
Can someone tell me which mistake I made and how to fix this?
Thanks in advance,
Jan Theofel
--
Jan Theofel Fon: +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR Fax: +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart Web: http://www.etes.de
______________________________________
Inflex - eMail Scanning and Protection
Queries to: postmaster@etes.de
Re: Subroutine main redefined?
Posted by Stas Bekman <st...@stason.org>.
Jan Theofel wrote:
> Hello,
>
> Am Mon, 2002-11-25 um 01.14 schrieb Stas Bekman:
>
>>Jan Theofel wrote:
>
>
>>>[Sun Nov 24 17:59:45 2002] shop.pl: Subroutine main redefined at
>>>/home/www/[...]/shop/engine/shop.pl line 19.
>>
>>This is a warning, not an error.
>
>
> Ok, but why do I get this warning? I don't redefine the sub.
That shouldn't happen. Since under PerlRun the namespace is cleaned
before the new request. Any chance you have it defined twice in the same
script?
>>>Google found some problems and solutions for that, but they all seemed
>>>to be for Apache::Registry and not for Apache::PerlRun.
>>
>>::Registry and ::PerlRun are very similar, most things that apply to the
>>former apply to the latter, see docs for more info.
>
>
> Is ::PerlRun like running ::Registry with the Apache configuration
> "PerlSetVar PerlRunOnce On"?
Not completely. Docs are coming to help:
http://perl.apache.org/docs/1.0/guide/intro.html#Apache__PerlRun
>>That should be:
>>
>> PerlSendHeader on
>>
>>since you manually print your headers.
>
>
> Ok, this works. Thanks.
;)
__________________________________________________________________
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
Re: Subroutine main redefined?
Posted by Christopher Grau <cg...@singleclick.com>.
On Mon, 2002-11-25 at 08:33, Jan Theofel wrote:
> > > [Sun Nov 24 17:59:45 2002] shop.pl: Subroutine main redefined at
> > > /home/www/[...]/shop/engine/shop.pl line 19.
> >
> > This is a warning, not an error.
>
> Ok, but why do I get this warning? I don't redefine the sub.
I think you are getting the warning for the same reason I was having
trouble:
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_Start
On start, Apache actually starts and then restarts. On the restart, you
get the warning that the subroutine is redefined. It's harmless.
Re: Subroutine main redefined?
Posted by Jan Theofel <th...@etes.de>.
Hello,
Am Mon, 2002-11-25 um 01.14 schrieb Stas Bekman:
> Jan Theofel wrote:
> > [Sun Nov 24 17:59:45 2002] shop.pl: Subroutine main redefined at
> > /home/www/[...]/shop/engine/shop.pl line 19.
>
> This is a warning, not an error.
Ok, but why do I get this warning? I don't redefine the sub.
> > Google found some problems and solutions for that, but they all seemed
> > to be for Apache::Registry and not for Apache::PerlRun.
>
> ::Registry and ::PerlRun are very similar, most things that apply to the
> former apply to the latter, see docs for more info.
Is ::PerlRun like running ::Registry with the Apache configuration
"PerlSetVar PerlRunOnce On"?
> That should be:
>
> PerlSendHeader on
>
> since you manually print your headers.
Ok, this works. Thanks.
Bye,
Jan
--
Jan Theofel Fon: +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR Fax: +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart Web: http://www.etes.de
______________________________________
Inflex - eMail Scanning and Protection
Queries to: postmaster@etes.de
Re: Subroutine main redefined?
Posted by Stas Bekman <st...@stason.org>.
Jan Theofel wrote:
> Hello,
>
> I have a very simple perl script which I try to run with
> Apache::PerlRun. After changing the directory section in the apache
> configuration file and a restart I get no repsonse to my client and the
> error file fills with:
>
> [Sun Nov 24 17:59:45 2002] shop.pl: Subroutine main redefined at
> /home/www/[...]/shop/engine/shop.pl line 19.
This is a warning, not an error.
> Google found some problems and solutions for that, but they all seemed
> to be for Apache::Registry and not for Apache::PerlRun.
::Registry and ::PerlRun are very similar, most things that apply to the
former apply to the latter, see docs for more info.
> Here's the script (a few comments snipped away):
> --- snip ---
> #!/usr/bin/perl -w
>
> use strict;
> use eqtools;
> use eqdbtools;
>
> &main;
> 1;
>
> sub main {
> # -- create a new session --
> &open_db();
> my $sid = &create_session();
> &track_request($sid, "?THIS_IS_A_NEW_SESSION");
> &close_db();
>
> # -- forward the browser to the following page --
> if($sid ne "")
> {
> print "Status: 302 Moved\n";
> print "Location: /static.pl?sid=$sid&page=home\n\n";
> }
> else
> {
> &fatal_db_error("FATAL ERROR CREATING A NEW SESSION!", "-");
> }
> }
> --- snap ---
>
>
> And here is the section form my apache configuration file:
> --- snip ---
> <Directory "/home/www/[...]/shop/engine">
> AllowOverride AuthConfig
> Order allow,deny
> Allow from all
> SetHandler perl-script
> PerlHandler Apache::PerlRun
> Options +ExecCGI -Includes
> PerlSendHeader off
That should be:
PerlSendHeader on
since you manually print your headers.
__________________________________________________________________
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