AtD/Error.pm

filter: Statementstmt 78.1% 25 / 32 Branchbran 33.3% 2 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 75.0% 3 / 4 totaltotal 65.4% 36 / 55 CC 5 SCAR 11.8
CC
5
Cov
68%
get_suggestions
6.0
BUILD
4.8
has_suggestions
2.0
CRAP 3.3
« AtD.pm ↑ Summary AtD/Results.pm »
1 #
2 # This file is part of Lingua-AtD
3 #
4 # This software is copyright (c) 2011 by David L. Day.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 package Lingua::AtD::Error;
10 5 $Lingua::AtD::Error::VERSION = '1.160790';
11 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use Class::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # ABSTRACT: Encapsulates the grammar/spelling/style Errors contained in Results.
17  
18 {
19  
20 # Attributes
21 5 my %string_of : ATTR( :init_arg<string> :get<string> );
22 5 my %description_of : ATTR( :init_arg<description> :get<description> );
23 5 my %precontext_of : ATTR( :init_arg<precontext> :get<precontext> );
24 5 my %suggestions_of : ATTR();
25 5 my %type_of : ATTR( :init_arg<type> :get<type> );
26 5 my %url_of : ATTR( :get<url> );
27  
28 2 ▶ sub BUILD {
Subroutine BUILD: called CC=4 SCAR=15.6
Pod undocumented
29 2 my ( $self, $ident, $arg_ref ) = @_;
30  
31 # Special cases. Both are optional, suggestions is an array.
32 $suggestions_of{$ident} = $arg_ref->{suggestions}
33 2 ▶ if ( defined( $arg_ref->{suggestions} ) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"suggestions"} 2 0 2
34 $url_of{$ident} = $arg_ref->{url}
35 2 ▶ if ( defined( $arg_ref->{url} ) && length( $arg_ref->{url} ) > 0 );
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"url"} and length $arg_ref->{"url"} > 0 2 0 2
Condition33%1/3
defined $arg_ref->{"url"} and length $arg_ref->{"url"} > 0
!ll&&!rl&&r
002
MC/DC0%0/2
defined $arg_ref->{"url"} and length $arg_ref->{"url"} > 0
defined $arg_ref->{"url"} length $arg_ref->{"url"} > 0
Truth table33%1/3
A and B
A= defined $arg_ref->{"url"}B= length $arg_ref->{"url"} > 0
ABresult
0X0
100
111
36  
37 2 return;
38 }
39  
40 # Convenience method
41 0 ▶ sub has_suggestions {
Subroutine has_suggestions: not called CC=1 SCAR=6.9
Pod documented
42 0 my $self = shift;
43 0 return defined( $suggestions_of{ ident($self) } );
44 }
45  
46 # Dereference array
47 0 ▶ sub get_suggestions {
Subroutine get_suggestions: not called CC=2 SCAR=17.9
Pod documented
48 0 my $self = shift;
49 return $self->has_suggestions()
50 0 ▶ ? @{ $suggestions_of{ ident($self) } }
Branch: 1 branch
BranchTrueFalseTotal
$self->has_suggestions ? : 0 0 0
51 : undef;
52 }
53  
54 # Convenience method
55 0 ▶ sub has_url {
Subroutine has_url: not called CC=1 SCAR=6.9
Pod documented
56 0 my $self = shift;
57 0 return defined( $url_of{ ident($self) } );
58 }
59  
60 }
61  
62 5 1; # Magic true value required at end of module
63  
64 __END__
« AtD.pm ↑ Summary AtD/Results.pm »