caller.pl to HTML.

index -|- end

Generated: Tue Feb 2 17:54:23 2010 from caller.pl 2006/09/12 797.

#!/Perl
# AIM: to test caller function ...
my ($package, $filename, $line);
print "Hello, World...\n";
($package, $filename, $line) = caller;
print "package=[$package] filename=[$filename] line=[$line] ...\n";
thissub();
thatsub();
exit(0);
sub thissub {
   my ($pack, $file, $ln) = caller;
   print "package=[$pack] filename=[$file] line=[$ln] ...\n";
   print "note the line number is the line where this sub was called ...\n";
}
sub thatsub {
   my $i = 0;
   my ($package, $filename, $line, $subroutine, $hasargs,
    $wantarray, $evaltext, $is_require, $hints, $bitmask) = caller($i);
   print "p=[$package], f=[$filename], l=[$line], s=[$subroutine], h=[$hasargs]\n";
   print "w=[$wantarray], e=[$evaltext], i=[$is_require], t=[$hints], b=[$bitmask]\n";
}
# eof - caller.pl

index -|- top

checked by tidy  Valid HTML 4.01 Transitional