blib/lib/Lingy.pm

filter: Statementstmt 100% 36 / 36 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 5 / 5 totaltotal 88.8% 56 / 63 CC 8 SCAR 8.1
CC
8
Cov
86%
read
3.1
new
3.1
eval
2.0
CRAP 2.2
« lib/Lingy/Class.pm ↑ Summary lib/Lingy/Regex.pm »
1 60 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Lingy;
3 60 our $VERSION = '0.1.17';
4  
5 60 my $rt = 0;
6  
7 60 ▶use constant error_prefix => 'Lingy Error:';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new {
10 1 ▶ die "Lingy->new() takes no arguments"
Subroutine new: called CC=3 SCAR=11.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 1 1
11 unless @_ == 1;
12 1 my ($class) = @_;
13 1 require Lingy::RT;
14 1 my $rt_class = "${class}::RT";
15 1 ▶ $rt_class->init unless $Lingy::RT::OK;
Branch: 1 branch
BranchTrueFalseTotal
unless $Lingy::RT::OK 1 0 1
16 1 return bless {
17 RT => $rt_class,
18 }, $class;
19 }
20  
21 sub rep {
22 5 ▶ die "Lingy->rep(string) takes one argument"
Subroutine rep: called CC=2 SCAR=7.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 5 5
23 unless @_ == 2;
24 5 my ($self, $string) = @_;
25 5 local $Lingy::Common::error_prefix = $self->error_prefix;
26 5 my ($ret) = $self->{RT}->rep($string);
27 3 return $ret;
28 }
29  
30 sub read {
31 1 ▶ die "Lingy->read(string) takes one argument"
Subroutine read: called CC=3 SCAR=11.3
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 1 1
32 unless @_ == 2;
33 1 my ($self, $string) = @_;
34 1 local $Lingy::Common::error_prefix = $self->error_prefix;
35 1 my (@ret) = $self->{RT}->reader->read_str($string);
36 1 ▶ return wantarray ? @ret : $ret[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 1 1
37 }
38  
39 sub eval {
40 1 ▶ die "Lingy->eval(form) takes one argument"
Subroutine eval: called CC=2 SCAR=7.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 1 1
41 unless @_ == 2;
42 1 my ($self, $form) = @_;
43 1 local $Lingy::Common::error_prefix = $self->error_prefix;
44 1 $self->{RT}->eval($form);
45 }
46  
47 sub print {
48 2 ▶ die "Lingy->print(form) takes one argument"
Subroutine print: called CC=2 SCAR=7.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 2 2
49 unless @_ == 2;
50 2 my ($self, $form) = @_;
51 2 local $Lingy::Common::error_prefix = $self->error_prefix;
52 2 $self->{RT}->printer->pr_str($form);
53 }
54  
55 60 1;
« lib/Lingy/Class.pm ↑ Summary lib/Lingy/Regex.pm »