line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Header: /home/fergal/my/cvs/Code-Perl/lib/Code/Perl/Expr/Constant.pm,v 1.2 2003/06/17 18:37:21 fergal Exp $ |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Code::Perl::Expr::Constant; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
35
|
use base 'Code::Perl::Expr::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
201
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Class::MethodMaker ( |
10
|
1
|
|
|
|
|
8
|
get_set => [qw( -java Value )] |
11
|
1
|
|
|
1
|
|
8
|
); |
|
1
|
|
|
|
|
2
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub eval |
14
|
|
|
|
|
|
|
{ |
15
|
22
|
|
|
22
|
0
|
72
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
22
|
|
|
|
|
872
|
return $self->getValue; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %esc = ( |
21
|
|
|
|
|
|
|
"\\" => "\\\\", |
22
|
|
|
|
|
|
|
"\n" => "\\n", |
23
|
|
|
|
|
|
|
"\r" => "\\r", |
24
|
|
|
|
|
|
|
'"' => '\\"', |
25
|
|
|
|
|
|
|
'$' => '\\$', |
26
|
|
|
|
|
|
|
'@' => '\\@', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub getQuotedValue |
30
|
|
|
|
|
|
|
{ |
31
|
15
|
|
|
15
|
0
|
22
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
15
|
|
|
|
|
40
|
my $value = $self->{Value}; |
34
|
|
|
|
|
|
|
|
35
|
15
|
|
|
|
|
21
|
if (1) |
36
|
|
|
|
|
|
|
{ |
37
|
15
|
|
|
|
|
81
|
$value =~ s/([\\\n\r"\$\@])/$esc{$1}/g; |
38
|
15
|
|
|
|
|
77
|
return '"'.$value.'"'; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
return '"'.quotemeta($self->{Value}).'"'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |