Re: How to suss out module dependencies...
One difference with what I did is that mine determines if the mod is a core mod and does not list it, if so. I was trying to parse through all of our homegrown packages and see what non-core mods (and versions) they depended on. didn't spend a lot of time making it prettier, so some calls were system calls to start perl within perl (seems yucky) and parsing STDOUT response, but it seemed to do the job, so it remained ugly... I agree with Dave about the fact that your setup should not need to be CPAN compliant in order for you to still get the dependeny list you want if you use CPAN::FindDependencies. bruce David McMath wrote: We dealt with a similar problem, moving from comfortable old server to a shiny new one. Perlmonks had some interesting advice: http://perlmonks.org/?node_id=203148 which I think is pretty cool (even though I only barely understand what it's going). One of our folks ended up, though, using the CPAN::FindDependencies module and writing some stuff that walks up through our use statements until it finds something that's not ours, then asks CPAN. You mention you're not using the normal CPAN model, but FindDependencies acutally goes back to a cpan site to get its answers, so maybe that's OK. Maybe this is helpful, dave William Bulley wrote: I have a question for which I have not been able to find a good answer. I have a Perl application that uses many Perl modules. Most come from CPAN, some I have written, others come with Perl distributions (core?). I am faced with the need to transport this collection of Perl code from operating system A to operating system B, both of which are perfectly well supported by Perl. Over several months I have added to system A lots of modules that need other modules. Unfortunately, system B is rather devoid of most of the modules that I need for this application. I dread having to make an inclusive list of all the modules and all the modules that those modules need, and so on, and so on. This is something that CPAN does when I install a new module that has dependencies on other modules. BUT in my case I am NOT using the blib, lib, t, MANIFEST, etc., etc., distribution model of CPAN, so I cannot use those tools - including several others on CPAN that compliment or implement this functionality. So my question is: is there a way to ask the Perl compiler/interpreter to spit out all the modules (and the other dependent modules) in my application in some format (a structured tree, a linear text file, etc.)? Failing that, are there some external tools that can accomplish this given my main module as a starting point? Thank you in advance. Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
At 2:53 PM on 27 May 2010, William Bulley wrote: I have a Perl application that uses many Perl modules. Most come from CPAN, some I have written, others come with Perl distributions (core?). I am faced with the need to transport this collection of Perl code from operating system A to operating system B, both of which are perfectly well supported by Perl. Over several months I have added to system A lots of modules that need other modules. Unfortunately, system B is rather devoid of most of the modules that I need for this application. I dread having to make an inclusive list of all the modules and all the modules that those modules need, and so on, and so on. The autobundle command of CPAN would give you a bundle file that lists of all the modules you've installed on system A. Then you can take that bundle file over to system B and install it using CPAN. Your bundle may end up with a lot of extra modules that your program doesn't need, but you can edit the bundle file and remove them. Or maybe you could see if you can get a profiler (like Devel::NYTProf) to tell you which modules are loaded when you load and run your module. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature
Re: How to suss out module dependencies...
A crude solution would be to print the contents of %INC somewhere in your application: perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);' Am Do, 27.05.2010, 22:41, schrieb C. Chad Wallace: At 2:53 PM on 27 May 2010, William Bulley wrote: I have a Perl application that uses many Perl modules. Most come from CPAN, some I have written, others come with Perl distributions (core?). I am faced with the need to transport this collection of Perl code from operating system A to operating system B, both of which are perfectly well supported by Perl. Over several months I have added to system A lots of modules that need other modules. Unfortunately, system B is rather devoid of most of the modules that I need for this application. I dread having to make an inclusive list of all the modules and all the modules that those modules need, and so on, and so on. The autobundle command of CPAN would give you a bundle file that lists of all the modules you've installed on system A. Then you can take that bundle file over to system B and install it using CPAN. Your bundle may end up with a lot of extra modules that your program doesn't need, but you can edit the bundle file and remove them. Or maybe you could see if you can get a profiler (like Devel::NYTProf) to tell you which modules are loaded when you load and run your module. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0
Re: How to suss out module dependencies...
According to Hendrik Schumacher h...@activeframe.de on Thu, 05/27/10 at 17:05: A crude solution would be to print the contents of %INC somewhere in your application: perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);' Good suggestion, but won't that list a whole bunch of other stuff that is not being used, but that exists in the INC tree somewhere? Maybe that's what you meant by crude. :-) Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
According to C. Chad Wallace cwall...@lodgingcompany.com on Thu, 05/27/10 at 16:41: The autobundle command of CPAN would give you a bundle file that lists of all the modules you've installed on system A. Then you can take that bundle file over to system B and install it using CPAN. Your bundle may end up with a lot of extra modules that your program doesn't need, but you can edit the bundle file and remove them. Or maybe you could see if you can get a profiler (like Devel::NYTProf) to tell you which modules are loaded when you load and run your module. Sounds like an early 20th century internal combustion vehicle... :-) I never heard of the autobundle command until now, but it does not sound like it would address all those other modules such as those I contributed and those that come with Perl installed on system A. Nor have I heard of Devel::NYTProf (or any other Perl profilers) but when I skimmed through the Devel::NYTProf POD on CPAN just now, it looks like Devel::NYTProf is more interested in performance and the time it takes for statements and/or subroutines to execute. This is not quite what I was looking for. Thanks for the great suggestions. Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
We dealt with a similar problem, moving from comfortable old server to a shiny new one. Perlmonks had some interesting advice: http://perlmonks.org/?node_id=203148 which I think is pretty cool (even though I only barely understand what it's going). One of our folks ended up, though, using the CPAN::FindDependencies module and writing some stuff that walks up through our use statements until it finds something that's not ours, then asks CPAN. You mention you're not using the normal CPAN model, but FindDependencies acutally goes back to a cpan site to get its answers, so maybe that's OK. Maybe this is helpful, dave William Bulley wrote: I have a question for which I have not been able to find a good answer. I have a Perl application that uses many Perl modules. Most come from CPAN, some I have written, others come with Perl distributions (core?). I am faced with the need to transport this collection of Perl code from operating system A to operating system B, both of which are perfectly well supported by Perl. Over several months I have added to system A lots of modules that need other modules. Unfortunately, system B is rather devoid of most of the modules that I need for this application. I dread having to make an inclusive list of all the modules and all the modules that those modules need, and so on, and so on. This is something that CPAN does when I install a new module that has dependencies on other modules. BUT in my case I am NOT using the blib, lib, t, MANIFEST, etc., etc., distribution model of CPAN, so I cannot use those tools - including several others on CPAN that compliment or implement this functionality. So my question is: is there a way to ask the Perl compiler/interpreter to spit out all the modules (and the other dependent modules) in my application in some format (a structured tree, a linear text file, etc.)? Failing that, are there some external tools that can accomplish this given my main module as a starting point? Thank you in advance. Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
At 6:09 PM on 27 May 2010, William Bulley wrote: According to Hendrik Schumacher h...@activeframe.de on Thu, 05/27/10 at 17:05: A crude solution would be to print the contents of %INC somewhere in your application: perl -e 'use DBI; use Time::Local; print join (\n, keys %INC);' Good suggestion, but won't that list a whole bunch of other stuff that is not being used, but that exists in the INC tree somewhere? Actually, no. %INC only lists modules that have been loaded into the current instance, via the 'do', 'require', or 'use' operators.[1] The only extraneous stuff it includes is the pragmas (strict, features, warnings, etc.) but those are easily excluded because of their all-lowercase names. Now that Hendrik mentioned it, it seems to me that %INC is probably your best bet. But what you would have to be sure of, in the script that loads your module to dump %INC, is that you also run your module through its paces to be sure that all dependencies are loaded--even if some are required instead of used--before you dump %INC. [1] see the %INC entry in perlvar. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature
Re: How to suss out module dependencies...
According to David McMath mcd...@stanford.edu on Thu, 05/27/10 at 18:27: We dealt with a similar problem, moving from comfortable old server to a shiny new one. Perlmonks had some interesting advice: http://perlmonks.org/?node_id=203148 which I think is pretty cool (even though I only barely understand what it's going). I like what I see there, and like you, it will take some meditation to find out the inner truth normally revealed to true believers... ;-) This might actually work! Thanks. One of our folks ended up, though, using the CPAN::FindDependencies module and writing some stuff that walks up through our use statements until it finds something that's not ours, then asks CPAN. You mention you're not using the normal CPAN model, but FindDependencies acutally goes back to a cpan site to get its answers, so maybe that's OK. According to the POD for CPAN::FindDependencies there is this: Any modules listed as dependencies but which are in the perl core distribution for the version of perl you specified are suppressed. So this would disincline me from trying to use CPAN::FindDependencies. But this gave me an idea! I looked for dependencies on CPAN and found this: http://search.cpan.org/~jlleroy/Devel-Dependencies-1.00/lib/Devel/Dependencies.pm This looks promising at first blush... Maybe this is helpful, Thanks again. Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
According to Bruce Sears bse...@epgy.stanford.edu on Thu, 05/27/10 at 18:41: One difference with what I did is that mine determines if the mod is a core mod and does not list it, if so. I was trying to parse through all of our homegrown packages and see what non-core mods (and versions) they depended on. didn't spend a lot of time making it prettier, so some calls were system calls to start perl within perl (seems yucky) and parsing STDOUT response, but it seemed to do the job, so it remained ugly... I agree with Dave about the fact that your setup should not need to be CPAN compliant in order for you to still get the dependeny list you want if you use CPAN::FindDependencies. Pardon me for being dense, but when you say what I did and mine what are you referring to. That is, which solution or which trick should I go back and re-consider? I have seen so many suggestions in the past half-hour that my head is spinning! :-) Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|
Re: How to suss out module dependencies...
According to C. Chad Wallace cwall...@lodgingcompany.com on Thu, 05/27/10 at 18:41: Actually, no. %INC only lists modules that have been loaded into the current instance, via the 'do', 'require', or 'use' operators.[1] Okay, my ignorance of %INC is showing. Thanks. The only extraneous stuff it includes is the pragmas (strict, features, warnings, etc.) but those are easily excluded because of their all-lowercase names. I agree - not a problem., Now that Hendrik mentioned it, it seems to me that %INC is probably your best bet. But what you would have to be sure of, in the script that loads your module to dump %INC, is that you also run your module through its paces to be sure that all dependencies are loaded--even if some are required instead of used--before you dump %INC. [1] see the %INC entry in perlvar. I have had to go back to the docs time and again to get the two straight in my head (USE and REQUIRE) since they evolved over time and I never did much module or package coding until recently. What I think you are saying is that once all/most of my code paths are traversed, then all/most of the associated modules will be part of %INC for me to try Hendrick's suggestion. I'd liken it to blowing up a kid's balloon just to see what is written on the surface of the rubber which is hard to read with the balloon is deflated. Of course, unlike here, one has to be careful not to inflate the balloon too much or bad things happen... ;-) I have several great suggestions now to try. Thanks! Regards, web... -- William Bulley Email: w...@umich.edu 72 characters width template -|