B
bill
If I uncomment the 'use SlicesDices ...' line below, running the
script/module from the command line results in a 'Subroutine quux
redefined' warning.
#!/usr/bin/perl -w use strict;
# SlicesDices.pm
package SlicesDices;
use base 'Exporter';
BEGIN { push @SlicesDices::EXPORT, 'quux' }
sub quux {
local $| = 1;
print "hello from quux\n";
return;
}
return 1 if (caller(0))[7];
package main;
# use SlicesDices; # results in a 'redefined' warning
# quux();
__END__
The problem seems to be that the 'use SlicesDices' statement is
causing the file to be read again. Is there any reasonably scalable
way to import the subs in @SlicesDices::EXPORT to the main namespace
without using "use", and not causing the redefinition to take place?
Thanks!
bill
script/module from the command line results in a 'Subroutine quux
redefined' warning.
#!/usr/bin/perl -w use strict;
# SlicesDices.pm
package SlicesDices;
use base 'Exporter';
BEGIN { push @SlicesDices::EXPORT, 'quux' }
sub quux {
local $| = 1;
print "hello from quux\n";
return;
}
return 1 if (caller(0))[7];
package main;
# use SlicesDices; # results in a 'redefined' warning
# quux();
__END__
The problem seems to be that the 'use SlicesDices' statement is
causing the file to be read again. Is there any reasonably scalable
way to import the subs in @SlicesDices::EXPORT to the main namespace
without using "use", and not causing the redefinition to take place?
Thanks!
bill