Code/Wiki/Comment.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 88.3% 38 / 43 CC 6 SCAR 15.2
CC
6
Cov
87%
parse
6.4
BEGIN
1.0
BEGIN
1.0
CRAP 4.6
« Code.pm ↑ Summary Code/Wiki.pm »
1 package Net::Google::Code::Wiki::Comment;
2  
3 3 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Params::Validate qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 with 'Net::Google::Code::Role::HTMLTree';
6  
7 3 has 'content' => (
8 isa => 'Str',
9 is => 'rw',
10 );
11  
12 3 has 'author' => (
13 isa => 'Str',
14 is => 'rw',
15 );
16  
17 3 has 'date' => (
18 isa => 'Str',
19 is => 'rw',
20 );
21  
22 4 ▶sub parse {
Subroutine parse: called CC=6 SCAR=18.5
Pod documented
23 4 my $self = shift;
24 4 my $element = shift;
25 4 my $need_update = not blessed $element;
26 4 ▶ $element = $self->html_tree( html => $element ) unless blessed $element;
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($element) 0 4 4
27  
28 4 my $author =
29 $element->look_down( class => 'author' )->find_by_tag_name('a')->as_text;
30 4 my $date = $element->look_down( class => 'date' )->attr('title');
31 4 my $content = $element->look_down( class => 'commentcontent' )->as_text;
32 4 $content =~ s/\s+$//; # remove trailing spaces
33  
34 4 ▶ $self->author( $author ) if $author;
Branch: 1 branch
BranchTrueFalseTotal
if $author 4 0 4
35 4 ▶ $self->date( $date ) if $date;
Branch: 1 branch
BranchTrueFalseTotal
if $date 4 0 4
36 4 ▶ $self->content( $content ) if $content;
Branch: 1 branch
BranchTrueFalseTotal
if $content 4 0 4
37 4 ▶ $element->delete if $need_update;
Branch: 1 branch
BranchTrueFalseTotal
if $need_update 0 4 4
38 4 return 1;
39 }
40  
41  
42 3 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 3 __PACKAGE__->meta->make_immutable;
44  
45 3 1;
46 __END__
« Code.pm ↑ Summary Code/Wiki.pm »