Skip Menu |

This queue is for tickets about the Contextual-Return CPAN distribution.

Report information
The Basics
Id: 78768
Status: resolved
Priority: 0/
Queue: Contextual-Return

People
Owner: Nobody in particular
Requestors: FRAZER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: using Carp with Contextual::Return causes "Incomplete caller override" message
When using Contextual::Return with Carp, it displays the args as "** Incomplete caller override detected; @DB::args were not set **". Below are some one-liners to demonstrate the issue. The first two are Carp and Contextual::Return working independently and the third shows what happens when mixed. Show quoted text
> perl -MCarp -le 'sub f { Carp::confess("Forgive me..."); }; f();'
Forgive me... at -e line 1 main::f() called at -e line 1 Show quoted text
> perl -MContextual::Return -le 'sub f { print caller(); }; f();'
main-e1main::f1256 Show quoted text
> perl -MContextual::Return -MCarp -le 'sub f { Carp::confess("Forgive
me..."); }; f();' Forgive me... at -e line 1 main::f(** Incomplete caller override detected; @DB::args were not set **) called at -e line 1
From: nick [...] ccl4.org
on Fri Aug 03 12:13:04 2012, FRAZER wrote: Show quoted text
> When using Contextual::Return with Carp, it displays the args as "** > Incomplete caller override detected; @DB::args were not set **". > > Below are some one-liners to demonstrate the issue. The first two are > Carp and Contextual::Return working independently and the third shows > what happens when mixed.
> > perl -MCarp -le 'sub f { Carp::confess("Forgive me..."); }; f();'
> Forgive me... at -e line 1 > main::f() called at -e line 1
> > perl -MContextual::Return -le 'sub f { print caller(); }; f();'
> main-e1main::f1256
> > perl -MContextual::Return -MCarp -le 'sub f { Carp::confess("Forgive
> me..."); }; f();' > Forgive me... at -e line 1 > main::f(** Incomplete caller override detected; @DB::args were > not set **) called at -e line 1
This is Carp reporting problems with other code. It's not a bug in Carp - it's Carp avoiding subtle external bugs. In the case of Contextual::Return, I *think* that the problem is that instead of overriding CORE::caller, it tries to override Carp's routines, but doesn't do them all. The code starts like this: package Contextual::Return; # Fake out CORE::GLOBAL::caller and Carp very early... BEGIN { no warnings 'redefine'; my $fallback_caller = *CORE::GLOBAL::caller{CODE}; *CORE::GLOBAL::caller = sub { my ($uplevels) = shift || 0; if ($fallback_caller) { return $fallback_caller->($uplevels + 2 + $Contextual::Return::uplevel) if $Contextual::Return::uplevel; return $fallback_caller->($uplevels + 1); } else { return CORE::caller($uplevels + 2 + $Contextual::Return::uplevel) if $Contextual::Return::uplevel; return CORE::caller($uplevels + 1); } }; use Carp; my $real_carp = *Carp::carp{CODE}; my $real_croak = *Carp::croak{CODE}; *Carp::carp = sub { goto &{$real_carp} if !$Contextual::Return::uplevel; warn _in_context(@_); }; *Carp::croak = sub { goto &{$real_croak} if !$Contextual::Return::uplevel; die _in_context(@_); }; } I see carp and croak in there, but not cluck or confess. So I think that that's the code that needs changing to fix this problem. Nicholas Clark
From: nick [...] ccl4.org
On Sat Aug 04 06:36:55 2012, nick@ccl4.org wrote: Show quoted text
> This is Carp reporting problems with other code. It's not a bug in > Carp - it's Carp avoiding subtle external bugs. > > In the case of Contextual::Return, I *think* that the problem is that > instead of overriding CORE::caller, it tries to override Carp's > routines, but doesn't do them all. The code starts like this:
Show quoted text
> I see carp and croak in there, but not cluck or confess. So I think > that that's the code that needs changing to fix this problem.
Also, it seems that while I am getting notifications about bugs in Carp (which isn't actually my module, but I am familiar with the code in question) and can comment on the ticket, I don't have the privileges to transfer this ticket to the Contextual-Return queue. So I'm not quite sure what to do next. Nicholas Clark
Subject: Re: [rt.cpan.org #78768] using Carp with Contextual::Return causes "Incomplete caller override" message
Date: Sat, 4 Aug 2012 07:57:45 -0400
To: Nicholas Clark via RT <bug-Carp [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* Nicholas Clark via RT <bug-Carp@rt.cpan.org> [2012-08-04T06:39:49] Show quoted text
> Also, it seems that while I am getting notifications about bugs in > Carp (which isn't actually my module, but I am familiar with the code > in question) and can comment on the ticket, I don't have the > privileges to transfer this ticket to the Contextual-Return queue. So > I'm not quite sure what to do next.
Done. -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #78768] using Carp with Contextual::Return causes "Incomplete caller override" message
Date: Sun, 5 Aug 2012 18:03:54 +1000
To: bug-Contextual-Return [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
>> I don't have the privileges to transfer this ticket to the Contextual- >> Return queue. So I'm not quite sure what to do next.
> > Done.
...and patched ...and uploaded. Thank-you gentlemen! Damian
I installed the latest version from CPAN and it appears to be working now. Thank you!