line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Constant::Generate::Dualvar::_Overloaded; |
2
|
|
|
|
|
|
|
use constant { |
3
|
6
|
|
|
|
|
856
|
FLD_INT => 0, |
4
|
|
|
|
|
|
|
FLD_STR => 1 |
5
|
6
|
|
|
6
|
|
37
|
}; |
|
6
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
#Stolen from: |
7
|
|
|
|
|
|
|
#http://perldoc.perl.org/overload.html |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
0
|
0
|
0
|
sub new { my $p = shift; bless [@_], $p } |
|
0
|
|
|
|
|
0
|
|
10
|
6
|
|
|
6
|
|
35
|
use overload '""' => \&str, '0+' => \&num, fallback => 1; |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
55
|
|
11
|
0
|
|
|
0
|
0
|
0
|
sub num {shift->[0]} |
12
|
0
|
|
|
0
|
0
|
0
|
sub str {shift->[1]} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
6
|
|
|
6
|
|
1627
|
$INC{'Constant/Generate/Dualvar/_Overloaded.pm'} = 1; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Constant::Generate::Dualvar; |
20
|
6
|
|
|
6
|
|
35
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
261
|
|
21
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
4168
|
|
22
|
6
|
|
|
6
|
|
37
|
use Scalar::Util; |
|
6
|
|
|
|
|
68
|
|
|
6
|
|
|
|
|
437
|
|
23
|
6
|
|
|
6
|
|
32
|
use base qw(Exporter); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
3172
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = qw(CG_dualvar); |
26
|
|
|
|
|
|
|
our $USE_SCALAR_UTIL; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub CG_dualvar($$); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
BEGIN { |
31
|
6
|
|
|
6
|
|
506
|
$USE_SCALAR_UTIL = eval 'use List::Util::XS 1.20; $List::Util::XS::VERSION;'; |
|
6
|
|
|
6
|
|
7889
|
|
|
6
|
|
|
|
|
1828
|
|
|
6
|
|
|
|
|
130
|
|
32
|
6
|
50
|
|
|
|
30
|
if($USE_SCALAR_UTIL) { |
33
|
6
|
|
|
|
|
778
|
*CG_dualvar = \&Scalar::Util::dualvar; |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
0
|
require Constant::Generate::Stringified::_Overloaded; |
36
|
0
|
|
|
|
|
0
|
warn "Scalar::Util::XS not available. Falling back to using overload"; |
37
|
|
|
|
|
|
|
*CG_dualvar = sub($$) { |
38
|
0
|
|
|
|
|
0
|
my ($num,$string) = @_; |
39
|
0
|
|
|
|
|
0
|
return Constant::Generate::Stringified::_Overloaded->new( |
40
|
|
|
|
|
|
|
$num,$string); |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
0
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub import { |
46
|
11
|
|
|
11
|
|
53
|
my ($cls,$symspec,%options) = @_; |
47
|
11
|
100
|
|
|
|
37
|
if($symspec) { |
48
|
|
|
|
|
|
|
#We're being imported as user.. |
49
|
5
|
|
|
|
|
24
|
require 'Constant/Generate.pm'; |
50
|
5
|
|
|
|
|
12
|
$options{dualvar} = 1; |
51
|
5
|
|
|
|
|
31
|
@_ = ('Constant::Generate', $symspec, %options); |
52
|
5
|
|
|
|
|
29
|
goto &Constant::Generate::import; |
53
|
|
|
|
|
|
|
} else { |
54
|
6
|
|
|
|
|
286
|
goto &Exporter::import; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |