Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

The canonical answer to this is: A minimal perl is the full core perl!

But since you explicitly ask for a stripped down perl, I suggest you run Module::ScanDeps (or rather scandeps.pl which comes with the module) on the script you posted.

Make sure to include runtime scanning, so you include the modules suggested by another poster. (Printing %INC entries)

Additionally, you would want to have a look at which shared object files are required by those modules. scandeps.pl can somewhat help with that, too.

Please note that M::ScanDeps deliberately makes the choice of rather including too much than too little because it's the scanning backend for PAR. That is because many PAR users expect a simple-minded "pp -o my.exe my.pl" to produce a working stand-alone application.

That being said, you can try out whether the script would be runnable with those modules using PAR. This should do the trick:

pp -o test.exe -d test.pl -M Some::Module ....

Make sure to put the perl lib into the same directory as the produced binary for testing. Also, the binary might include PAR and its dependencies which wouldn't be required for your script.

Last but not least, I would suggest you don't trust either the %INC dump nor the results of a scandeps.pl run because modules like File::Copy, etc. might use various other modules conditionally or, worse yet, magically. Now, the following lines of code use (at least) two modules that weren't included in the %INC dump seen in this discussion:

my $scalar = ''; open FOO, '>', \$scalar; print FOO "Hi there\n"; close FOO;

Looks innocent enough? Sure does. But it magically uses PerlIO(.pm) and PerlIO::scalar. If perl can't find PerlIO.pm, it throws a warning. If it can't find PerlIO/scalar.pm, it silently opens a file called SCALAR(XXXXXXXXX) instead of the $scalar where XXXXXXXXX is the internal address of the scalar (see "print \$scalar"). Okay, I admit, the latter is a bug in perl which was fixed in the development version.

Perhaps this explains why people claim that the minimal runnable perl is the whole core perl. Working from that to strip the package from not-so-integral packages might work in some cases, though.

Hope this helps!
Steffen

Update: Spelling error.


In reply to Re: Minimal Perl by tsee
in thread Minimal Perl by carcassonne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (12)
    As of 2014-07-30 11:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (230 votes), past polls