Re: Print out modules used during runtime?



Omar Zakaria wrote:
Hello, all. I was wondering if there's a way, without downloading any
special modules, or packages, to have a perl script print out the list
of packages or modules it imported (i.e. anything I "use"'d or
"require"'d).

%INC is probably what you're looking for. It keeps a list of all
modules used/required as keys, with the values being the paths to
those modules. Note, however, that %INC will have not only the modules
your script specifically used, but also those modules used by a module
your script used:

$ perl -e' use CGI; print "$_ => $INC{$_}\n" for keys %INC;'
warnings/register.pm =>
/opt2/Perl5_8_4/lib/perl5/5.8.4/warnings/register.pm
Carp.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/Carp.pm
vars.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/vars.pm
strict.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/strict.pm
Exporter.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/Exporter.pm
constant.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/constant.pm
warnings.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/warnings.pm
CGI/Util.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/CGI/Util.pm
overload.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/overload.pm
CGI.pm => /opt2/Perl5_8_4/lib/perl5/5.8.4/CGI.pm

See perldoc perlvar for more information about %INC.

Paul Lalli

.



Relevant Pages

  • Print out modules used during runtime?
    ... special modules, or packages, to have a perl script print out the list ... The script is actually compiled to an .exe, ...
    (comp.lang.perl.misc)
  • Re: libicui18n.so.36 not found, required by "evolution"
    ... It will only fetch programs that need updating, ... Later this day I will add some debugging functionality to the script and send that version to you, if you are willing to spend your time helping me finding this problem. ... And indeed pkg_libchk is by far the best solution, if I was to update every package that depended on icu I would have to update 239 packages which discouraged me right away, by running pkg_libchk the amount of packages to be updated was reduced to 71, wrote a quick script and left it running overnight and those packages got updated and by god I don't have any more problems with libicui18n.so.38. ... And until then you already have a description for all new commands. ...
    (freebsd-questions)
  • Re: SMS upgrade Side-By-Side 2.0 to 2003
    ... Being able to migrate queries and packages can prove to be valuable though. ... I still don't have a package import script because most of the time you ... MVP Windows Server System - SMS ...
    (microsoft.public.sms.setup)
  • Re: [opensuse] Local cache of updates, installed programs in openSUSE
    ... don't have the same package config, I created a "Generic" openSuSE repository ... script to separate all the files by architecture and then upload to the server ... server instead of from the internet. ... and that holds updated packages for rpms of all architectures. ...
    (SuSE)
  • Re: Using a package like PyInstaller
    ... create exe files that basically have your py script and a small py ... installed on a system to execute a py script. ... I am being advised that python ... and these types of packages and am not too sure how dumb a question this ...
    (comp.lang.python)