So, yay, that I'm getting results, but I don't quite understand the line of code I'm using to get them. Can you "talk through" what happens on this line, in particular, how the %s's get populated?
scandeps.pl -R *.pl | perl -ne 'printf qq{requires "%s", "%s";\n}, eva +l'

Sure:

  1. The output of scandeps.pl looks something like:
    'Module::Name' => 'version', 'Module::Other' => 'version', ...
  2. The output of scandeps.pl is fed into perl, which due to the -n switch reads its input line-by-line, setting $_ to each line.
  3. eval evaluates $_ when given no arguments, so it'll evaluate each line, a string such as "'Module::Name' => 'version'", as Perl code.
  4. The =>, aka the "fat comma", is just a Comma Operator in disguise, so each line of input evaluates to a list of two values, the module name and its version.
  5. Assuming no syntax errors, eval returns these two values, and they are used as the two arguments to the printf.
It seems to me that it invites disaster to compose a cpanfile by hand, never mind the tedium.

Personally, I don't think so - note that the output of scandeps.pl can sometimes be a lot more verbose than it needs to be. I think it's better to get an understanding of what the module dependency tree looks like instead of blindly relying on the tool - I usually try to keep track of which CPAN dependencies I add to my scripts, and I only use scandeps.pl to get hints whether I may have missed something. Note that in the output you showed, all the the ExtUtils::MM_* modules can probably be omitted, and also ExtUtils::MakeMaker and File::Temp are core modules, meaning that unless your script requires a certain new version of them, they usually don't need to be listed.


In reply to Re^4: Using Cartons to automate module installs by haukex
in thread Using Cartons to automate module installs by Aldebaran

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.