[Chicago-talk] Finding out where a sub is called from

David Young davidy at nationalcycle.com
Mon Feb 16 06:50:32 PST 2009


I use:  

my $thisSUB = (caller(0))[3];

ydy

>>> shawn.c.carroll at gmail.com 02/16/09 07:53AM >>>
http://perldoc.perl.org/functions/caller.html 

On Mon, Feb 16, 2009 at 7:49 AM, Richard Reina
<richard at rushlogistics.com> wrote:
> Is there a type of variable that can tell me where a subroutine was called from?
>
> For example if I do:
>
> #!/usr/bin/perl -w
> # caller.pl
> require "./script.pl";
> my $result = do_it();
>
>
> #!/usr/bin/perl -w
> # script.pl
>
> sub do_it {
>
> # who called for me?
>
> }
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org 
> http://mail.pm.org/mailman/listinfo/chicago-talk 
>



-- 
shawn.c.carroll at gmail.com 
Perl Programmer
Soccer Referee
_______________________________________________
Chicago-talk mailing list
Chicago-talk at pm.org 
http://mail.pm.org/mailman/listinfo/chicago-talk



More information about the Chicago-talk mailing list