perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject Re: the dreaded 'subroutine redefined'
Date Thu, 04 May 2006 01:10:15 GMT
Matthew wrote:
> None of my subroutines are prototyped. They all follow the format:
> 
>    sub <name>() {
>      <code>
>    }
As Perrin/Randal said, thats a prototype of no arguments
While I'm on it
&foo
is different from
&foo()

The first gets access to the global @_ (aka whatever function foo was called 
from, its @_ is handed to foo), the latter does not.

Finally, as long as your sub foo {} comes before the call to it (i.e scripts),
you generally don't write the sigil & -- i.e.
&foo(), but merely foo()


> use Apache2::Reload;
You should generally move this to your httpd.conf file and configure it
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "confer::tester FOO::*"

You can use
PerlSetVar ReloadDebug On
to get a list in error_log of what files Apache2:Reload is stating to see if 
they need to be reload.  If you only care about one file, you should make this 
list be 1 file via the ReloadModules directive.  This will lessen the 
performance impact as Johnathan pointed out.

> use vars qw($q $r $dbh $template $sql);
just fyi, it takes more memory (bytes) to do this instead of our do to symbol 
table mumbo jumbo.

Finally *sometimes* mod_perl doesn't like it when a function gets 'redefined'
Though I agree with
no warnings qw(redefine);

If you're developing actively, you might notice some strangeness especially if 
you cause a syntax error and hope Apache2::Reload will reload correctly.  Notice 
above, I said SOMETIMES.

HTH

------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."

Mime
View raw message