Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The RequireExplicitPackage policy arose out of some code really bad legacy code that I have at work. A lot of it was written for Perl 4, and the author's didn't really understand how to use namespaces. Consider this example:

    In file Foo.pm:
    sub frobulator{ print shift; }
    our $SHIZZLE = 42;

    package Foo;

    sub foo { return main::frobulator( @_ ) }


    In file my_script.pl:
    use Foo;
    Foo::foo( $SHIZZLE );

    Since $SHIZZLE and &frobulator are declared before the package statement in Foo.pm, they wind up in the caller's namespace (main). So Foo::foo will only work if it is loaded by main. And when my_script starts loading other libraries that might also load Foo, then it become a big steaming pile.

    I trully hope that sane developers will never encounter this problem. But I'm frequently surprised how much insanity there is in the world :)