line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CljPerl; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
41951
|
use 5.008008; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
64
|
|
6
|
2
|
|
|
2
|
|
11
|
use File::Basename; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
246
|
|
7
|
2
|
|
|
2
|
|
10
|
use File::Spec; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
55
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
1454
|
use CljPerl::Evaler; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# This allows declaration use CljPerl ':all'; |
16
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
) ] ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT = qw( |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Preloaded methods go here. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# file |
32
|
|
|
|
|
|
|
sub print { |
33
|
|
|
|
|
|
|
print @_; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub openfile { |
37
|
|
|
|
|
|
|
my $file = shift; |
38
|
|
|
|
|
|
|
my $cb = shift; |
39
|
|
|
|
|
|
|
my $fh; |
40
|
|
|
|
|
|
|
open $fh, $file; |
41
|
|
|
|
|
|
|
&{$cb}($fh); |
42
|
|
|
|
|
|
|
close $fh; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub puts { |
46
|
|
|
|
|
|
|
my $fh = shift; |
47
|
|
|
|
|
|
|
my $str = shift; |
48
|
|
|
|
|
|
|
print $fh $str; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub readline { |
52
|
|
|
|
|
|
|
my $fh = shift; |
53
|
|
|
|
|
|
|
return <$fh>; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub readlines { |
57
|
|
|
|
|
|
|
my $file = shift; |
58
|
|
|
|
|
|
|
my $fh; |
59
|
|
|
|
|
|
|
open $fh, "<$file"; |
60
|
|
|
|
|
|
|
my @lines = <$fh>; |
61
|
|
|
|
|
|
|
close $fh; |
62
|
|
|
|
|
|
|
return join("\n", @lines); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub file_exists { |
66
|
|
|
|
|
|
|
my $file = shift; |
67
|
|
|
|
|
|
|
return \(-e $file); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# lib search path |
71
|
|
|
|
|
|
|
sub use_lib { |
72
|
|
|
|
|
|
|
my $path = shift; |
73
|
|
|
|
|
|
|
unshift @INC, $path; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $lib_path = File::Spec->rel2abs(dirname(__FILE__) . "/CljPerl"); |
77
|
|
|
|
|
|
|
use_lib($lib_path); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub gen_name { |
80
|
|
|
|
|
|
|
return "gen-" . rand; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# regexp |
84
|
|
|
|
|
|
|
sub match { |
85
|
|
|
|
|
|
|
my $regexp = shift; |
86
|
|
|
|
|
|
|
my $str = shift; |
87
|
|
|
|
|
|
|
my @m = ($str =~ qr($regexp)); |
88
|
|
|
|
|
|
|
return \@m; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub get_env { |
92
|
|
|
|
|
|
|
my $name = shift; |
93
|
|
|
|
|
|
|
return $ENV{$name}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
__END__ |