$ alias perle
alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -E'
$ perl -v | head -2 | tail -1
This is perl 5, version 24, subversion 0 (v5.24.0) built for darwin-thread-multi-2level
####
package xyz;
our $VERSION = '1.0';
sub import {
print "import called with args: @_\n";
}
1;
####
$ perle 'BEGIN { @INC = qw{old new .} } use xyz 1.0; say $xyz::VERSION'
import called with args: xyz
1.0
$ perle 'BEGIN { @INC = qw{old new .} } use xyz 1.0 (); say $xyz::VERSION'
1.0
$ perle 'BEGIN { @INC = qw{old new .} } use xyz 1.0 qw{a b c}; say $xyz::VERSION'
import called with args: xyz a b c
1.0
$ perle 'BEGIN { @INC = qw{old new .} } use xyz; say $xyz::VERSION'
import called with args: xyz
1.0
$ perle 'BEGIN { @INC = qw{old new .} } use xyz (); say $xyz::VERSION'
1.0
$ perle 'BEGIN { @INC = qw{old new .} } use xyz qw{a b c}; say $xyz::VERSION'
import called with args: xyz a b c
1.0
####
package xyz;
our $VERSION = '2.0';
sub import {
print "import called with args: @_\n";
}
1;
####
$ perle 'BEGIN { @INC = qw{old new .} } use xyz 2.0; say $xyz::VERSION'
xyz version 2 required--this is only version 1.0 at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
####
package Bleed::xyz;
our $VERSION = '2.0';
BEGIN {
require 'new/xyz.pm';
}
sub import {
shift;
xyz->import(@_);
}
1;
####
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz 2.0; say $xyz::VERSION'
import called with args: xyz
2.0
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz 2.0 (); say $xyz::VERSION'
2.0
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz 2.0 qw{a b c}; say $xyz::VERSION'
import called with args: xyz a b c
2.0
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz; say $xyz::VERSION'
import called with args: xyz
2.0
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz (); say $xyz::VERSION'
2.0
$ perle 'BEGIN { @INC = qw{old new .} } use Bleed::xyz qw{a b c}; say $xyz::VERSION'
import called with args: xyz a b c
2.0