Branch Coverage

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


line true false branch
305 0 0 unless (exists $param{'user_agent'})
317 0 0 if ($param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
318 0 0 if (not $param{'username'}) { }
0 0 elsif (not $param{'client_id'} && $param{'secret'}) { }
332 0 0 unless $param{'client_id'} and $param{'secret'}
339 0 0 if $param{'username'}
345 0 0 if $param{'client_id'}
346 0 0 if $param{'secret'}
367 0 0 if (not $self->{'last_token'} or $self->{'last_token'} <= time - 3600 + 55)
401 0 0 if ($param{'username'} or $param{'password'}) { }
0 0 elsif ($param{'refresh_token'}) { }
402 0 0 unless $param{'username'} and $param{'password'} and $param{'client_id'} and $param{'secret'}
427 0 0 if ($self->{'auth_type'} eq 'script') { }
0 0 elsif ($self->{'auth_type'} eq 'webapp') { }
440 0 0 if (not $self->{'token'})
445 0 0 !$self->{'last_token'} || $self->{'last_token'} <= time - 3595 ? :
476 0 0 if ($method eq 'POST') { }
484 0 0 if $response
486 0 0 if (ref $json eq 'HASH' and $json->{'json'}) { }
488 0 0 if (@{$result->{'errors'};}) { }
509 0 0 unless defined $api
518 0 0 if ($method eq 'GET' or $method eq 'DELETE') { }
527 0 0 if (ref $result eq 'HASH' and exists $result->{'errors'})
530 0 0 if (@errors)
537 0 0 if (defined $callback and ref $callback eq 'CODE') { }
570 0 0 if lc $type eq 'home'
574 0 0 $type eq 'moderator' || $type eq 'contributor' || $type eq 'subscriber' ? :
630 0 0 $param{'mark'} ? :
631 0 0 if $param{'sr_detail'}
632 0 0 if $param{'before'}
633 0 0 if $param{'after'}
634 0 0 if (exists $param{'limit'}) { }
680 0 0 if ($page) { }
698 0 0 unless defined $id
707 0 0 if $rtn
744 0 0 if (substr($commentid, 0, 3) eq 't1_')
745 0 0 if (substr($post_fullname, 0, 3) ne 't3_')
777 0 0 if $subreddit
782 0 0 $subreddit ? :
801 0 0 unless @fullnames
814 0 0 unless $fullname
824 0 0 unless $fullname
828 0 0 unless $info
831 0 0 if ($param{'include_children'} and $cmt->{'permalink'})
844 0 0 if $param{'before'}
845 0 0 if $param{'after'}
846 0 0 if (exists $param{'limit'}) { }
850 0 0 $subreddit ? :
852 0 0 $subreddit ? :
911 0 0 unless $fullname
913 0 0 unless (ispost($fullname) or iscomment($fullname))
917 0 0 exists $param{'lock'} ? :
919 0 0 $lock ? :
932 0 0 unless $fullname
934 0 0 unless (ispost($fullname))
938 0 0 exists $param{'nsfw'} ? :
940 0 0 $nsfw ? :
970 0 0 if $param{'ban_message'}
972 0 0 if ($param{'reason'})
973 0 0 if (length $param{'reason'} > 100)
980 0 0 if ($param{'note'})
981 0 0 if (length $param{'note'} > 300)
988 0 0 if ($param{'duration'})
989 0 0 if ($param{'duration'} > 999) { }
0 0 elsif ($param{'duration'} < 1) { }
995 0 0 if $param{'duration'}
1005 0 0 if ($param{'mode'} eq 'mute') { }
0 0 elsif ($param{'mode'} eq 'contributor') { }
0 0 elsif ($param{'mode'} eq 'moderator_invite') { }
1069 0 0 if ($param{'mode'} eq 'mute') { }
1093 0 0 unless (iscomment($fullname) or ispost($fullname))
1097 0 0 if (iscomment($fullname))
1099 0 0 exists $param{'sticky'} ? :
1100 0 0 $sticky ? :
1108 0 0 if ($param{'how'})
1112 0 0 if ($param{'how'} eq $_)
1118 0 0 unless $ok
1132 0 0 unless (iscomment($fullname) or ispost($fullname))
1155 0 0 if $param{'custom_text'}
1156 0 0 if exists $param{'from_help_desk'}
1157 0 0 if exists $param{'from_modmail'}
1159 0 0 if $param{'modmail_conv_id'}
1160 0 0 if $param{'other_reason'}
1161 0 0 if $param{'reason'}
1162 0 0 if $param{'rule_reason'}
1163 0 0 if $param{'site_reason'}
1165 0 0 if $param{'sub'} or $param{'subreddit'}
1167 0 0 unless $id =~ /^t[0-9]_/
1172 0 0 if $param{'usernames'}
1201 0 0 $_->{'kind'} eq 't1' ? :
1236 0 0 if $param{'after'}
1237 0 0 $param{'limit'} ? :
0 0 exists $param{'limit'} ? :
1240 0 0 if ($subs)
1241 0 0 if ref $subs eq 'ARRAY'
1242 0 0 if $subs
1269 0 0 exists $param{'hide_author'} ? :
0 0 exists $param{'isAuthorHidden'} ? :
1271 0 0 $auth ? :
1274 0 0 if (length $subj > 100)
1289 0 0 if (ref $result eq 'HASH')
1302 0 0 if ($opt{'num'})
1303 0 0 if ($opt{'num'} =~ /^[1234]$/) { }
1310 0 0 $opt{'sticky'} ? :
0 0 exists $opt{'sticky'} ? :
1311 0 0 $opt{'to_profile'} ? :
0 0 exists $opt{'to_profile'} ? :
1329 0 0 unless $action and $id
1345 0 0 if ($action eq $_)
1350 0 0 unless $api
1366 0 0 if ($length == 3 or $length == 7 or $length == 28) { }
0 0 elsif ($length != 72 and $length != 168 and $length != 672) { }
1398 0 0 if (not $odd or $_[0] eq 'user' or $_[0] eq 'username' or $_[0] eq 'view') { }
1424 0 0 if ($view eq 'about')
1434 0 0 $_->{'kind'} eq 't1' ? :
1446 0 0 if $type ne 't1' and $type ne 't3'
1447 0 0 unless defined $text
1463 0 0 unless $name
1465 0 0 if $type ne 't1' and $type ne 't3'
1483 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1484 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1485 0 0 $param{'nsfw'} ? :
0 0 exists $param{'nsfw'} ? :
1510 0 0 if lc substr($source_id, 0, 3) ne 't3_'
1512 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1513 0 0 $param{'repost'} ? :
0 0 exists $param{'repost'} ? :
1536 0 0 $param{'inbox_replies'} ? :
0 0 exists $param{'inbox_replies'} ? :
1575 0 0 $param{'text'} ? :
1579 0 0 if $text
1580 0 0 if $css_class
1598 0 0 $param{'text'} ? :
1603 0 0 if $text
1604 0 0 if $css_class
1653 0 0 if (not $post_id || $param{'username'}) { }
0 0 elsif ($post_id) { }
1661 0 0 if ($textcol)
1663 0 0 if ($textcol ne 'light' and $textcol ne 'dark')
1670 0 0 if $param{'background_color'}
1671 0 0 if $param{'css_class'}
1673 0 0 if $post_id
1674 0 0 if $param{'username'}
1675 0 0 if $param{'return_rtjson'}
1676 0 0 if $textcol
1724 0 0 if ($post_id) { }
0 0 elsif ($user) { }
1740 0 0 if ($result->{'choices'})
1742 0 0 $result->{'choices'}[$i]{'flair_text_editable'} ? :
1793 0 0 if $param{'background_color'}
1796 0 0 $param{'mod_only'} ? :
0 0 exists $param{'mod_only'} ? :
1797 0 0 $param{'text_editable'} ? :
0 0 exists $param{'text_editable'} ? :
1800 0 0 if ($textcol)
1802 0 0 if ($textcol ne 'light' and $textcol ne 'dark')
1810 0 0 if ($bg and substr($bg, 0, 1) ne '#')
1813 0 0 if $param{'allowable_content'}
1814 0 0 if $bg
1815 0 0 if $param{'css_class'}
1816 0 0 if $param{'max_emojis'}
1818 0 0 if $flairid
1821 0 0 if exists $param{'mod_only'}
1823 0 0 if $param{'override_css'}
1824 0 0 if $param{'text'}
1825 0 0 if $textcol
1826 0 0 if exists $param{'text_editable'}
1846 0 0 if $param{'v'}
1847 0 0 if $param{'v2'}
1855 0 0 $param{'data'} ? :
1866 0 0 defined $param{'content'} ? :
1868 0 0 if (length $content > 524288)
1876 0 0 if ($previous)
1877 0 0 if ($reason)
1896 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'}) { }
1919 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1934 0 0 $param{'limit_children'} ? :
0 0 exists $param{'limit_children'} ? :
1937 0 0 if (ref $children eq 'ARRAY') { }
1939 0 0 unless $ids
1951 0 0 if $param{'sort'}
1952 0 0 if $param{'id'}
1962 0 0 if ($cmt->{'kind'} eq 't1') { }
0 0 elsif ($cmt->{'kind'} eq 'more') { }
1980 0 0 unless ispost($parent_id) or iscomment($parent_id)
2007 0 0 if length $subject > 100
2028 0 0 unless defined $name
2029 0 0 unless defined $direction
2030 0 0 unless ispost($name) or iscomment($name)
2031 0 0 unless "$direction" =~ /^(-1|0|1)$/
2043 0 0 unless ispost($name) or iscomment($name)
2051 0 0 unless ispost($name) or iscomment($name)
2059 0 0 unless ispost($name)
2067 0 0 unless ispost($name)
2088 0 0 if (length $model->{'display_name'} > 50)
2090 0 0 if $param{'description'}
2092 0 0 if ($param{'icon_name'})
2097 0 0 if $i eq $model->{'icon_name'}
2100 0 0 unless ($match)
2103 0 0 if ($param{'key_color'})
2105 0 0 if (length $model->{'key_color'} != 7)
2108 0 0 if ($param{'visibility'})
2110 0 0 if ($model->{'visibility'} ne 'private' and $model->{'visibility'} ne 'public' and $model->{'visibility'} ne 'hidden')
2117 0 0 if ($param{'weighting_scheme'})
2119 0 0 if ($model->{'weighting_scheme'} ne 'classic' and $model->{'weighting_scheme'} ne 'fresh')
2122 0 0 if ($param{'subreddits'} or $param{'subs'})
2124 0 0 if (ref $param{'subreddits'} ne 'ARRAY')
2136 0 0 $param{'edit'} ? :
2147 0 0 $param{'expand'} ? :
2192 0 0 if substr($id, 0, 3) ne $type . '_'
2196 0 0 $_[0] ? :
2210 0 0 if $name
2213 0 2 if ($DEBUG)
2228 0 0 if (not $subject =~ m[/]) { }
2229 0 0 if ($subject eq '') { }
2244 0 0 if $param{'before'}
2245 0 0 if $param{'after'}
2246 0 0 if $param{'only'}
2247 0 0 if $param{'count'}
2248 0 0 if $param{'show'} or $param{'show_all'}
2249 0 0 if $param{'sort'}
2250 0 0 if $param{'sr_detail'}
2252 0 0 if (exists $param{'limit'}) { }