line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CLASS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
70945
|
use 5.004; |
|
1
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$VERSION = 'v1.1.8'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
|
|
|
|
|
|
# Faster than 'use constant'. Load time critical. |
9
|
|
|
|
|
|
|
# Must eval to make $] constant. |
10
|
1
|
|
|
1
|
|
89
|
*PERL_VERSION = eval qq{ sub () { $] } }; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import { |
14
|
3
|
|
|
3
|
|
402
|
my $caller = caller; |
15
|
3
|
|
|
|
|
6
|
*{$caller.'::CLASS'} = \$caller; |
|
3
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This logic is compiled out. |
18
|
3
|
|
|
|
|
5
|
if( PERL_VERSION >= 5.008 ) { |
19
|
|
|
|
|
|
|
# 5.8.x smart enough to make this a constant. |
20
|
3
|
|
|
9
|
|
10
|
*{$caller.'::CLASS'} = sub () { $caller }; |
|
3
|
|
|
|
|
1855
|
|
|
9
|
|
|
|
|
5294
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
|
|
|
|
|
|
# Make CLASS a constant. |
24
|
|
|
|
|
|
|
*{$caller.'::CLASS'} = eval qq{ sub () { q{$caller} } }; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
CLASS - Alias for __PACKAGE__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
package Foo; |
37
|
|
|
|
|
|
|
use CLASS; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
print CLASS; # Foo |
40
|
|
|
|
|
|
|
print "My class is $CLASS\n"; # My class is Foo |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub bar { 23 } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
print CLASS->bar; # 23 |
45
|
|
|
|
|
|
|
print $CLASS->bar; # 23 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
CLASS and $CLASS are both synonyms for __PACKAGE__. Easier to type. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$CLASS has the additional benefit of working in strings. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NOTES |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
CLASS is a constant, not a subroutine call. $CLASS is a plain |
57
|
|
|
|
|
|
|
variable, it is not tied. There is no performance loss for using |
58
|
|
|
|
|
|
|
CLASS over __PACKAGE__ except the loading of the module. (Thanks |
59
|
|
|
|
|
|
|
Juerd) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
From February 2022 onward: Jacques Deguest EFE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Michael G Schwern |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
70
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
See L |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE ALSO |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |