| 1 | package Net::Posterous::Comment; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use base qw(Net::Posterous::Object); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use Class::Accessor "antlers"; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 2 | ▶ | use DateTime::Format::Strptime; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 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 | 2 | 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<comment> is an alias. | ||||||||||||
| 30 | |||||||||||||
| 31 | =cut | ||||||||||||
| 32 | |||||||||||||
| 33 | 2 | has body => ( is => "rw", isa => "Str" ); | |||||||||||
| 34 | |||||||||||||
| 35 | # GODDAMN IT Posterous - don't use different names in different parts of the API | ||||||||||||
| 36 | 0 | ▶ | sub comment { | ||||||||||
|
Subroutine
comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 37 | 0 | shift->body(@_); | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | =head2 datetime | ||||||||||||
| 41 | |||||||||||||
| 42 | Get or set the date of this comment as a C<DateTime> object. | ||||||||||||
| 43 | |||||||||||||
| 44 | =cut | ||||||||||||
| 45 | |||||||||||||
| 46 | 0 | ▶ | sub datetime { | ||||||||||
|
Subroutine
datetime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 47 | 0 | 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 | 2 | 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<name> is an alias. | ||||||||||||
| 66 | |||||||||||||
| 67 | =cut | ||||||||||||
| 68 | |||||||||||||
| 69 | 2 | has author => ( is => "rw", isa => "Str" ); | |||||||||||
| 70 | |||||||||||||
| 71 | # GODDAMN IT Posterous - don't use different names in different parts of the API | ||||||||||||
| 72 | 0 | ▶ | sub name { shift->author(@_) } | ||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 73 | |||||||||||||
| 74 | =head2 email | ||||||||||||
| 75 | |||||||||||||
| 76 | Get or set the email of this comment. | ||||||||||||
| 77 | |||||||||||||
| 78 | =cut | ||||||||||||
| 79 | |||||||||||||
| 80 | 2 | 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<authorpic> is an alias due to Posterous having interestingly inconsistent naming schema. | ||||||||||||
| 89 | |||||||||||||
| 90 | =cut | ||||||||||||
| 91 | |||||||||||||
| 92 | 0 | ▶ | sub author_pic { shift->authorpic(@_) } | ||||||||||
|
Subroutine
author_pic: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 93 | 2 | has authorpic => ( is => "rw", isa => "Str" ); | |||||||||||
| 94 | |||||||||||||
| 95 | 0 | ▶ | sub _to_params { | ||||||||||
|
Subroutine
_to_params: not called CC=3 SCAR=24.8
| |||||||||||||
| 96 | 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 | ▶ | my $val = $self->$key || next; | ||||||||||
|
Condition0%0/2
$self->$key || (next)
MC/DC0%0/1
$self->$key || (next)
$self->$key
Truth table0%0/2
A
A= $self->$key
| |||||||||||||
| 101 | 0 | $params{$key} = $val; | |||||||||||
| 102 | } | ||||||||||||
| 103 | |||||||||||||
| 104 | 0 | return %params; | |||||||||||
| 105 | } | ||||||||||||
| 106 | |||||||||||||
| 107 | 2 | 1; | |||||||||||