|
#!perl
my $foo = __PACKAGE__;
use declare class_attribute ca1 => 1; class_initialize;
class_verify;
my $bar = __PACKAGE__;
use declare class_attribute ca1 => 2; class_initialize;
class_verify;
my $baz = __PACKAGE__;
use declare class_attribute ca1 => 2; class_initialize;
class_verify;
eval "use MyClass::Baz qw(+DEFINE_LOCAL_SUBS)" ;
like( $EVAL_ERROR , qr/Function "m1" already defined in package "main"/ , "DIED: import existing local sub" );
my $f = $foo ->new;
my $b = $bar ->new;
$_ = $foo ;
is(ca1, 1, '$_ = Foo; ca1 eq 1' );
$_ = $bar ;
is(ca1, 2, '$_ = Bar; ca1 eq 2' );
|