[Israel.pm] Backtrace

Yuval Kogman nothingmuch at woobling.org
Sun Jun 6 07:15:14 PDT 2010


On 6 June 2010 16:18, Gaal Yahas <gaal at forum2.org> wrote:

> Note also this from perlfunc for "caller":
>
>               Furthermore, when called from within the DB package,
> caller returns more detailed
>               information: it sets the list variable @DB::args to be
> the arguments with which
>               the subroutine was invoked.


It's not really clear from the docs how to use it, but this does the trick:

    my @args = do { package DB; caller(); our @args };

This is also available from a few CPAN modules, BTW.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100606/2d0260d7/attachment.htm 


More information about the Perl mailing list