Branch Coverage

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


line true false branch
302 0 0 unless (exists $param{'user_agent'})
314 0 0 if ($param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
315 0 0 if (not $param{'username'}) { }
0 0 elsif (not $param{'client_id'} && $param{'secret'}) { }
329 0 0 unless $param{'client_id'} and $param{'secret'}
336 0 0 if $param{'username'}
342 0 0 if $param{'client_id'}
343 0 0 if $param{'secret'}
364 0 0 if (not $self->{'last_token'} or $self->{'last_token'} <= time - 3600 + 55)
398 0 0 if ($param{'username'} or $param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
399 0 0 unless $param{'username'} and $param{'password'} and $param{'client_id'} and $param{'secret'}
424 0 0 if ($self->{'auth_type'} eq 'script') { }
0 0 elsif ($self->{'auth_type'} eq 'webapp') { }
437 0 0 if (not $self->{'token'})
442 0 0 !$self->{'last_token'} || $self->{'last_token'} <= time - 3595 ? :
473 0 0 if ($method eq 'POST') { }
481 0 0 if $response
483 0 0 if (ref $json eq 'HASH' and $json->{'json'}) { }
485 0 0 if (@{$result->{'errors'};}) { }
506 0 0 unless defined $api
515 0 0 if ($method eq 'GET' or $method eq 'DELETE') { }
524 0 0 if (ref $result eq 'HASH' and exists $result->{'errors'})
527 0 0 if (@errors)
534 0 0 if (defined $callback and ref $callback eq 'CODE') { }
567 0 0 if lc $type eq 'home'
571 0 0 $type eq 'moderator' || $type eq 'contributor' || $type eq 'subscriber' ? :
627 0 0 $param{'mark'} ? :
628 0 0 if $param{'sr_detail'}
629 0 0 if $param{'before'}
630 0 0 if $param{'after'}
631 0 0 if (exists $param{'limit'}) { }
677 0 0 if ($page) { }
695 0 0 unless defined $id
704 0 0 if $rtn
741 0 0 if (substr($commentid, 0, 3) eq 't1_')
742 0 0 if (substr($post_fullname, 0, 3) ne 't3_')
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') { }
1066 0 0 if ($param{'mode'} eq 'mute') { }
1090 0 0 unless (iscomment($fullname) or ispost($fullname))
1094 0 0 if (iscomment($fullname))
1096 0 0 exists $param{'sticky'} ? :
1097 0 0 $sticky ? :
1105 0 0 if ($param{'how'})
1109 0 0 if ($param{'how'} eq $_)
1115 0 0 unless $ok
1129 0 0 unless (iscomment($fullname) or ispost($fullname))
1152 0 0 if $param{'custom_text'}
1153 0 0 if exists $param{'from_help_desk'}
1154 0 0 if exists $param{'from_modmail'}
1156 0 0 if $param{'modmail_conv_id'}
1157 0 0 if $param{'other_reason'}
1158 0 0 if $param{'reason'}
1159 0 0 if $param{'rule_reason'}
1160 0 0 if $param{'site_reason'}
1162 0 0 if $param{'sub'} or $param{'subreddit'}
1164 0 0 unless $id =~ /^t[0-9]_/
1169 0 0 if $param{'usernames'}
1198 0 0 $_->{'kind'} eq 't1' ? :
1233 0 0 if $param{'after'}
1234 0 0 $param{'limit'} ? :
0 0 exists $param{'limit'} ? :
1237 0 0 if ($subs)
1238 0 0 if ref $subs eq 'ARRAY'
1239 0 0 if $subs
1266 0 0 exists $param{'hide_author'} ? :
0 0 exists $param{'isAuthorHidden'} ? :
1268 0 0 $auth ? :
1271 0 0 if (length $subj > 100)
1286 0 0 if (ref $result eq 'HASH')
1299 0 0 if ($opt{'num'})
1300 0 0 if ($opt{'num'} =~ /^[1234]$/) { }
1307 0 0 $opt{'sticky'} ? :
0 0 exists $opt{'sticky'} ? :
1308 0 0 $opt{'to_profile'} ? :
0 0 exists $opt{'to_profile'} ? :
1326 0 0 unless $action and $id
1342 0 0 if ($action eq $_)
1347 0 0 unless $api
1363 0 0 if ($length == 3 or $length == 7 or $length == 28) { }
0 0 elsif ($length != 72 and $length != 168 and $length != 672) { }
1395 0 0 if (not $odd or $_[0] eq 'user' or $_[0] eq 'username' or $_[0] eq 'view') { }
1421 0 0 if ($view eq 'about')
1431 0 0 $_->{'kind'} eq 't1' ? :
1443 0 0 if $type ne 't1' and $type ne 't3'
1444 0 0 unless defined $text
1460 0 0 unless $name
1462 0 0 if $type ne 't1' and $type ne 't3'
1480 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1481 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1482 0 0 $param{'nsfw'} ? :
0 0 exists $param{'nsfw'} ? :
1507 0 0 if lc substr($source_id, 0, 3) ne 't3_'
1509 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1510 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1533 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1572 0 0 $param{'text'} ? :
1576 0 0 if $text
1577 0 0 if $css_class
1595 0 0 $param{'text'} ? :
1600 0 0 if $text
1601 0 0 if $css_class
1650 0 0 if (not $post_id || $param{'username'}) { }
0 0 elsif ($post_id) { }
1658 0 0 if ($textcol)
1660 0 0 if ($textcol ne 'light' and $textcol ne 'dark')
1667 0 0 if $param{'background_color'}
1668 0 0 if $param{'css_class'}
1670 0 0 if $post_id
1671 0 0 if $param{'username'}
1672 0 0 if $param{'return_rtjson'}
1673 0 0 if $textcol
1721 0 0 if ($post_id) { }
0 0 elsif ($user) { }
1737 0 0 if ($result->{'choices'})
1739 0 0 $result->{'choices'}[$i]{'flair_text_editable'} ? :
1790 0 0 if $param{'background_color'}
1793 0 0 $param{'mod_only'} ? :
0 0 exists $param{'mod_only'} ? :
1794 0 0 $param{'text_editable'} ? :
0 0 exists $param{'text_editable'} ? :
1797 0 0 if ($textcol)
1799 0 0 if ($textcol ne 'light' and $textcol ne 'dark')
1807 0 0 if ($bg and substr($bg, 0, 1) ne '#')
1810 0 0 if $param{'allowable_content'}
1811 0 0 if $bg
1812 0 0 if $param{'css_class'}
1813 0 0 if $param{'max_emojis'}
1815 0 0 if $flairid
1818 0 0 if exists $param{'mod_only'}
1820 0 0 if $param{'override_css'}
1821 0 0 if $param{'text'}
1822 0 0 if $textcol
1823 0 0 if exists $param{'text_editable'}
1843 0 0 if $param{'v'}
1844 0 0 if $param{'v2'}
1852 0 0 $param{'data'} ? :
1863 0 0 defined $param{'content'} ? :
1865 0 0 if (length $content > 524288)
1873 0 0 if ($previous)
1874 0 0 if ($reason)
1893 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'}) { }
1916 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1931 0 0 $param{'limit_children'} ? :
0 0 exists $param{'limit_children'} ? :
1934 0 0 if (ref $children eq 'ARRAY') { }
1936 0 0 unless $ids
1948 0 0 if $param{'sort'}
1949 0 0 if $param{'id'}
1959 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1977 0 0 unless ispost($parent_id) or iscomment($parent_id)
2004 0 0 if length $subject > 100
2025 0 0 unless defined $name
2026 0 0 unless defined $direction
2027 0 0 unless ispost($name) or iscomment($name)
2028 0 0 unless "$direction" =~ /^(-1|0|1)$/
2040 0 0 unless ispost($name) or iscomment($name)
2048 0 0 unless ispost($name) or iscomment($name)
2056 0 0 unless ispost($name)
2064 0 0 unless ispost($name)
2085 0 0 if (length $model->{'display_name'} > 50)
2087 0 0 if $param{'description'}
2089 0 0 if ($param{'icon_name'})
2094 0 0 if $i eq $model->{'icon_name'}
2097 0 0 unless ($match)
2100 0 0 if ($param{'key_color'})
2102 0 0 if (length $model->{'key_color'} != 7)
2105 0 0 if ($param{'visibility'})
2107 0 0 if ($model->{'visibility'} ne 'private' and $model->{'visibility'} ne 'public' and $model->{'visibility'} ne 'hidden')
2114 0 0 if ($param{'weighting_scheme'})
2116 0 0 if ($model->{'weighting_scheme'} ne 'classic' and $model->{'weighting_scheme'} ne 'fresh')
2119 0 0 if ($param{'subreddits'} or $param{'subs'})
2121 0 0 if (ref $param{'subreddits'} ne 'ARRAY')
2133 0 0 $param{'edit'} ? :
2144 0 0 $param{'expand'} ? :
2189 0 0 if substr($id, 0, 3) ne $type . '_'
2193 0 0 $_[0] ? :
2207 0 0 if $name
2210 0 2 if ($DEBUG)
2225 0 0 if (not $subject =~ m[/]) { }
2226 0 0 if ($subject eq '') { }
2241 0 0 if $param{'before'}
2242 0 0 if $param{'after'}
2243 0 0 if $param{'only'}
2244 0 0 if $param{'count'}
2245 0 0 if $param{'show'} or $param{'show_all'}
2246 0 0 if $param{'sort'}
2247 0 0 if $param{'sr_detail'}
2249 0 0 if (exists $param{'limit'}) { }