in reply to Re: Overwrite built-in wantarray()
in thread Overwrite built-in wantarray()
I only want to fake the context for this one sub-call. All contexts in calls in this tested_sub() should be real and unmodified. When I overwrite the caller() function and change the wantarray-flag, this doesn't have any effect for wantarray().FakeContext('void'); my @response = tested_sub(); is(scalar(@response), 0, 'void return'); FakeContext('scalar'); my @response = tested_sub(); is(scalar(@response), 1, 'scalar return');
And I've to decorate ist, because when I overwrite it complete, I can't fake only the first level of my sub-call.
The only (not really god) idea I've is, to overwrite the wantarray() and use caller() to read out the context. But I think this will cause stragne side-effects.
Any ideas? With PadWalker or Devel::Caller I can read out many things, but can I change the context? I don't know (yet).PS: with CORE::GLOBAL::wantarray I can overwrite the function, but I can't get any referene to the original sub.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What I want to do with that
by merlyn (Sage) on Aug 21, 2007 at 16:53 UTC |