I got your code to work by changing the order of sub selftest and sub _self declarations in your source:
# 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(@_); } ...
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.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.