Skip Menu |

This queue is for tickets about the Scope-Upper CPAN distribution.

Report information
The Basics
Id: 61904
Status: resolved
Priority: 0/
Queue: Scope-Upper

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

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



Subject: Scope::Upper failure under Devel::NYTProf
Test script, when run, should produce 1\n2\n3\n sequence, but, when run as perl -d:NYTProf test.pl it terminates abnormally with "Can't use string ("2") as a subroutine ref while "strict refs" in use at test.pl line 10." Proposed patch is attached, it makes Devel::NYTProf think that we're executing proper opcode. PS: use latest Devel::NYTPof, as cooperation with versions before 4.00 needs patching of Devel::NYTPof.
Subject: Upper.patch
--- Upper.xs.old 2010-05-19 04:33:47.000000000 +0400 +++ Upper.xs 2010-09-05 02:24:46.000000000 +0400 @@ -118,6 +118,7 @@ /* --- Global data --------------------------------------------------------- */ #define MY_CXT_KEY __PACKAGE__ "::_guts" XS_VERSION +STATIC OP fake_return_op; typedef struct { char *stack_placeholder; @@ -757,6 +758,7 @@ items, PL_stack_sp - PL_stack_base, *PL_markstack_ptr, mark); }); + PL_op = &fake_return_op; PL_op = PL_ppaddr[OP_RETURN](aTHX); *PL_markstack_ptr = mark; @@ -877,6 +879,7 @@ { HV *stash; + fake_return_op.op_type = OP_RETURN; MY_CXT_INIT; MY_CXT.stack_placeholder = NULL;
Subject: test.pl
#!/usr/bin/perl use strict; $| = 1; use Scope::Upper qw(:all); my $scope; sub z{ unwind(2, $scope); print "not reached\n"; } sub x{ $scope = HERE; z(); } print 1, "\n"; print x(), "\n"; print 3, "\n";
Sorry that I haven't answered sooner. I've just released Scope::Upper 0.13 that contains a fix very similar to your proposal. Many thanks for contributing it. Vincent.