----- Original Message ----

> From: Jonathan Rockway <j...@jrock.us>

> Why use a script at all?  They are clearly difficult to test, and code
> that is difficult to test is where the bugs always hide.

Because there's a lot of legacy code out there and much of it is in the form of 
scripts.  The best way to write a script is something similar to this (or a 
procedural variant):

  #!/usr/bin/env perl
  use strict;

  use warnings;
  use My::App;
  my $app = My::App->new;
  $app->run(@ARGV);

If you have an older script, you can gradually approach this via refactoring.  
That, of course, should not be done without tests and that brings us back to 
the original issue :)

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6


Reply via email to