pbeckingham has asked for the wisdom of the Perl Monks concerning the following question:
I would like to emulate a module feature that I see in Test::More in my own module. I am able to set the number of tests on the same line that the use statement appears. For example:
What I'm seeing is that Test::More implements sub import, which has, as its 2nd and 3rd element of @_ the pair tests => 5, and so it uses splice to extract the pair, then punts the remainder of @_ using:use Test::More tests => 5;
__PACKAGE__->_export_to_level(1, __PACKAGE__, @imports);
The question is: is this really the way it should be done? Is there a simpler way to achieve this? Thank you all. I am using 5.8.0 and 5.8.4.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "use" modifiers
by Abigail-II (Bishop) on May 12, 2004 at 14:55 UTC | |
by pbeckingham (Parson) on May 12, 2004 at 15:06 UTC | |
by Abigail-II (Bishop) on May 12, 2004 at 15:23 UTC | |
|
Re: "use" modifiers
by bbfu (Curate) on May 12, 2004 at 16:15 UTC | |
|
Re: "use" modifiers
by perrin (Chancellor) on May 12, 2004 at 20:00 UTC |