First, you don't need sub there. Second, you don't need die or exit. Third, you want to run it with -c on the command line.
I think. I didn't actually test any of that... :-)
Update: Ok, I've tested it now. The code:
And a test run (on a test script that consisted of a single line, "use CGI;"):package Dependencies; CHECK { print $_, $/ for values %INC; } 1;
$ perl -MDependencies -c ./test.pl /usr/lib/perl5/5.8.0/warnings/register.pm /usr/lib/perl5/5.8.0/Carp.pm Dependencies.pm /usr/lib/perl5/5.8.0/vars.pm /usr/lib/perl5/5.8.0/strict.pm /usr/lib/perl5/5.8.0/Exporter.pm /usr/lib/perl5/5.8.0/constant.pm /usr/lib/perl5/5.8.0/warnings.pm /usr/lib/perl5/5.8.0/CGI/Util.pm /usr/lib/perl5/5.8.0/overload.pm /usr/lib/perl5/5.8.0/CGI.pm ./test.pl syntax OK
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Finding dependancies of a script
by sauoq
in thread Finding dependancies of a script
by fletcher_the_dog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |