line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Filter::Template::UseBytes; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Filter::Template::UseBytes::VERSION = '1.043'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
8
|
use Filter::Template; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Make the "use_bytes" template evaluate to C |
8
|
|
|
|
|
|
|
# after 5.005_55. Systems before then don't have the option, so the |
9
|
|
|
|
|
|
|
# template evaluates to emptiness. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Template definitions can't be indented, so this looks ugly. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# The "# include" modifier causes the conditional to be evaluated at |
14
|
|
|
|
|
|
|
# compile time. This turns regular if/else logic into the moral |
15
|
|
|
|
|
|
|
# equivalent of the C preprocessor's #if/#else. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Because the conditionals are evaluated at compile time, it's |
18
|
|
|
|
|
|
|
# imperative that the things they test be defined. The BEGIN block |
19
|
|
|
|
|
|
|
# makes sure HAS_BYTES is defined before the tests are executed. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
BEGIN { |
22
|
1
|
|
|
1
|
|
62
|
eval "use bytes; sub HAS_BYTES () { 1 }"; |
|
1
|
|
|
1
|
|
1112
|
|
|
1
|
|
|
|
|
40
|
|
|
1
|
|
|
|
|
5
|
|
23
|
1
|
50
|
|
|
|
41
|
eval "sub HAS_BYTES () { 0 }" if $@; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
2
|
if (HAS_BYTES) { # include |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
template use_bytes { |
28
|
|
|
|
|
|
|
use bytes; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} else { # include |
31
|
|
|
|
|
|
|
template use_bytes { |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} # include |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |