Re: warnigns pragma and -w (solved: Re: Constant subroutine __USE_POSIX undefined (problem with p2ph?))
- To: Florian Hinzmann <f.hinzmann@mcs-cityline.net>
- Cc: debian-perl@lists.debian.org
- Subject: Re: warnigns pragma and -w (solved: Re: Constant subroutine __USE_POSIX undefined (problem with p2ph?))
- From: Kurt Starsinic <kstar@cpan.org>
- Date: Mon, 17 Feb 2003 22:32:47 -0500
- Message-id: <20030218033247.GA27949@verizon.net>
- In-reply-to: <20021128121104.4e98ac8f.f.hinzmann@mcs-cityline.net>
- References: <20021114181318.0d14671a.f.hinzmann@mcs-cityline.net> <20021114174752.GA2600@verizon.net> <20021128121104.4e98ac8f.f.hinzmann@mcs-cityline.net>
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: