<span style="font-family:courier new,monospace"><br></span><div class="gmail_quote"><span style="font-family:courier new,monospace">On Fri, Oct 24, 2014 at 1:16 PM, John Macdonald <span dir="ltr"><<a href="mailto:john.malcolm.macdonald@gmail.com" target="_blank">john.malcolm.macdonald@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-family:courier new,monospace">How about:<br><br></span></div><span style="font-family:courier new,monospace"> perl -e "INIT { code }; do $filename"<br></span></div></blockquote><div><span style="font-family:courier new,monospace"><br>Close, but no cigar.<br>I forgot about 'do', but although your suggestion does indeed run the INIT,<br>it doesn't seem to be happening at the right time.<br><br>But I've figured out my own solution... below...<br><br>What I was really trying to do is get a list of all the modules, my various applications use.<br><br>Why?<br> Because I have a corporate 'scan of code looking for GPL and other license violations'<br> happening. And the stuff they're 'commercial tool' found was no where near the<br> list of dependencies I have.<br> So _I_ want to give them the real list. (Yes I realize I'm opening myself up<br> for a potentially bigger attack.)<br><br>Background:<br> In some of my other apps, I've already built in a 'dependant module list dumper'<br> option [so that for those sites that are isolated and can't have access to CPAN,<br> they can run my app with the option to get the list of the dependencies, and<br> resolve it 'the hard way... manually'.]<br><br></span><span style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> The routine I use (but needs to be run at the right time) is:<br><br> print join("\n", sort grep { /^[A-Z]/ } map { s|/|::|g; s|\.pm$||; $_ } keys %INC), "\n"; exit;<br><br><br></span>But I was looking for an EASY way to prepend that functionality to all my other apps,<br>without having to edit them all.<br><br>The solution I now have is to create a seperate package/module/file that contains:<br><br>package CCC;<br><br>INIT {<br> print join("\n", sort grep { /^[A-Z]/ } map { s|/|::|g; s|\.pm$||; $_ } keys %INC), "\n";<br> exit;<br>}<br><br>1;<br><br>and then invoke my apps with:<br> perl -I. -mCCC ./<a href="http://myapp.pl">myapp.pl</a><br><br>That now gives me my whole hierarchy of dependencies.<br><br>Fulko<br><br> <br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><span style="font-family:courier new,monospace"><br></span><div class="gmail_quote"><div><div class="h5"><span style="font-family:courier new,monospace">On 24 October 2014 13:07, Fulko Hew <span dir="ltr"><<a href="mailto:fulko.hew@gmail.com" target="_blank">fulko.hew@gmail.com</a>></span> wrote:<br></span></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><span style="font-family:courier new,monospace">A hopefully quick question...<br><br>I have a bunch of programs, and I'd like to do a test on where I execute each<br>program, but before it actually 'does stuff', but after its done all of its<br>'use' statements, it runs my 2 lines of code.<br><br>Sort of doing a:<br>perl -e INIT { code } filename<br><br>but a -e prevents the running of filename!<br><br>I want to do both.<br><br>Suggestions anyone ?<br><br><br><br></span>
</div></div><span style="font-family:courier new,monospace">______________________________</span><span style="font-family:courier new,monospace">_________________<br>
toronto-pm mailing list<br><a href="mailto:toronto-pm@pm.org" target="_blank">toronto-pm@pm.org</a></span>
<span style="font-family:courier new,monospace"><br><a href="http://mail.pm.org/mailman/listinfo/toronto-pm" target="_blank">http://mail.pm.org/mailman/listinfo/toronto-pm</a></span>
<span style="font-family:courier new,monospace"><br><br></span>
</blockquote></div><span style="font-family:courier new,monospace"><br></span></div>
</blockquote></div><span style="font-family:courier new,monospace"><br></span>