Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How to manage the transfer of large Perl environments from one network to another

by swl (Parson)
on Mar 29, 2019 at 22:37 UTC ( [id://1231885]=note: print w/replies, xml ) Need Help??


in reply to How to manage the transfer of large Perl environments from one network to another

If you have the entire environment then you could try a reductionist approach.

Find every lib dir that contains a .pm file and add them to $ENV{PERL5LIB}. That will hopefully make everything available so the process runs to completion. Then add an END{} block to the master script to print or dump @INC (and maybe also %INC) to a file. That will give you the necessary dirs to use.

Some caveats:

If the process runs then you might not care that you have too many entries in @INC, and thus there is no need to reduce the set.

This does not account for the order of libs, so might load incorrect versions and lead to subtle bugs. A check for .pm file uniqueness would be of benefit here.

It doesn't fix the underlying problem of using so many dirs in PERL5LIB in the first place, but that sounds like a second job.

If the full run takes days then it might not be worth the wait...

The END block will not list all the used dirs if some scripts are called using system, backticks and so forth.

An alternative given the last caveat might be to instrument the lib package to record each addition to @INC in a log file somewhere. Others can hopefully advise as to whether this is a reasonable idea and how it could be done.

Replies are listed 'Best First'.
Re^2: How to manage the transfer of large Perl environments from one network to another
by swl (Parson) on Mar 29, 2019 at 22:46 UTC

    Another option is to use Module::ScanDeps::scandeps (see docs at https://metacpan.org/pod/Module::ScanDeps#scan_deps).

    If I remember correctly, this will handle use lib calls so if you pass it all the .pl files in your copy of the client's environment then it should find all the dependencies and their locations without needing to execute the code.

    You will need to parse the results, but that's perhaps a small price to pay.

    It also will not handle mylib or rlib calls if they are used.

Log In?
Username:
Password:

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

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

    No recent polls found