Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I was looking to write a script that required quite a bit of modularity and separation of generic concerns from the scripts concerns. I have found 3 such frameworks (briefly discussed below) but would be glad to hear of others

CLI::Framework

CLI::Framework seems to be the most useable of the 3. It has good docs. It comes with two working samples, one simple example and one much more complicated. The complicated example shows how to maintain state in an application and share that state between commands. One issue is that the object-oriented access to that state in the command is via $self->$slot not $self->app->$slot thus potentially creating conflicts between application slots and command slots.

App::Cmd

App::Cmd is by the prolific and well known Ricardo Signes. Like CLI::Framework, it support subcommands. It does not come with complete samples. But the nice thing is you can find Ricardo on irc.perl.org almost anytime of the day or night. Both App::Cmd and CLI::Framework delegate option processing to Getopt::Long::Descriptive.

One key difference between the two is that you manually map application command names to modules in CLI::Framework. App::Cmd automatically loads all modules under the namespace of your application module.

Why is App::Cmd not quite as good as CLI::Framework

It's scary to pick someone over Ricardo, but the lack of working examples, along with the lack of pre-packaged common commands make CLI::Framework a bit more attractive.

On the other hand, if you have a lot of commands to write and dont like updating a central dispatch table, then the decentralized control and coordination of App::Cmd might be just the ticket for you.

App::Framework

App::Framework is interesting. The one thing it seems to lack is any mechanism for commands. In other words, it aimed to make applications more scaleable, but it has no support for application command (and subcommand) dispatch. Both of the other frameworks have support for subcommands, allowing for options to be specified both for the application as well as the (sub)commands.

But only CLI::Framework provides fully working examples of it.


In reply to scripting frameworks - a cursory glance by metaperl

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 drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2014-04-18 07:01 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (462 votes), past polls