| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Reddit::Client::VotableThing; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 5 |  |  | 5 |  | 43 | use strict; | 
|  | 5 |  |  |  |  | 13 |  | 
|  | 5 |  |  |  |  | 141 |  | 
| 4 | 5 |  |  | 5 |  | 26 | use warnings; | 
|  | 5 |  |  |  |  | 10 |  | 
|  | 5 |  |  |  |  | 111 |  | 
| 5 | 5 |  |  | 5 |  | 25 | use Carp; | 
|  | 5 |  |  |  |  | 10 |  | 
|  | 5 |  |  |  |  | 312 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | require Reddit::Client::Thing; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 5 |  |  | 5 |  | 31 | use base   qw/Reddit::Client::Thing/; | 
|  | 5 |  |  |  |  | 22 |  | 
|  | 5 |  |  |  |  | 823 |  | 
| 10 | 5 |  |  | 5 |  | 50 | use fields qw/ups downs likes score edited type is_original_content/; | 
|  | 5 |  |  |  |  | 11 |  | 
|  | 5 |  |  |  |  | 39 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | # likes may be true, false, or null, based on user vote | 
| 13 |  |  |  |  |  |  | sub set_likes { | 
| 14 | 0 |  |  | 0 | 1 |  | my ($self, $value) = @_; | 
| 15 | 0 | 0 |  |  |  |  | $self->set_bool('likes', $value) if defined $value; | 
| 16 |  |  |  |  |  |  | } | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub vote { | 
| 19 | 0 |  |  | 0 | 1 |  | my ($self, $direction) = @_; | 
| 20 | 0 |  |  |  |  |  | $self->{session}->vote($self->{name}, $direction); | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub comment { | 
| 24 | 0 |  |  | 0 | 1 |  | my ($self, $comment) = @_; | 
| 25 | 0 |  |  |  |  |  | $self->{session}->submit_comment(parent_id => $self->{name}, text => $comment); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub save { | 
| 29 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 30 | 0 |  |  |  |  |  | $self->{session}->save($self->{name}); | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub unsave { | 
| 34 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 35 | 0 |  |  |  |  |  | $self->{session}->unsave($self->{name}); | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | 1; | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | __END__ |