File Coverage

blib/lib/Net/Posterous/Comment.pm
Criterion Covered Total %
statement 12 23 52.1
branch n/a
condition 0 2 0.0
subroutine 4 9 44.4
pod 4 4 100.0
total 20 38 52.6


line stmt bran cond sub pod time code
1             package Net::Posterous::Comment;
2              
3 1     1   1150 use strict;
  1         3  
  1         40  
4 1     1   6 use base qw(Net::Posterous::Object);
  1         2  
  1         79  
5 1     1   6 use Class::Accessor "antlers";
  1         2  
  1         6  
6 1     1   1278 use DateTime::Format::Strptime;
  1         322747  
  1         365  
7              
8             =head1 NAME
9              
10             Net::Posterous::Comment - represent a comment in Net::Posterous
11              
12             =head1 METHODS
13              
14             =cut
15              
16              
17             =head2 id
18              
19             Get or set the id of the comment.
20              
21             =cut
22              
23             has id => ( is => "rw", isa => "Int" );
24              
25             =head2 body
26              
27             =head2 comment
28              
29             Get or set the body of the comment. C is an alias.
30              
31             =cut
32              
33             has body => ( is => "rw", isa => "Str" );
34              
35             # GODDAMN IT Posterous - don't use different names in different parts of the API
36             sub comment {
37 0     0 1   shift->body(@_);
38             }
39              
40             =head2 datetime
41              
42             Get or set the date of this comment as a C object.
43              
44             =cut
45              
46             sub datetime {
47 0     0 1   shift->_handle_datetime(@_);
48             }
49              
50             =head2 date
51              
52             Get or set the date of this comment as an RFC822 encoded date string.
53              
54             =cut
55              
56             has date => ( is => "rw", isa => "Str" );
57              
58              
59             =head2 author
60              
61             =head2 name
62              
63             Get or set the author's name of this comment.
64              
65             C is an alias.
66              
67             =cut
68              
69             has author => ( is => "rw", isa => "Str" );
70              
71             # GODDAMN IT Posterous - don't use different names in different parts of the API
72 0     0 1   sub name { shift->author(@_) }
73              
74             =head2 email
75              
76             Get or set the email of this comment.
77              
78             =cut
79              
80             has email => ( is => "rw", isa => "Str" );
81              
82             =head2 author_pic
83              
84             =head2 authorpic
85              
86             Get or set the url to the author of the comment's user pic.
87              
88             C is an alias due to Posterous having interestingly inconsistent naming schema.
89              
90             =cut
91              
92 0     0 1   sub author_pic { shift->authorpic(@_) }
93             has authorpic => ( is => "rw", isa => "Str" );
94              
95             sub _to_params {
96 0     0     my $self = shift;
97 0           my @keys = qw(comment name email date);
98 0           my %params = ();
99 0           foreach my $key (@keys) {
100 0   0       my $val = $self->$key || next;
101 0           $params{$key} = $val;
102             }
103              
104 0           return %params;
105             }
106              
107             1;