The compiler doesn't yet know about the prototype as it is parsing the line that contains my $self = _self(@_), so it doesn't know it must pass the array by reference. Either put an empty prototype at the top of the package, or switch the order of the subs in your source code.# With selftest declared after _self % perl -MO=Deparse test.pl ... sub Data::Validate::OO::selftest (@) { package Data::Validate::OO; my $self = &_self(\@_); # <---- look here print Dumper(@_); } ... # Now with selftest declared after _self % perl -MO=Deparse test.pl ... sub Data::Validate::OO::selftest (@) { package Data::Validate::OO; my $self = &_self(@_); # <---- and here print Dumper(@_); } ...
Incidentally, a prototype of (@) like you have in the selftest sub is equivalent to declaring no prototype at all. And as already mentioned, not honored for a method call anyway.
blokhead
In reply to Re: Prototype Failing?
by blokhead
in thread Prototype Failing?
by Flame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |