in reply to how can a subroutine find out the name of it's caller?
would print:#!/usr/bin/perl -w use strict; sub jojo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "2: " . $subroutine . "\n"; } sub jo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "1: " . $subroutine . "\n"; jojo; } jo;
#!/usr/bin/perl -w use strict; sub jojo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "2: $package - $subroutine \n"; } sub jo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(); print "1: $package - $subroutine \n"; jojo; } jo;
|
|---|