File Coverage

blib/lib/Reddit/Client/MoreComments.pm
Criterion Covered Total %
statement 18 26 69.2
branch 0 8 0.0
condition 0 2 0.0
subroutine 6 7 85.7
pod 0 1 0.0
total 24 44 54.5


line stmt bran cond sub pod time code
1             package Reddit::Client::MoreComments;
2              
3 5     5   39 use strict;
  5         10  
  5         152  
4 5     5   35 use warnings;
  5         14  
  5         124  
5 5     5   24 use Carp;
  5         11  
  5         307  
6              
7             require Reddit::Client::Thing;
8              
9 5     5   39 use base qw/Reddit::Client::Thing/;
  5         13  
  5         662  
10 5         32 use fields qw/
11             children count depth parent_id link_id
12 5     5   40 /;
  5         21  
13              
14 5     5   461 use constant type => "more";
  5         11  
  5         957  
15              
16             sub get_collapsed_comments {
17 0     0 0   my ($this, %param) = @_;
18 0   0       my $linkid = $this->{link_id} || $param{link_id} || undef;
19 0 0         print "MoreComments::get_collapsed_comments: link_id is required. Normally this should populate on its own. It being undefined could be the sign of an issue elsewhere. You can set it manually by passing in a link_id." unless $linkid;
20 0 0         return unless $linkid;
21              
22             my %data = (
23             link_id => $linkid,
24             children=> $this->{children},
25 0           );
26 0 0         $data{sort} = $param{sort} if $param{sort};
27 0 0         $data{id} = $param{id} if $param{id};
28              
29 0           return $this->{session}->get_collapsed_comments( %data );
30             }
31              
32             1;
33              
34             __END__