1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#! perl
use Test::More tests => 5;
BEGIN
{
use_ok( 'Modern::Perl' ) or exit;
Modern::Perl->import();
}
eval 'say "# say() should be available";';
is( $@, '', 'say() should be available' );
eval '$x = 1;';
like( $@, qr/Global symbol "\$x" requires explicit/,
'strict should be enabled' );
my $warnings;
local $SIG{__WARN__} = sub { $warnings = shift };
my $y =~ s/hi//;
like( $warnings, qr/Use of uninitialized value/, 'warnings should be enabled' );
eval<<'END_CLASSES';
package A;
$A::VERSION = 1;
package B;
@B::ISA = 'A';
package C;
@C::ISA = 'A';
package D;
use Modern::Perl;
@D::ISA = qw( B C );
END_CLASSES
package main;
is_deeply( mro::get_linear_isa( 'D' ), [qw( D B C A )], 'mro should use C3' );
|