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

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.