#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; sub printcaller { return ( caller(1) )[3]; } my $package = "testpackage"; { my $func_name = $package . '::function'; my $sub = sub { local *__ANON__ = $func_name; printcaller() }; no strict 'refs'; *{ $func_name } = $sub; } is( testpackage::function(), 'testpackage::function', 'tricked caller( +)!' );
In reply to Re: How to fool caller() / use NEXT within a dynamic sub
by chromatic
in thread How to fool caller() / use NEXT within a dynamic sub
by betterworld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |