Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w package ListDependencies; use strict; unshift @INC, sub { local $_ = $_[1]; return unless /[[:upper:]]/; s/\.pm$//i; s/[\/:]/::/g; print STDERR $_, $/; }; 1; __END__ =head1 NAME ListDependencies.pm - list any Perl code's module dependencies =head1 SYNOPSIS perl -c -MListDependencies scriptname perl -MListDependencies -MModule::Name -e1 perl -MListDependencies -e'use Module::Name' =head1 DESCRIPTION This module prints the names of any modules any piece of Perl code compiled after it tries to load to C<STDERR>, but ignores C<use pragma;> directives. You should load this module prior to all others. The C<-M> command line switch to C<perl> is a good place to do so. Note that it won't prevent execution of the code you're trying to examine. If all you want to do is list dependencies for a piece of standalone code, you may want to use the C<-c> command line switch to C<perl> to check compile time dependencies. Be aware that this will leave you blind to any attempts to load modules dynamically at runtime. =head1 CAVEATS If your own custom modules use all-lowercase names, this module won't list them. This is intentional: all-lowercase names are reserved for Perl pragmas. Note that not all pragmas are available everywhere, so they may constitute a depency as well. L<warnings> is an obvious example. =head1 BUGS There is no way to specify a different output file handle than C<STDERR>. A proper version should include an C<import()> routine to take care of this. =head1 RESTRICTIONS The module only honours Unix, DOSish and MacOS directory separators. A more portable solution would have to rely on L<File::Spec>, but unfortunately that would require this module to import modules itself. Heisenberg's Dispersion Relation applies. :-) =head1 AUTHOR Aristotle Pagaltzis <pagaltzis at gmx dot de> =head1 COPYRIGHT Copyright 2002. This may be modified and distributed on the same terms as Perl.

In reply to robustly list any Perl code's module dependencies by Aristotle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found