Branch Coverage

blib/lib/Reddit/Client.pm
Criterion Covered Total %
branch 1 476 0.2


line true false branch
274 0 0 unless (exists $param{'user_agent'})
286 0 0 if ($param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
287 0 0 if (not $param{'username'}) { }
0 0 elsif (not $param{'client_id'} && $param{'secret'}) { }
301 0 0 unless $param{'client_id'} and $param{'secret'}
308 0 0 if $param{'username'}
314 0 0 if $param{'client_id'}
315 0 0 if $param{'secret'}
336 0 0 if (not $self->{'last_token'} or $self->{'last_token'} <= time - 3600 + 55)
370 0 0 if ($param{'username'} or $param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
371 0 0 unless $param{'username'} and $param{'password'} and $param{'client_id'} and $param{'secret'}
396 0 0 if ($self->{'auth_type'} eq 'script') { }
0 0 elsif ($self->{'auth_type'} eq 'webapp') { }
409 0 0 if (not $self->{'token'})
414 0 0 !$self->{'last_token'} || $self->{'last_token'} <= time - 3595 ? :
445 0 0 if ($method eq 'POST') { }
453 0 0 if $response
455 0 0 if (ref $json eq 'HASH' and $json->{'json'}) { }
457 0 0 if (@{$result->{'errors'};}) { }
478 0 0 unless defined $api
487 0 0 if ($method eq 'GET' or $method eq 'DELETE') { }
496 0 0 if (ref $result eq "HASH" and exists $result->{'errors'})
499 0 0 if (@errors)
506 0 0 if (defined $callback and ref $callback eq 'CODE') { }
539 0 0 if lc $type eq "home"
543 0 0 $type eq 'moderator' || $type eq 'contributor' || $type eq 'subscriber' ? :
599 0 0 $param{'mark'} ? :
600 0 0 if $param{'sr_detail'}
601 0 0 if $param{'before'}
602 0 0 if $param{'after'}
603 0 0 if (exists $param{'limit'}) { }
649 0 0 if ($page) { }
667 0 0 unless defined $id
676 0 0 if $rtn
713 0 0 if (substr($commentid, 0, 3) eq "t1_")
714 0 0 if (substr($post_fullname, 0, 3) ne "t3_")
741 0 0 $param{'crossposts_only'} ? :
743 0 0 if $param{'sort'}
744 0 0 if $param{'subreddit'} or $param{'sub'}
774 0 0 if $subreddit
779 0 0 $subreddit ? :
798 0 0 unless @fullnames
811 0 0 unless $fullname
821 0 0 unless $fullname
825 0 0 unless $info
828 0 0 if ($param{'include_children'} and $cmt->{'permalink'})
841 0 0 if $param{'before'}
842 0 0 if $param{'after'}
843 0 0 if (exists $param{'limit'}) { }
847 0 0 $subreddit ? :
849 0 0 $subreddit ? :
908 0 0 unless $fullname
910 0 0 unless (ispost($fullname) or iscomment($fullname))
914 0 0 exists $param{'lock'} ? :
916 0 0 $lock ? :
929 0 0 unless $fullname
931 0 0 unless (ispost($fullname))
935 0 0 exists $param{'nsfw'} ? :
937 0 0 $nsfw ? :
967 0 0 if $param{'ban_message'}
969 0 0 if ($param{'reason'})
970 0 0 if (length $param{'reason'} > 100)
977 0 0 if ($param{'note'})
978 0 0 if (length $param{'note'} > 300)
985 0 0 if ($param{'duration'})
986 0 0 if ($param{'duration'} > 999) { }
0 0 elsif ($param{'duration'} < 1) { }
992 0 0 if $param{'duration'}
1002 0 0 if ($param{'mode'} eq 'mute') { }
0 0 elsif ($param{'mode'} eq 'contributor') { }
0 0 elsif ($param{'mode'} eq 'moderator_invite') { }
1039 0 0 if ($unapprove) { }
1047 0 0 unless ($user)
1048 0 0 unless ($sub)
1076 0 0 if ($param{'mode'} eq 'mute') { }
0 0 elsif ($param{'mode'} eq 'contributor') { }
1102 0 0 unless (iscomment($fullname) or ispost($fullname))
1106 0 0 if (iscomment($fullname))
1108 0 0 exists $param{'sticky'} ? :
1109 0 0 $sticky ? :
1117 0 0 if ($param{'how'})
1121 0 0 if ($param{'how'} eq $_)
1127 0 0 unless $ok
1141 0 0 unless (iscomment($fullname) or ispost($fullname))
1164 0 0 if $param{'custom_text'}
1165 0 0 if exists $param{'from_help_desk'}
1166 0 0 if exists $param{'from_modmail'}
1168 0 0 if $param{'modmail_conv_id'}
1169 0 0 if $param{'other_reason'}
1170 0 0 if $param{'reason'}
1171 0 0 if $param{'rule_reason'}
1172 0 0 if $param{'site_reason'}
1174 0 0 if $param{'sub'} or $param{'subreddit'}
1176 0 0 unless $id =~ /^t[0-9]_/
1181 0 0 if $param{'usernames'}
1210 0 0 $_->{'kind'} eq 't1' ? :
1245 0 0 if $param{'after'}
1246 0 0 $param{'limit'} ? :
0 0 exists $param{'limit'} ? :
1249 0 0 if ($subs)
1250 0 0 if ref $subs eq "ARRAY"
1251 0 0 if $subs
1278 0 0 exists $param{'hide_author'} ? :
0 0 exists $param{'isAuthorHidden'} ? :
1280 0 0 $auth ? :
1283 0 0 if (length $subj > 100)
1298 0 0 if (ref $result eq "HASH")
1311 0 0 if ($opt{'num'})
1312 0 0 if ($opt{'num'} =~ /^[1234]$/) { }
1319 0 0 $opt{'sticky'} ? :
0 0 exists $opt{'sticky'} ? :
1320 0 0 $opt{'to_profile'} ? :
0 0 exists $opt{'to_profile'} ? :
1338 0 0 unless $action and $id
1354 0 0 if ($action eq $_)
1359 0 0 unless $api
1375 0 0 if ($length == 3 or $length == 7 or $length == 28) { }
0 0 elsif ($length != 72 and $length != 168 and $length != 672) { }
1407 0 0 if (not $odd or $_[0] eq 'user' or $_[0] eq 'username' or $_[0] eq 'view') { }
1433 0 0 if ($view eq "about")
1443 0 0 $_->{'kind'} eq 't1' ? :
1455 0 0 if $type ne "t1" and $type ne "t3"
1456 0 0 unless defined $text
1472 0 0 unless $name
1474 0 0 if $type ne "t1" and $type ne "t3"
1492 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1493 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1494 0 0 $param{'nsfw'} ? :
0 0 exists $param{'nsfw'} ? :
1519 0 0 if lc substr($source_id, 0, 3) ne "t3_"
1521 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1522 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1545 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1584 0 0 $param{'text'} ? :
1588 0 0 if $text
1589 0 0 if $css_class
1607 0 0 $param{'text'} ? :
1612 0 0 if $text
1613 0 0 if $css_class
1662 0 0 if (not $post_id || $param{'username'}) { }
0 0 elsif ($post_id) { }
1670 0 0 if ($textcol)
1672 0 0 if ($textcol ne "light" and $textcol ne "dark")
1679 0 0 if $param{'background_color'}
1680 0 0 if $param{'css_class'}
1682 0 0 if $post_id
1683 0 0 if $param{'username'}
1684 0 0 if $param{'return_rtjson'}
1685 0 0 if $textcol
1733 0 0 if ($post_id) { }
0 0 elsif ($user) { }
1749 0 0 if ($result->{'choices'})
1751 0 0 $result->{'choices'}[$i]{'flair_text_editable'} ? :
1802 0 0 if $param{'background_color'}
1805 0 0 $param{'mod_only'} ? :
0 0 exists $param{'mod_only'} ? :
1806 0 0 $param{'text_editable'} ? :
0 0 exists $param{'text_editable'} ? :
1809 0 0 if ($textcol)
1811 0 0 if ($textcol ne "light" and $textcol ne "dark")
1819 0 0 if ($bg and substr($bg, 0, 1) ne "#")
1822 0 0 if $param{'allowable_content'}
1823 0 0 if $bg
1824 0 0 if $param{'css_class'}
1825 0 0 if $param{'max_emojis'}
1827 0 0 if $flairid
1830 0 0 if exists $param{'mod_only'}
1832 0 0 if $param{'override_css'}
1833 0 0 if $param{'text'}
1834 0 0 if $textcol
1835 0 0 if exists $param{'text_editable'}
1855 0 0 if $param{'v'}
1856 0 0 if $param{'v2'}
1864 0 0 $param{'data'} ? :
1875 0 0 defined $param{'content'} ? :
1877 0 0 if (length $content > 524288)
1885 0 0 if ($previous)
1886 0 0 if ($reason)
1905 0 0 if ($param{'permalink'}) { }
0 0 elsif ($sub and $param{'comment_id'} and $param{'link_id'}) { }
0 0 elsif ($sub and $param{'id'}) { }
0 0 elsif ($param{'url'}) { }
1928 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1943 0 0 $param{'limit_children'} ? :
0 0 exists $param{'limit_children'} ? :
1946 0 0 if (ref $children eq 'ARRAY') { }
1948 0 0 unless $ids
1960 0 0 if $param{'sort'}
1961 0 0 if $param{'id'}
1971 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1989 0 0 unless ispost($parent_id) or iscomment($parent_id)
2016 0 0 if length $subject > 100
2037 0 0 unless defined $name
2038 0 0 unless defined $direction
2039 0 0 unless ispost($name) or iscomment($name)
2040 0 0 unless "$direction" =~ /^(-1|0|1)$/
2052 0 0 unless ispost($name) or iscomment($name)
2060 0 0 unless ispost($name) or iscomment($name)
2068 0 0 unless ispost($name)
2076 0 0 unless ispost($name)
2097 0 0 if (length $model->{'display_name'} > 50)
2099 0 0 if $param{'description'}
2101 0 0 if ($param{'icon_name'})
2106 0 0 if $i eq $model->{'icon_name'}
2109 0 0 unless ($match)
2112 0 0 if ($param{'key_color'})
2114 0 0 if (length $model->{'key_color'} != 7)
2117 0 0 if ($param{'visibility'})
2119 0 0 if ($model->{'visibility'} ne "private" and $model->{'visibility'} ne "public" and $model->{'visibility'} ne "hidden")
2126 0 0 if ($param{'weighting_scheme'})
2128 0 0 if ($model->{'weighting_scheme'} ne "classic" and $model->{'weighting_scheme'} ne "fresh")
2131 0 0 if ($param{'subreddits'} or $param{'subs'})
2133 0 0 if (ref $param{'subreddits'} ne "ARRAY")
2145 0 0 $param{'edit'} ? :
2156 0 0 $param{'expand'} ? :
2201 0 0 if substr($id, 0, 3) ne $type . "_"
2205 0 0 $_[0] ? :
2219 0 0 if $name
2222 0 2 if ($DEBUG)
2237 0 0 if (not $subject =~ m[/]) { }
2238 0 0 if ($subject eq '') { }
2253 0 0 if $param{'before'}
2254 0 0 if $param{'after'}
2255 0 0 if $param{'only'}
2256 0 0 if $param{'count'}
2257 0 0 if $param{'show'} or $param{'show_all'}
2258 0 0 if $param{'sort'}
2259 0 0 if $param{'sr_detail'}
2261 0 0 if (exists $param{'limit'}) { }