Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Check a script's module dependencies

by hans_moleman (Beadle)
on Oct 06, 2002 at 12:19 UTC ( [id://203151]=note: print w/replies, xml ) Need Help??


in reply to Re: Check a script's module dependencies
in thread Check a script's module dependencies

Nicely done!

Yes, using internal Perl tools seems like a more robust approach than parsing source code. Frankly, I've got some reading to do to understand how your code does what it does...

  • Comment on Re: Re: Check a script's module dependencies

Replies are listed 'Best First'.
Re^3: Check a script's module dependencies
by Aristotle (Chancellor) on Oct 06, 2002 at 12:45 UTC

    It's not very complicated once you know how loading modules works: basically, the @INC array contains all the paths to any directories where perl should look for modules.

    Usually, these are only strings, but you can also put a reference to a subroutine in there; when perl is searching for modules, it will call that routine if it hasn't found the module by one of the paths that appear before it in the array. Along with various parameters passed to such a routine is the module's path in the second parameter which is in this case copied to $_ in order to massage it to my liking.

    Because this is a module, the code in its main body gets executed as soon as the module is loaded, at compile time, and therefor gets to modify the @INC array before anything else has happened.

    Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://203151]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found