develooper Front page | perl.perl5.porters | Postings from January 2018

Re: [perl #132732] use if - behaviour does not match documentation

Thread Previous | Thread Next
From:
Dan Book
Date:
January 25, 2018 00:54
Subject:
Re: [perl #132732] use if - behaviour does not match documentation
Message ID:
CABMkAVU++Sg1jvrgsn9UC962qRw-xAOZxFYD-ca0R3mX8BoyKg@mail.gmail.com
On Wed, Jan 24, 2018 at 4:18 PM, James E Keenan via RT <
perlbug-followup@perl.org> wrote:

> On Wed, 24 Jan 2018 17:38:14 GMT, grinnz@gmail.com wrote:
> > >
> > >
> > That should be reasonable, but note that not many modules implement
> > unimport; 'no warnings' is probably the most common usage of 'no'.
> >
> > -Dan
>
> There are many instances of the 'no' function in the source code, but very
> few instances of the string 'no if'.  See attachment for output of 'ack
> '\bno\s+if\b' .'.  Almost every instance is testing one of Perl's special
> variables against some value and, as you say, most are warnings-related.
>
> Unfortunately that isn't getting us any close to solving the problem.  Is
> anyone familiar with where/how 'no' is implemented in the source code?
>
>
'no' is the same as 'use' but it calls unimport instead of import. The
complications just come from modules not generally implementing an unimport
method that mirrors the import (mostly because unimporting functions
doesn't really make practical sense). So only pragmas that create lexical
effects tend to use it.

-Dan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About