At a previous workplace, I created a standard python runtime (BootingPython) and now I want to do the same thing for perl, so that any script written conforms to a base level of sanity (pragmas, libraries, available objects). Using Chromatic's Modern::Perl as a guide, I came up with the following boilerplate that gives you the basic idea, allowing you to drop in whatever modules you deem required.
#!/usr/bin/env perl =head1 Standardized Perl Runtime We import the following pragmas and modules into every program to create a standardized runtime. Invoke as the first lines in your program as use File::Basename; use lib dirname($0) . '/../../lib'; use Boot; The "use lib" adds the local source code repository which the "use Boot" then accesses. Thanks to Chromatic for Modern::Perl and Damian Conway for Toolkit which provided the background for this module. =cut package Boot; use warnings; use strict; use English; use Carp qw(carp cluck croak confess); use Fatal qw(:void open close unlink rename); sub import { warnings->import(); strict->import(); English->import(); Carp->import( qw(carp cluck croak confess) ); Fatal->import( qw(:void open close unlink rename) ); } ##### # all required perl must end on a positive note # return 1;
What modules would you load?