get %INC and dump into file
Perl
Permalink
Failed to load latest commit information.
.gitignore
README.pod
dump-perl-env
dump-perl-inc
dump-perl-incpath
dump-perl-memusage
dump-perl-stacktrace
hook-perl-require
inspect-perl-proc
perl-requiretree

README.pod

NAME

inspect-perl-proc - inspect running perl process

SYNOPSIS

inspect-perl-proc [-m MODE] [-p PID] [-d | --debug]

dump-perl-inc [-p PID] [-d | --debug]

dump-perl-incpath [-p PID] [-d | --debug]

dump-perl-memusage [-p PID] [-d | --debug]

dump-perl-env [-p PID] [-d | --debug]

dump-perl-stacktrace [-p PID] [-d | --debug]

hook-perl-require [-p PID] [-d | --debug]

inspect-perl-proc -h | --help | -?

  $ inspect-perl-proc -m 'dump-inc' -p 1974
    OR
  $ dump-perl-inc -p 1974
  
  $ inspect-perl-proc -m 'dump-incpath' -p 1974
    OR
  $ dump-perl-incpath -p 1974
  
  $ inspect-perl-proc -m 'dump-memusage' -p 1974
    OR
  $ dump-perl-memusage -p 1974
  
  $ inspect-perl-proc -m 'dump-env' -p 1974
    OR
  $ dump-perl-env -p 1974
  
  $ inspect-perl-proc -m 'dump-stacktrace' -p 1974
    OR
  $ dump-perl-stacktrace -p 1974
  
  $ inspect-perl-proc -m 'hook-require' -p 1974
    OR
  $ hook-perl-require -p 1974

After inspecting, you can get a result as shown below.

  my $result = do '/tmp/dump_memusage.1974.1368772330';
  warn Dumper($result);

DESCRIPTION

This script is for inspecting running perl process.

inspect-perl-proc has several modes.

"dump-inc" is to dump %INC (loaded modules). "inspect-perl-proc --mode 'dump-inc'" is same as "dump-perl-inc".

"dump-incpath" is to dump @INC (load paths). "inspect-perl-proc --mode 'dump-incpath'" is same as "dump-perl-incpath".

"dump-memusage" is to dump memory size by package. "inspect-perl-proc --mode 'dump-memusage'" is same as "dump-perl-memusage".

"dump-env" is to dump %ENV. "inspect-perl-proc --mode 'dump-env'" is same as "dump-perl-env".

"dump-stacktrace" is to dump stacktrace (backtrace). "inspect-perl-proc --mode 'dump-stacktrace'" is same as "dump-perl-stacktrace".

"hook-perl-require" is to insert hooks into the import facility and dump name of the file to be included. perl-requiretree output tree format from hook-perl-require dump file. "inspect-perl-proc --mode 'hook-require'" is same as "hook-perl-require".

OPTIONS

-m MODE, --mode MODE

Specify mode. MODE is "dump-inc" or or "dump-incpath" "dump-memusage" or "dump-env" or "dump-stacktrace" or "hook-perl-require".

-p PID, --pid PID

Specify PID which process you want to examine.

-d, --debug

increase debug level. -d -d more verbosely.

KNOWN ISSUE

Inspecting on CentOS 5.8's system perl(5.8.8) causes segmentation fault. (perlbrewed perl-5.8.8 on CentOS 5.8 is OK)

AUTHOR

HIROSE, Masaaki <hirose31 _at_ gmail.com>

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.