Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

rjbs
  (email not shown publicly)
http://rjbs.manxome.org/
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Monday September 15, 2008
07:30 AM

new app cmd interface finally released

[ #37450 ]

One of the earliest libraries I wrote for Pobox is ICG::CLI. It makes it easy to write CLI programs by tying together Getopt::Long::Descriptive with some common options (like help and verbose) and a few bits of code to make them work. So, you got three routines, whisper, say, and yell, which were like printf, but respected the verbose and quiet flags. (This got refactored into Log::Speak, which I don't think was ever released. Oh well.)

Later, I pulled out Rubric's subcommand dispatch code out into App::Cmd, and that was a big success, and used GLD, but didn't get you the printing builtins for verbose operation. Also, building them in wasn't going to be easy, because App::Cmd was OO instead of just a few imported routines. I finally decided on a way to make it happen, about six months ago, and it was a lot of fun to implement. It makes writing App::Cmd programs even easier, introduces fun uses for Sub::Exporter and lets you write plugins that provide exported functions into all your commands magically. That means that this is now possible:

package MyApp::Command::purge;   use MyApp -command;

sub run {     my ($self, $opt, $args) = @_;

  debug for $args->flatten;   }

1;

...because you can have (for example) a debug routine and autobox imported into every command automatically. I have a number of plugins to write to make this possible, and I've basically been putting off the release for months, waiting to get them written, but I had enough people saying, "Seriously, can you release what's in your git repo?" that I finally broke down and did it.

Hopefully I'll get some cool plugins written, real soon now.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.