in reply to Re: Perl Bug? import function
in thread Perl Bug? import function

Thanks, I never would have thought of that. I guess the "use hack" to which you refer is the "::" notation. This seems widely used, but maybe it shouldn't be. Is this one of those "features" that works by some strange quirk in perl itself or was this a design feature? Just curious about the history. Thanks again, jr

Replies are listed 'Best First'.
Re: Re: Re: Perl Bug? import function
by wog (Curate) on Sep 13, 2001 at 04:17 UTC
    Using the :: notation is not a "use hack" by itself. This is used, quite properly, to have modules be in catergories, e.g. XML::Parser, IO::Socket, etc.

    What I was referring to was taking advantage of this notation to load a module based on its location, instead of based on its name. The way to do this task in a way which does not have cavaets is to modify @INC (e.g. using lib) so you can load the module in question using its real name. Even if this approach did work, I find it to be bad style -- a use line should tell you what module you are using, it should not be something that needs to be modified when you just move files around.

      I've never looked at the code for XML::Parser for example, is the actual module (package) as follows..?
      package XML::Parser;
      I looked, it is! Thanks for the heads up. I never considered the separtion of file name space and module hierarchy as separate because i didn't know that the above was a valid package name. Thanks again jr