use Carp qw(croak);
sub instance_only {
ref(my $self = shift ) or croak "instance variable needed";
... use $self as the instance ...
}
sub class_only {
ref(my $self = shift) and croak "class name needed";
... use $class as the class..
}
instance variable needed at their_code line 1234
告诉用户引起问题的行号
croak->die
crap->warn
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24104518/viewspace-722725/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24104518/viewspace-722725/