perl -we 'use new qw(My::Very::Long::Module x foo 42); print $x->get_foo;'
####
perl -we 'use My::Very::Long::Module; our $x = My::Very::Long::Module->new( foo => 42 ); print $x->get_foo;'
##
##
package new;
use strict;
use warnings;
=head1 NAME
new - shorted require Foo; Foo->new(...) to just one call
=head1 SYNOPSYS
use new qw(My::Very::Long::Module x foo 42);
is an exact equivalent of
our $x;
BEGIN {
require My::Very::Long::Module;
$x = My::Very::Long::Module->new( foo => 42 );
};
or a rough equivalent of
use My::Very::Long::Module;
our $x = My::Very::Long::Module->new( foo => 42 );
Not a big deal in a real program, but may save some typing in a
one-liner test script.
Works well under C