in reply to Re: Need help writting a Perl Module
in thread Need help writting a Perl Module
do I need to give @EXPORT and @EXPORT_OK the name of the variable or the subroutine?
If I'm understanding you correctly, your question is whether you need to specify the same variable/subroutine in both the @EXPORT and the @EXPORT_OK array (?) If so, no, put it in either one of them.
@EXPORT_OK is for stuff to be exported upon request, i.e. when the user writes use Module qw(foo); while @EXPORT is for what should be exported by default (without explicit request), i.e. when the user simply says use Module;. If undesired, those default exports have to be disabled by writing use Module (); - note the (empty) list.
P.S.
require Exporter; our @ISA = qw(Exporter);
can also be written as
use Exporter 'import';
(see also Re: Advice on style)
|
|---|