jmo has asked for the wisdom of the Perl Monks concerning the following question:
This one misses variables though which really confuses me.foreach my $entry (sort values %:: ) { print "*" x 10, "Name: $entry Type: "; print "scalar is defined\t" if defined ${$entry}; print "array is defined\t" if defined @{$entry}; print "hash is defined\t" if defined %{$entry}; print "sub is defined\t" if defined &{$entry}; print "\n"; }
anduse strict; use sig_bla; sub bar { my $foo = 5; open (FO, ">/tmp/test_file") or die "doh!?"; print "file open\n"; print FO "Some small data in the open file\n"; while (1) { sleep 1; } } our @MYARR = ( 1, 2 ,3); my @my_arr = ( 1, 2 ,3); my $apa = 2; my $FOO = 10; our %MY_HASH = ( a => 2, b => 5); my %myhash = ( a => 2, b => 5); print "$$\n"; &bar();
Thanks in advancepackage sig_bla; use strict; use Data::Dumper; $SIG{USR1} = \&handle; sub handle { print "Got sig\n"; for (0..5) { my (@ap) = caller ($_); last unless scalar @ap; print Dumper \@ap; } foreach my $entry (sort values %:: ) { print "*" x 10, "Name: $entry Type: "; print "scalar is defined\t" if defined ${$entry}; print "array is defined\t" if defined @{$entry}; print "hash is defined\t" if defined %{$entry}; print "sub is defined\t" if defined &{$entry}; print "\n"; } } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dumping the content of a module
by cdarke (Prior) on Feb 18, 2011 at 13:24 UTC | |
|
Re: Dumping the content of a module
by ig (Vicar) on Feb 20, 2011 at 18:52 UTC |