File Coverage

blib/lib/Bootylicious/Comment.pm
Criterion Covered Total %
statement 30 35 85.7
branch 2 2 100.0
condition n/a
subroutine 11 13 84.6
pod 1 7 14.2
total 44 57 77.1


line stmt bran cond sub pod time code
1             package Bootylicious::Comment;
2              
3 13     13   477 use strict;
  13         13  
  13         283  
4 13     13   37 use warnings;
  13         14  
  13         252  
5              
6 13     13   45 use base 'Bootylicious::Document';
  13         10  
  13         975  
7              
8 13     13   406 use Bootylicious::Article;
  13         16  
  13         98  
9 13     13   230 use Bootylicious::Timestamp;
  13         12  
  13         52  
10 13     13   193 use File::stat;
  13         12  
  13         66  
11              
12             sub new {
13 30     30 1 742 my $self = shift->SUPER::new;
14 30         148 my %params = @_;
15              
16 30         53 foreach my $method (qw/author email url content/) {
17 120 100       230 $self->$method($params{$method}) if defined $params{$method};
18             }
19              
20 30         64 return $self;
21             }
22              
23             sub created {
24 60     60 0 167 Bootylicious::Timestamp->new(epoch => stat(shift->path)->mtime);
25             }
26 5     5 0 11 sub email { shift->metadata(email => @_) }
27 0     0 0 0 sub url { shift->metadata(url =>) }
28              
29 10     10 0 308 sub content { shift->inner(content => @_) }
30              
31             sub number {
32 2     2 0 3 my $self = shift;
33              
34 2         4 my $path = $self->path;
35              
36 2         15 my ($number) = ($path =~ m/-(\d+)$/);
37              
38 2         8 return $number;
39             }
40              
41             sub article {
42 0     0 0   my $self = shift;
43              
44 0           my $path = $self->path;
45 0           $path =~ s/\.comment-(\d+)$//;
46              
47 0           return Bootylicious::Article->new(path => $path);
48             }
49              
50             1;