in reply to Re^4: "use" modifier code via import()
in thread "use" modifier code via import()

Well, strict, warnings, and lib are all pragmas, so I don't expect them to behave the same as user-written modules. CGI mostly uses the import parameters for importing. The "pragmas" it provides could be handled in another way. The CGI interface is pretty strange, and I wouldn't hold it up as an example of something I would want others to follow.

I've certainly never read that rule anywhere and don't assume only symbol exporting when I see a module.

There are no rules, as we all know, but some things are more confusing than others. Sometimes people go overboard with Perl's flexibility in order to get a certain syntax that appeals to them. The core documentation on the creation of modules is nearly all about using Exporter, and the idea that a function called "import" would be doing something entirely unlike importing is not obvious to people who haven't seen it done before.

  • Comment on Re: Re^4: "use" modifier code via import()

Replies are listed 'Best First'.
Re: Re: Re^4: "use" modifier code via import()
by hv (Prior) on May 18, 2004 at 03:40 UTC

    Personally, I hate Exporter: in general, I don't want anyone stomping on my namespace, and I'm happy to fully qualify function calls and variable references (indeed, eager to, since it makes the code far clearer).

    To me, import() is about bringing in the requested functionality: typically, modifying the behaviour of the package I'm loading as a result of the arguments I supply to use. Any and all creative use of import() (properly documented, of course) is fine by me.

    Hugo