[lug] Perl question

Zan Lynx zlynx at acm.org
Mon Apr 6 22:44:58 MDT 2009


On Mon, 2009-04-06 at 19:50 -0600, Tom Christiansen wrote:
> In-Reply-To: Message from Zan Lynx <zlynx at acm.org> 
>    of "Mon, 06 Apr 2009 18:04:17 MDT." <49DA9881.1060501 at acm.org> 
> 
> > Any "use" statements must be inside the scope of the "package" that 
> > wants to use them.  What is probably happening is something like this:
> 
> That's not really accurate.  If the "use" on a regular module triggers an
> import, then yes, those exports will (likely) go into the namespace of
> the caller's compile-time package.  However, there are also "use"
> statements that have no affect on the package, but rather on the caller's
> enclosing lexical scope, something that's orthogonal (=utterly unrelated)
> to its package.  Witness:
> 
>     % perl -le 'use bignum; print 123->is_odd; package Other; print 245->is_odd'
>     1
>     1
> 
> The Switch.pm module is yet a different sort of beast altogether, and 
> pretty nasty about it, too.  Have you *looked* at its import() method?

Nope.  I just assumed it was a package scope problem because I have run
into so many of those.

I had no idea Perl could be so screwed up! :-)

Actually I should be amazed that can be made to work at all.
-- 
Zan Lynx <zlynx at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20090406/3f298067/attachment.pgp>


More information about the LUG mailing list