[sf-perl] boiler-plate

Joe Brenner doom at kzsu.stanford.edu
Mon Apr 5 16:50:25 PDT 2010

Dana Diederich <diederich at gmail.com> wrote:

> That leads to another interesting line; what kind of 'boiler-plate'
> use statements do y'all use in most of your programs?  This is what I
> always use:
> use common::sense;
> use Moose::Autobox;

Nothing particularly fancy, in my case.  The templates I've been using
are up here:


Scripts look something like this:

  use warnings;
  use strict;
  use Data::Dumper;
  use File::Path     qw( mkpath );
  use File::Basename qw( fileparse basename dirname );
  use File::Copy     qw( copy move );
  use Fatal          qw( open close mkpath copy move );
  use Cwd            qw( cwd abs_path );
  use Env qw(HOME);
  use Getopt::Long qw(:config no_ignore_case bundling);

Objected-oriented modules look something like this:

  use base qw( Class::Base );
  use 5.006;
  use strict;
  use warnings;
  use Carp;
  use Data::Dumper;
  use Hash::Util qw( lock_keys unlock_keys );

I have to say, I can feel the pressure on me to become a Moose-head,
much as I like simple, old-fashioned solutions like Class::Base (plus
a custom AUTOLOAD).

And it might be time to bump-up my minimum perl version a little
higher than 5.6.

But then, I've only recently come around to using Getopt::Long...
It's an okay module, it's just that the defaults are wrong.

More information about the SanFrancisco-pm mailing list