| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## no critic: TestingAndDebugging::RequireUseStrict |
|
2
|
|
|
|
|
|
|
package alias::module; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
5
|
|
|
|
|
|
|
our $DATE = '2023-09-30'; # DATE |
|
6
|
|
|
|
|
|
|
our $DIST = 'alias-module'; # DIST |
|
7
|
|
|
|
|
|
|
our $VERSION = '0.003'; # VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
|
10
|
0
|
|
|
0
|
|
|
my $class = shift; |
|
11
|
0
|
0
|
|
|
|
|
my $noreq = $_[0] eq '-norequire' ? shift : 0; |
|
12
|
0
|
|
|
|
|
|
my $orig = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
defined $orig or die "Please specify package to alias from"; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $caller = caller(); |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if ($caller eq $orig) { |
|
19
|
0
|
|
|
|
|
|
warn "Aliasing from the same package '$caller', probably a typo?"; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
unless ($noreq) { |
|
23
|
0
|
|
|
|
|
|
(my $orig_pm = "$orig.pm") =~ s!::!/!g; |
|
24
|
0
|
|
|
|
|
|
require $orig_pm; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
0
|
|
|
|
|
|
*{$caller . "::"} = \*{$orig . "::"}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
# ABSTRACT: Alias one module as another |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |