- or download this
package Bar;
use Data::Dumper;
...
sub bar
{
my $arg = shift;
- or download this
if(ref($arg) eq 'ARRAY') {
return map {
$_->bar;
} @{ $arg };
}
- or download this
print "bar\n";
}
...
}
package main;
- or download this
use autobox ARRAY => 'Bar';
- or download this
Foo->new->foo->bar;
#no more "Can't call method "bar" on unblessed reference"
#because now ->bar is a native method of ARRAYREFs.
#actually all the methods of Bar are native methods on ARRAYREFs now.