| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PPI::XS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# See POD at end for documentation |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
104757
|
use 5.005; |
|
|
2
|
|
|
|
|
6
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
37
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use XSLoader; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
42
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# In the unlikely case they someone tries to manually load |
|
10
|
|
|
|
|
|
|
# PPI::XS without PPI itself loaded, they probably MEAN for us |
|
11
|
|
|
|
|
|
|
# to load in PPI as well. Pretty useless otherwise, because we |
|
12
|
|
|
|
|
|
|
# need to _overwrite_ the PPI methods, we can't have it loading |
|
13
|
|
|
|
|
|
|
# after we do. |
|
14
|
2
|
|
|
2
|
|
454
|
use PPI 1.000 (); |
|
|
2
|
|
|
|
|
86993
|
|
|
|
2
|
|
|
|
|
43
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Define compatibility information |
|
17
|
2
|
|
|
2
|
|
11
|
use vars qw{$VERSION $PM_COMPATIBLE %EXCLUDE}; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
107
|
|
|
18
|
|
|
|
|
|
|
BEGIN { |
|
19
|
2
|
|
|
2
|
|
3
|
$VERSION = '0.904'; |
|
20
|
2
|
|
|
|
|
3
|
$PM_COMPATIBLE = '0.844'; |
|
21
|
2
|
|
|
|
|
194
|
%EXCLUDE = (); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Does the main package define the minimum set of variables? |
|
25
|
|
|
|
|
|
|
return 1 unless defined $PPI::VERSION; |
|
26
|
|
|
|
|
|
|
return 1 unless defined $PPI::XS_COMPATIBLE; |
|
27
|
|
|
|
|
|
|
return 1 if $PPI::VERSION =~ /_/; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Are we compatible with the main package |
|
30
|
|
|
|
|
|
|
return 1 unless $VERSION > $PPI::XS_COMPATIBLE; |
|
31
|
|
|
|
|
|
|
return 1 unless $PPI::VERSION > $PM_COMPATIBLE; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Provide an option to manually disable this package |
|
34
|
|
|
|
|
|
|
return 1 if $PPI::XS_DISABLE; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# If we aren't EXACTLY the same version, determine |
|
37
|
|
|
|
|
|
|
# which functions we might need to exclude. |
|
38
|
|
|
|
|
|
|
if ( $VERSION > $PPI::VERSION ) { |
|
39
|
|
|
|
|
|
|
# We are newer, we have the option of excluding functions |
|
40
|
|
|
|
|
|
|
### NOTE: Nothing to exclude in this version |
|
41
|
|
|
|
|
|
|
# %EXCLUDE = map { $_ => 1 } qw{}; |
|
42
|
|
|
|
|
|
|
# (example) PPI::Element::exclude_this |
|
43
|
|
|
|
|
|
|
} elsif ( $VERSION < $PPI::VERSION ) { |
|
44
|
|
|
|
|
|
|
# It is newer, it has the option of excluding functions |
|
45
|
|
|
|
|
|
|
if ( @PPI::XS_EXCLUDE ) { |
|
46
|
|
|
|
|
|
|
# It as defined things for us to exclude |
|
47
|
|
|
|
|
|
|
%EXCLUDE = map { $_ => 1 } @PPI::XS_EXCLUDE; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Load the XS functions |
|
52
|
|
|
|
|
|
|
XSLoader::load( 'PPI::XS' => $VERSION ); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Find all the functions in PPI::XS |
|
55
|
2
|
|
|
2
|
|
10
|
no strict 'refs'; |
|
|
2
|
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
336
|
|
|
56
|
|
|
|
|
|
|
foreach ( sort grep { /^_PPI_/ and defined &{"PPI::XS::$_"} } keys %{"PPI::XS::"} ) { |
|
57
|
|
|
|
|
|
|
# Prepare |
|
58
|
|
|
|
|
|
|
/^_(\w+?)__(\w+)$/ or next; |
|
59
|
|
|
|
|
|
|
my ($class, $function) = ($1, $2); |
|
60
|
|
|
|
|
|
|
$class =~ s/_/::/g; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if ( $EXCLUDE{$_} ) { |
|
63
|
|
|
|
|
|
|
# Remove the un-needed function. |
|
64
|
|
|
|
|
|
|
# The primary purpose of this is to recover the memory |
|
65
|
|
|
|
|
|
|
# occupied by the useless functions, but has the |
|
66
|
|
|
|
|
|
|
# additional benefit of allowing us to detect which |
|
67
|
|
|
|
|
|
|
# functions were actually mapped in by examining the |
|
68
|
|
|
|
|
|
|
# names of the functions remaining in the PPI::XS symbol |
|
69
|
|
|
|
|
|
|
# table. |
|
70
|
|
|
|
|
|
|
delete ${"PPI::XS::"}{$_}; |
|
71
|
|
|
|
|
|
|
} else { |
|
72
|
|
|
|
|
|
|
# Map in the function |
|
73
|
|
|
|
|
|
|
*{"${class}::${function}"} = *{"PPI::XS::$_"}; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |