in reply to Identify the package a subroutine is being called from
Although, the way you have set things up, this will return Test::package_name for both Calling->package_name and Calling2->package_name. Technically this is correct so you could add information about $_[0] in the result.package Test: sub package_name { my @c = caller(0); $c[3]; }
sub package_name { my @c = caller(0); "$c[3] (with self = $_[0])" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Identify the package a subroutine is being called from
by moritz (Cardinal) on Jun 06, 2008 at 17:21 UTC | |
by pc88mxer (Vicar) on Jun 06, 2008 at 17:50 UTC |