line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Java::Constants; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Template::Plugin::Java::Constants - Constants for the Java Template plugin |
6
|
|
|
|
|
|
|
modules. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Template::Plugin::Java::Constants qw/:regex/; |
11
|
|
|
|
|
|
|
use Template::Plugin::Java::Constants qw/:boolean/; |
12
|
|
|
|
|
|
|
use Template::Plugin::Java::Constants qw/:all/; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=over 8 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=item B |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The "regex" tag exports qr// compiled regular expressions SCALAR, PRIMITIVE, |
21
|
|
|
|
|
|
|
STRING and ARRAY, these are for matching Java types. All of these match a whole |
22
|
|
|
|
|
|
|
line, with no extra whitespace, and return the matched java type as $1. They |
23
|
|
|
|
|
|
|
may be used as: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$string =~ /@{[SCALAR]}/; # Ugly but effective and relatively fast. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=over 8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item B |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Any primitive or encapsulated primitive: int, or Integer, or String, etc. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item B |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Only primitive types like int, float, double, byte, etc. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item B |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
An incarnation of java.lang.String. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item B |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
A java.util.Vector. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item B |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
The boolean tag just exports the constants TRUE as 1 and FALSE as 0. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item B |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Exports all of the proceeding. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=back |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
require Exporter; |
60
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
63
|
1
|
|
|
1
|
|
5
|
use vars qw(@EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
|
5
|
use constant INSTALL_PREFIX => '@@INSTALL_PREFIX@@'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my @boolean = qw(TRUE FALSE); |
68
|
1
|
|
|
1
|
|
5
|
use constant TRUE => 1; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
69
|
1
|
|
|
1
|
|
4
|
use constant FALSE => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
138
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my @regex = qw(SCALAR STRING ARRAY); |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
77
|
use constant SCALAR => qr{^( |
74
|
|
|
|
|
|
|
(?:java\.lang\.)? |
75
|
|
|
|
|
|
|
(?:[Bb]yte|[Cc]har|[Ss]hort|Integer|int|[Ll]ong|[Ff]loat|[Dd]ouble|String) |
76
|
1
|
|
|
1
|
|
5
|
)$}x; |
|
1
|
|
|
|
|
2
|
|
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
1
|
|
5
|
use constant STRING => qr{^((?:java\.lang\.)?String)$}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
|
5
|
use constant ARRAY => qr{^((?:java\.util\.)?Vector)$}; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
95
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
@EXPORT_OK = (@boolean, @regex, 'INSTALL_PREFIX'); |
83
|
|
|
|
|
|
|
%EXPORT_TAGS = ( |
84
|
|
|
|
|
|
|
'all' => [ @EXPORT_OK ], |
85
|
|
|
|
|
|
|
'boolean'=>[ @boolean ], |
86
|
|
|
|
|
|
|
'regex' => [ @regex ] |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |