in reply to Perl compiler breaks using Test::Resub
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl compiler breaks using Test::Resub
by ron7 (Beadle) on Feb 04, 2011 at 01:23 UTC | |
|
Re^2: Perl compiler breaks using Test::Resub
by rurban (Scribe) on Apr 25, 2011 at 12:21 UTC |