1Devel::ArgNames(3)    User Contributed Perl Documentation   Devel::ArgNames(3)
2
3
4

NAME

6       Devel::ArgNames - Figure out the names of variables passed into
7       subroutines.
8

SYNOPSIS

10               use Devel::ArgNames;
11
12               sub foo {
13                       warn "foo() called with arguments: "
14                               . join(", ", map { defined() ? $_ : "<unknown>" } arg_names(@_) );
15               }
16
17               foo($bar, $gorch, $blah[4]);
18

DESCRIPTION

20       When print-debugging code, you will often ind yourself going:
21
22               print "\$foo is $foo, \$bar is $bar"
23
24       With this module, you can write a reusable subroutine easily:
25
26               sub my_print_vars {
27                       my %vars;
28
29                       @vars{arg_names()} = @_;
30
31                       foreach my $var ( keys %vars ) {
32                               warn "$var is $vars{$var}\n";
33                       }
34               }
35
36               my_print_vars($foo, $bar);
37
38       This module doesn't provide dumping facilities because there are too
39       many to choose from. This is a DIY kit ;-)
40

EXPORTS

42       arg_names [ $level ]
43           This function will return the names associated with the variables
44           found on @_, at the level $level. If $level is not provided
45           "arg_names"'s caller's caller will be used ("$level == 2" in that
46           case).
47

VERSION CONTROL

49       This module is maintained using Darcs. You can get the latest version
50       from <http://nothingmuch.woobling.org/Devel-ArgNames/>, and use "darcs
51       send" to commit changes.
52

SEE ALSO

54       Data::Dumper::Simple, DB, Devel::Caller, Devel::Caller::Perl,
55       PadWalker.
56

AUTHORS

58       Ran Eilam
59
60       Yuval Kogman <nothingmuch@woobling.org>
61
63               Copyright (c) 2007 Yuval Kogman. All rights reserved
64               This program is free software; you can redistribute
65               it and/or modify it under the same terms as Perl itself.
66
67
68
69perl v5.34.0                      2021-07-22                Devel::ArgNames(3)
Impressum