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!