You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matthew Lenz <ma...@nocturnal.org> on 2009/02/26 21:04:27 UTC

migrating to 2.0 and getting tons of warnings

I can't seem to disable warnings on our production environment.  'use
warnings' is not included in any of the config/startup/scripts or custom
modules.  Its possible I guess that its being used by a CPAN module.

We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing
work to migrate the app to Debian 5.0 (apache/mod_perl 2).

I don't mine the extra log data in development and intend to fix these
issues but I can't have these '-e: Use of uninitialized value' cramming
up my production log files.

I've tried everything I can think of, anyone have any ideas?


Re: migrating to 2.0 and getting tons of warnings

Posted by Perrin Harkins <ph...@gmail.com>.
On Fri, Feb 27, 2009 at 11:43 AM, Matthew Lenz <ma...@nocturnal.org> wrote:
> No, this is just a legacy app that runs straight CGI's via
> ModPerl::RegistryPrefork

I'd check for any $^W manipulation in ModPerl::RegsitryPrefork.

> I thought that if a package does a 'use warnings;' that it only affects
> code being executed in that package?  Maybe that is not the case under
> mod perl 2?

It's still the case.  mod_perl doesn't change anything about the
behavior of perl, just the lifecycle of your scripts.

- Perrin

Re: migrating to 2.0 and getting tons of warnings

Posted by Matthew Lenz <ma...@nocturnal.org>.
On Fri, 2009-02-27 at 11:29 -0500, Perrin Harkins wrote:
> On Fri, Feb 27, 2009 at 7:58 AM, Matthew Lenz <ma...@nocturnal.org> wrote:
> > I looked through the packge diff:
> >
> > http://ftp.de.debian.org/debian/pool/main/liba/libapache2-mod-perl2/libapache2-mod-perl2_2.0.4-5.diff.gz
> >
> > and didn't spot any changes that would have this affect.
> 
> What about other CPAN modules you're using.  Do you use a framework
> like Mason?

No, this is just a legacy app that runs straight CGI's via
ModPerl::RegistryPrefork

> You probably have different versions on the newer
> machine.

Absolutely, I'm guessing nearly every CPAN module being used is updated.

> - Perrin

I thought that if a package does a 'use warnings;' that it only affects
code being executed in that package?  Maybe that is not the case under
mod perl 2?  mod perl 1 didn't exhibit that behavior.


Re: migrating to 2.0 and getting tons of warnings

Posted by Perrin Harkins <ph...@gmail.com>.
On Fri, Feb 27, 2009 at 7:58 AM, Matthew Lenz <ma...@nocturnal.org> wrote:
> I looked through the packge diff:
>
> http://ftp.de.debian.org/debian/pool/main/liba/libapache2-mod-perl2/libapache2-mod-perl2_2.0.4-5.diff.gz
>
> and didn't spot any changes that would have this affect.

What about other CPAN modules you're using.  Do you use a framework
like Mason?  You probably have different versions on the newer
machine.

- Perrin

Re: migrating to 2.0 and getting tons of warnings

Posted by Matthew Lenz <ma...@nocturnal.org>.
On Thu, 2009-02-26 at 17:17 -0500, Perrin Harkins wrote:
> On Thu, Feb 26, 2009 at 4:01 PM, Matthew Lenz <ma...@nocturnal.org> wrote:
> > Maybe the debian guys did something goofy with the modules.  It wouldn't
> > be the first time.  That or maybe its just a bug in ModPerl.  Even if
> > some CPAN module out there has 'use warnings;' in it that shouldn't have
> > any affect on any code outside of its own package should it?
> 
> Something could be setting $^W.  Grep your code for that.

I only found a single reference to $^W and it was setting it to 0 for a
small block of code.  It didn't really even need to do so as no code was
enabling them.

This same code is going from Debian 3.1 (apache 1, mod_perl 1, perl 5.8)
to Debian 5.0 (apache 2, mod_perl 2, perl 5.10) and now I'm getting the
warnings.

I looked through the packge diff:

http://ftp.de.debian.org/debian/pool/main/liba/libapache2-mod-perl2/libapache2-mod-perl2_2.0.4-5.diff.gz

and didn't spot any changes that would have this affect.

> - Perrin


Re: migrating to 2.0 and getting tons of warnings

Posted by Perrin Harkins <ph...@gmail.com>.
On Thu, Feb 26, 2009 at 4:01 PM, Matthew Lenz <ma...@nocturnal.org> wrote:
> Maybe the debian guys did something goofy with the modules.  It wouldn't
> be the first time.  That or maybe its just a bug in ModPerl.  Even if
> some CPAN module out there has 'use warnings;' in it that shouldn't have
> any affect on any code outside of its own package should it?

Something could be setting $^W.  Grep your code for that.

- Perrin

Re: migrating to 2.0 and getting tons of warnings

