It looks like the offending code in Test::Resub is this:

... if ($capture{$ident}) { local $Storable::Deparse = 1; local $Storable::Eval = 1; my $saved_args = $deep_copy{$ident} ? dclone([@_]) : [@_]; push @{$method_args{$ident}}, $saved_args; } ...

... so that would seem to me that maybe your actual objects store callbacks as part of their data somewhere, and at least one of these callbacks can't be deparsed by B::Deparse (maybe because it's a function implemented in XS).

But without seeing more of your code, preferrably a self-contained short program that still exhibits the same problem, it's only guesswork.

A workaround would be to specify capture => 0, but I'm not sure what implications that has for your test. Likely you won't know with what arguments your subroutine was called. Personally, I don't see what benefit Test::Resub has over simply replacing the function yourself:

{ my @args; local *Aclass::doit = sub { push @args, [@_]; return 42; }; $boss_worker->doit; is 0+@args, 3, "We got called three times"; is_deeply \@args, [[...], [...], [...] ]; }

Update: Rereading your post topic, are you using the "Perl compiler" perlcc? It has been discontinued in Perl 5.10 (or at least Perl 5.12), as it never really worked. If it fails to work for you, that's unsurprising, and a fix is unlikely to be in sight.


In reply to Re: Perl compiler breaks using Test::Resub by Corion
in thread Perl compiler breaks using Test::Resub by ron7

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.