package Foo;
#use strict;
use Class;
class {
attr qw( foo bar );
isa 'Foo::Base';
method floozle =>
signature (Int, Int),
body {
my ($v1, $v2) = @_;
$self->foo( $v1 );
return $self->get_bar( $v2 );
};
};
package main;
my $obj = Foo->new;
$foo->set_foo( 3 );
$foo->floozle( 9, 5 );
# These croak
$foo->floozle()
$foo->floozle( 9, 'a' );
####
Variable "$self" is not imported at t/lib/Foo.pm line ##.
Global symbol "$self" requires explicit package name at t/lib/Foo.pm line ##.
##
##
Variable "%s" is not imported%s
(F) While "use strict" in effect, you referred to a global variable that you apparently thought was imported from another module, because something else of the same name (usually a subroutine) is exported by that module. It usually means you put the wrong funny character on the front of your variable.