in reply to "use" modifiers

The question is: is this really the way it should be done?
There's little "should" in Perl. This is a way of doing it - the Test::More module is just taking the arguments it's interested in, and it's delegating any exporting to Exporter.

Abigail

Replies are listed 'Best First'.
Re: Re: "use" modifiers
by pbeckingham (Parson) on May 12, 2004 at 15:06 UTC

    Thank you. I understand the "should" issue - a side effect of there being MTOWTDI. I was just hoping that someone knows of a cleaner way to achieve this without intercepting the import process and fishing out the desired values. Of the many ways to do it, I was hoping that one would be more readable and obvious to the next guy that has to maintain my code.

    I would prefer clearer, more obvious code over a cryptic incantation with a paragraph of explanatory prose.

      Considering the only time (shy of doing a source filter) you get to the arguments of "use" is when "import" is called, there is no other way than "intercepting the import process". I don't see what's so non-clean about it - the import process is 100% Perl, and just involves a method call - a call that's as regular as any other method call.

      Of course, you could always to your own exporting - which might be as simple as the call to export_to_level. Everyone uses Exporter, but in 99% of the cases it could as easily be done without using Exporter.

      Abigail