Skip Menu |

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

Report information
The Basics
Id: 20731
Status: new
Priority: 0/
Queue: Contextual-Return

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

Bug Information
Severity: Normal
Broken in: v0.1.0
Fixed in: (no value)



Subject: Contextual::Return effects caller()
Contextual::Return effects the call stack of the block being returned thus reducing its transparency. sub contextual_caller { return LIST { caller } SCALAR { scalar caller } } sub wantarray_caller { return wantarray ? caller : scalar caller } These two functions should be equivalent but contextual_caller() returns "Contextual::Return" and wantarray_caller() returns "main" thus exposing that LIST and SCALAR are not taking a block but a subroutine. Attached is a test file for this. Sub::Uplevel might come in handy. This should also eliminate the hack for Carp.
Subject: caller.t
use Contextual::Return; use warnings; use Test::More 'no_plan'; sub contextual_caller { return LIST { caller } SCALAR { scalar caller } } sub wantarray_caller { return wantarray ? caller : scalar caller; } is_deeply [contextual_caller], [wantarray_caller]; is scalar contextual_caller, scalar wantarray_caller;