Posted by Adam Prime <ad...@utoronto.ca>.
> Maybe the debian guys did something goofy with the modules.  It wouldn't
> be the first time.  That or maybe its just a bug in ModPerl.  Even if
> some CPAN module out there has 'use warnings;' in it that shouldn't have
> any affect on any code outside of its own package should it?

I think that Moose and Modern::Perl do something fancy to globally turn 
on both strict and warnings, but aside from that I have no idea off hand.

Adam

Re: migrating to 2.0 and getting tons of warnings

Posted by Matthew Lenz <ma...@nocturnal.org>.
On Thu, 2009-02-26 at 15:49 -0500, Adam Prime wrote:
> André Warnier wrote:
> > Matthew Lenz wrote:
> >> I can't seem to disable warnings on our production environment.  'use
> >> warnings' is not included in any of the config/startup/scripts or custom
> >> modules.  Its possible I guess that its being used by a CPAN module.
> >>
> >> We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing
> >> work to migrate the app to Debian 5.0 (apache/mod_perl 2).
> >>
> >> I don't mine the extra log data in development and intend to fix these
> >> issues but I can't have these '-e: Use of uninitialized value' cramming
> >> up my production log files.
> >>
> >> I've tried everything I can think of, anyone have any ideas?
> >>
> > 
> > If you are talking about cgi-bin scripts, then they probably all start 
> > with a line like
> > #!/usr/bin/perl -w
> > 
> > Removing the -w would do it.
> > But the warnings themselves mean something that you'd better not ignore.
> > 
> > To remove the -w, you could even use a perl one-liner, such as
> > 
> > perl -pi'.bak' -e 's/^#!\/usr\/bin\/perl -w/#!\/usr\/bin\/perl/' *.pl
> > 
> > .. but try this first on a limited set somewhere !!!
> > 
> 
> Another thing to check is if you've got
> 
> PerlSwitches -w
> 
> in your httpd.conf, that'll turn on warnings too.
> 
> Adam

I have no 'use warnings' anywhere in my code/config.  I have no shebangs
with -w/W anywhere.

I did however, JUST figure it out:

PerlSwitches -X

That's the only thing that would work and honestly its highly
undesirable.  The crazy thing is that ModPerl::RegistryCooker seems to
expend a lot of time making damn well sure that it respects the scripts
warnings settings.

Maybe the debian guys did something goofy with the modules.  It wouldn't
be the first time.  That or maybe its just a bug in ModPerl.  Even if
some CPAN module out there has 'use warnings;' in it that shouldn't have
any affect on any code outside of its own package should it?



Re: migrating to 2.0 and getting tons of warnings

Posted by Adam Prime <ad...@utoronto.ca>.
André Warnier wrote:
> Matthew Lenz wrote:
>> I can't seem to disable warnings on our production environment.  'use
>> warnings' is not included in any of the config/startup/scripts or custom
>> modules.  Its possible I guess that its being used by a CPAN module.
>>
>> We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing
>> work to migrate the app to Debian 5.0 (apache/mod_perl 2).
>>
>> I don't mine the extra log data in development and intend to fix these
>> issues but I can't have these '-e: Use of uninitialized value' cramming
>> up my production log files.
>>
>> I've tried everything I can think of, anyone have any ideas?
>>
> 
> If you are talking about cgi-bin scripts, then they probably all start 
> with a line like
> #!/usr/bin/perl -w
> 
> Removing the -w would do it.
> But the warnings themselves mean something that you'd better not ignore.
> 
> To remove the -w, you could even use a perl one-liner, such as
> 
> perl -pi'.bak' -e 's/^#!\/usr\/bin\/perl -w/#!\/usr\/bin\/perl/' *.pl
> 
> .. but try this first on a limited set somewhere !!!
> 

Another thing to check is if you've got

PerlSwitches -w

in your httpd.conf, that'll turn on warnings too.

Adam

Re: migrating to 2.0 and getting tons of warnings

Posted by André Warnier <aw...@ice-sa.com>.
Matthew Lenz wrote:
> I can't seem to disable warnings on our production environment.  'use
> warnings' is not included in any of the config/startup/scripts or custom
> modules.  Its possible I guess that its being used by a CPAN module.
> 
> We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing
> work to migrate the app to Debian 5.0 (apache/mod_perl 2).
> 
> I don't mine the extra log data in development and intend to fix these
> issues but I can't have these '-e: Use of uninitialized value' cramming
> up my production log files.
> 
> I've tried everything I can think of, anyone have any ideas?
> 

If you are talking about cgi-bin scripts, then they probably all start 
with a line like
#!/usr/bin/perl -w

Removing the -w would do it.
But the warnings themselves mean something that you'd better not ignore.

To remove the -w, you could even use a perl one-liner, such as

perl -pi'.bak' -e 's/^#!\/usr\/bin\/perl -w/#!\/usr\/bin\/perl/' *.pl

.. but try this first on a limited set somewhere !!!