9 BEGIN { plan tests => 9; }
14 "autouse"->import('List::Util' => 'List::Util::first');
16 ok( $@, qr/^autouse into different package attempted/ );
18 "autouse"->import('List::Util' => qw(max first(&@)));
21 my @a = (1,2,3,4,5.5);
25 # first() has a prototype of &@. Make sure that's preserved.
26 ok( (first { $_ > 3 } @a), 4);
29 # Example from the docs.
30 use autouse 'Carp' => qw(carp croak);
34 local $SIG{__WARN__} = sub { push @warning, @_ };
35 carp "this carp was predeclared and autoused\n";
36 ok( scalar @warning, 1 );
37 ok( $warning[0], "this carp was predeclared and autoused\n" );
39 eval { croak "It is but a scratch!" };
40 ok( $@, qr/^It is but a scratch!/);
44 # Test that autouse's lazy module loading works. We assume that nothing
45 # involved in this test uses Text::Soundex, which is pretty safe.
47 use autouse 'Text::Soundex' => qw(soundex);
49 my $mod_file = File::Spec->catfile(qw(Text Soundex.pm));
50 $mod_file = VMS::Filespec::unixify($mod_file) if $^O eq 'VMS';
51 ok( !exists $INC{$mod_file} );
52 ok( soundex('Basset'), 'B230' );
53 ok( exists $INC{$mod_file} );