$ perl -wMstrict -le 'print Time::HiRes::gettimeofday()'
Undefined subroutine &Time::HiRes::gettimeofday called at -e line 1.
$ perl -wMstrict -le 'print Cwd::getcwd()'
Undefined subroutine &Cwd::getcwd called at -e line 1.
$ perl -wMstrict -le 'print utf8::valid("foo")'
1
####
$ perl -wMstrict -le ' print join ",", File::Glob::bsd_glob("{x,y}={a,b}")'
Undefined subroutine &File::Glob::bsd_glob called at -e line 1.
$ perl -wMstrict -le '<*>; print join ",", File::Glob::bsd_glob("{x,y}={a,b}")'
x=a,x=b,y=a,y=b
####
use warnings;
use strict;
use Benchmark qw/cmpthese/;
{
package Foo;
sub bar { return $_[0] + $_[1] }
}
BEGIN { *bar = \&Foo::bar } # import
cmpthese(-2, {
imported => sub {
bar(2,3)==5 or die;
},
package => sub {
Foo::bar(2,3)==5 or die;
},
});