Flame has asked for the wisdom of the Perl Monks concerning the following question:
This is the test proggy:sub selftest(@){ my $self = _self(@_); print Dumper(@_); } sub _self(\@){ print Dumper(@_); if(ref($_[0]->[0]) && $_[0]->[0]->_me() eq 'DVALID'){ return shift(@{ $_[0] }); }else{ return; } }
This is the output:my $chk = new Data::Validate::OO( -failure => sub{ my $rule = shift; print "Error in rule '$rule': ". +join(', ',@_)."\n"; }, ); $chk->selftest(qw(This Is a Test of the emergency broadcast system!));
$VAR1 = bless( { '_error' => '', '_fail' => sub { "DUMMY" }, '_rules' => {} }, 'Data::Validate::OO' ); $VAR2 = 'This'; $VAR3 = 'Is'; $VAR4 = 'a'; $VAR5 = 'Test'; $VAR6 = 'of'; $VAR7 = 'the'; $VAR8 = 'emergency'; $VAR9 = 'broadcast'; $VAR10 = 'system!'; Not an ARRAY reference at OO.pm line 264.
Now, according to perlman:perlsub "Any backslashed prototype character represents an actual argument that absolutely must start with that character. The value passed as part of @_ will be a reference to the actual argument given in the subroutine call, obtained by applying \ to that argument." Reading this, it seems to me that I should be getting a reference to the @_ of the caller sub. Unfortunately that apparently isn't happening... unless I messed up somewhere else (which is quite possible).
If there is any more information you feel might help to solve the problem, please request it and I will do my best to take care of it.
Thank you.
My code doesn't have bugs, it just develops random features.
Flame ~ Lead Programmer: GMS | GMS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Prototype Failing?
by BrowserUk (Patriarch) on Jan 27, 2003 at 04:46 UTC | |
by Flame (Deacon) on Jan 27, 2003 at 04:49 UTC | |
by BrowserUk (Patriarch) on Jan 27, 2003 at 05:02 UTC | |
by Flame (Deacon) on Jan 27, 2003 at 05:08 UTC | |
by John M. Dlugosz (Monsignor) on Jan 27, 2003 at 07:00 UTC | |
by BrowserUk (Patriarch) on Jan 27, 2003 at 07:48 UTC | |
by Flame (Deacon) on Jan 27, 2003 at 22:08 UTC | |
|
Re: Prototype Failing?
by blokhead (Monsignor) on Jan 27, 2003 at 04:52 UTC | |
by Flame (Deacon) on Jan 27, 2003 at 05:00 UTC | |
|
Re: Prototype Failing?
by Aragorn (Curate) on Jan 27, 2003 at 07:22 UTC |