http://qs321.pair.com?node_id=735232


in reply to anyway to abbreviate use strict; use warnings;

You can create a module to do that with ToolSet. See ToolSet::SWC as an example.

Personally, I created a module I call "XDG" like this:

package XDG; our $VERSION = '0.05'; use base 'ToolSet'; ToolSet->use_pragma( 'strict' ); ToolSet->use_pragma( 'warnings' ); ToolSet->export( 'Carp' => 'carp croak confess', 'Data::Dump::Streamer' => 'Dump', 'File::Spec' => undef, 'Path::Class' => 'file dir', 'Scalar::Util' => 'refaddr reftype blessed', ); if ( $] >= 5.010 ) { ToolSet->use_pragma( 'feature', ':5.10' ); } else { ToolSet->export( 'Perl6::Say' => 'say' ); } 1; # true

That's handy for one-liners, too:

$ perl -MXDG -e ...

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.