[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: warnigns pragma and -w (solved: Re: Constant subroutine __USE_POSIX undefined (problem with p2ph?))



On Nov 28, Florian Hinzmann wrote:
> Hello Kurt!
> 
> Thanks for your answer. 
> 
> 
> On Thu, 14 Nov 2002 12:47:53 -0500
> "Kurt D. Starsinic" <kstar@cpan.org> wrote:
> 
> > On Nov 14, Florian Hinzmann wrote:
> > > I do get lines like this when running a perl script:
> > > 
> > > > Constant subroutine __USE_POSIX undefined at /usr/lib/perl/5.8.0/features.ph line 6.
> > > > Constant subroutine __USE_POSIX2 undefined at /usr/lib/perl/5.8.0/features.ph line 7.
> > > > Constant subroutine __USE_POSIX199309 undefined at /usr/lib/perl/5.8.0/features.ph line 8.
> > > > Constant subroutine __USE_POSIX199506 undefined at /usr/lib/perl/5.8.0/features.ph line 9.
> > > > Constant subroutine __USE_XOPEN undefined at /usr/lib/perl/5.8.0/features.ph line 10.
> 
> > 
> >     I'm the upstream guy.  You're seeing all of those useless warnings
> > because you're executing features.ph with warnings turned on.  They can
> > be silenced thusly:
> > 
> >         {
> >             no warnings;
> >             require "features.ph";
> >         }
> 
> This did not work. The following did:
> {
>   local ($^W) = 0;
>   #no warnings;
>   require "sys/ioctl.ph";
> }
> 
> (Note: sys/ioctl.ph 'requires' features.ph)
> 
> I have learned something about this by reading perllexwarn(1). This
> is how far I got:
> The warnings above are compile time warnings triggered by running perl
> with "-w". "use warnings" does not enable compile time warnings, but 
> using "-w" does. 
> 
> Writing "no warnings" inside a block did not turn them off, but 
> "local ($^W) = 0" did. This solved my problem for now, but left
> me confused.
> 
> As far as I understand perllexwarn(1) "-w" is kind of depreciated
> and the "warnings" pragma should be used instead. But the pragma
> does not give me compile time warnings like "-w". I have no idea
> currently if this is bad, that is which kind of errors compile time
> warnings will catch.
> 
> 
> perllexwarn(1) says about the warning pragma:
> 'It also means that the pragma setting will not leak across files (via "use",
>  "require" or "do").'
> Is this the reason your proposed solution did not work?
> 
> 
> This whole issue isn't very pressing for my any longer as I can
> continue programming without warnings. But would really like 
> to understand the implications of different warning settings as
> I don't write perl scripts without warnings turned on.
> Therefore I would be thankful for anyone who is able to
> bring some light into this issues.

Florian,

    I've confirmed that the problem only occurs when selecting the
deprecated "-w" option.  When using the preferred "warnings" pragma,
lexical scoping of warnings prevents these warnings from occurring.
I don't believe that an upstream patch is in order.

    Regards,
    Kurt



Reply to: