Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Use, Exporter, I'm Dizzy.

by caelifer (Scribe)
on Feb 07, 2007 at 17:52 UTC ( [id://598833]=note: print w/replies, xml ) Need Help??


in reply to Re: Use, Exporter, I'm Dizzy.
in thread Use, Exporter, I'm Dizzy.

Just a question to your answer - is there something wrong with this form?
package MyTest; use strict; use warnings; use base qw(Exporter); our @EXPORT_OK = qw(testroutine); # Rest of the code here ...

In other words, does BEGIN form have any advantage over use base?

-BR

Replies are listed 'Best First'.
Re^3: Use, Exporter, I'm Dizzy.
by ikegami (Patriarch) on Feb 07, 2007 at 17:55 UTC
    • You pretend there's an is-a relationship where there isn't one.
    • That won't work if two modules include each other.

    Newer versions of Exporter recognize the first point and allow you to do

    package MyTest; use strict; use warnings; BEGIN { our @EXPORT_OK = qw( testroutine ); } use Exporter qw( import ); # Rest of the code here ...

    The BEGIN is there to address the second point.

      Thanks. Good insight!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://598833]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2024-04-23 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found