package Mod2;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(subr); # Exported by default
sub import {
print "import() was called with arguments : @_\n";
my $my_arg = pop @_;
# i have to pop(),
# because export_to_level() doesn't want to see $my_arg
print "my arg: $my_arg\n";
Mod2->export_to_level(1, @_);
}
sub subr { return "subr() was called\n"; }
1;
####
use Mod2 'argument';
print subr();
####
import() was called with arguments : Mod2 argument
my arg: argument
subr() was called
####
package Mod3;
use Perl6::Export::Attrs;
sub subr :Export(:DEFAULT) { return "subr() was called\n"; }
IMPORT{ print "inside the IMPORT block\n"; }
1;
####
inside the IMPORT block
Can't call method "IMPORT" without a package or object reference at Mod3.pm line 11.
Compilation failed in require at Script3.pl line 5.
BEGIN failed--compilation aborted at Script3.pl line 5.