in reply to Re^4: Command line tool coding style?
in thread Command line tool coding style?
I'd suggest moving the "use Getopt::Long" to the top part, since that's where you actually use the module, and giving the lower section a real package name ("package MyTool" or something). Then instead of this:
you can have this: this:my $handler = can main "_$action";
Easier to follow, in my opinion.my $handler = MyTool->can("_$action");
Incidentally, a nice way to code tools like this is to make a separate module that implements all of the real logic, and then a CLI wrapper that just calls that module's methods. Then you can easilly add a GUI, call it from CGI, etc.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Command line tool coding style?
by Aristotle (Chancellor) on Jan 17, 2002 at 02:40 UTC |
In Section
Seekers of Perl Wisdom