in reply to Re: import() magic
in thread import() magic

Actually, according to the docs: If no "unimport" method can be found the call fails with a fatal error., so this should fail:

$ perl -e ' *UNIVERSAL::import = sub { print "Whoops!" }; my $x = bless {}, 'Foo'; $x->import; no Foo'

Except it doesn't fail. This appears to be misdocumented. If you use strict, you'll get a baredword warning, but that's still not what the docs say. Am I misreading?

Further, I think the symbol table entries should not be autovivified. If you're doing some funky work walking the symbol table, those 'faux' entries could cause bad results. I don't like it. Nosireebob. I don't.

Cheers,
Ovid

Update: Added the word 'not'. Kinda changes the meaning, doncha think? :)

Update 2: I submitted a POD patch to P5P, but Abigail beat me to it.

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: Hey...two bugs in Perl from one node?
by Anonymous Monk on May 29, 2002 at 21:57 UTC
    From perldelta for perl 5.6.1:
    no Module; does not produce an error even if Module does not have an unimport() method. This parallels the behavior of use vis-a-vis import.

    Seems like they just forgot to update perlfunc.

    Cheers,
    -Anomo