CljPerl.pm

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