I have the little program below (reduced somewhat from my last post) which dumps core. I'm not sure whether the use of Hook::LexWrap contributes to the problem, but I was too scared to try removing the glob/object trickery used by Hook::LexWrap.
The problem occurs with IndigoPerl 5.6.1, build 626, running under Windows 2000.
The Hook::LexWrap documentation states that @_ will be filled in the callback with the parameters to the original (wrapped) routine, plus an additional parameter which is the placeholder for the return value. So I'm expecting two elements in @_, first the passed parameter (bar in the example), and second either the place holder for my return value (undef on entry), or an element beyond the end of the array (undef as well).
As somebody who dosen't poke around in perls internals, my wild guess is that @_ in the "pre"-callback contains a (pointer to a) glob whose object has passed out of existence already, but that's a wild guess obviously.
Anybody wanting to hit me over the head with a P5P reference discussing this bug please feel free to do so :-).
Update: Updated the parameter to the call to wrapped_NoAttr() to reflect what the text says
#!/usr/bin/perl -w # Yes, I use a UNIX hashbang line, even though I'm running # under Windows. Call me weird. use strict; use warnings; use Hook::LexWrap; sub wrapClassMethod { my ($symbol) = @_; my $name = *{$symbol}{NAME}; #print "Wrapping $package" . "::" . "$name\n"; # Install our access level checker : wrap $name, pre => sub { # First I thought I was getting wrapClassMethod's @_, # but this isn't the case. It's getting curioser and # curioser. my ($first,@args) = @_; print "\$symbol here is $symbol\n"; $first = "<undef>" unless defined $first; print "\$first here is $first\n"; print "*** They are the same.\n" if $first eq $symbol +; print "They are not the same.\n" unless $first eq $sy +mbol; my $a; print "This works :"; $a = $_[0]; print "$a\n"; print "This dosen't work (core dump) :"; $a = $_[1]; print "$a\n"; }; } sub wrapped_NoAttr { print "foo\n"; }; wrapClassMethod(*wrapped_NoAttr); wrapped_NoAttr("bar");
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Bug ? Perl dumps core on reference to @_ ? by Corion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |