I'm trying to use Reddit::Client to get my reddit messages

The method is get_inbox() and that works just fine, but it only gets page one of the inbox. Logically, knowing what I know about Reddit, I should be able to add an after param to the args, and indeed looking at the source that seems right:

sub get_inbox { my ($self, %param) = @_; my $limit = $param{limit} || DEFAULT_LIMIT; my $mode = $param{mode} || MESSAGES_INBOX; my $view = $param{view} || MESSAGES_INBOX; my $query = {}; $query->{mark} = $param{mark} ? 'true' : 'false'; $query->{sr_detail} = $param{sr_detail} if $param{sr_detail}; $query->{before} = $param{before} if $param{before}; $query->{after} = $param{after} if $param{after}; [... more code snipped ...] }

But when I add an 'after' param to my call to the sub, nothing changes:  $reddit->get_inbox( [ view => MESSAGES_MESSAGES, after => 'reddit_id_here' ] );

Also wait, why are the params being sent in an array ref, not a hash or hash ref? And why when I do this to the actual source code of the module:

sub get_inbox { my ($self, %param) = @_; my $limit = $param{limit} || DEFAULT_LIMIT; my $mode = $param{mode} || MESSAGES_INBOX; my $view = $param{view} || MESSAGES_INBOX; ### I ADDED THIS CODE TO DEBUG: print Dumper(\%param); exit();

Does Data::Dumper show me an array which isundef? Shouldn't everything from the args be in a hash? Instead I get

$VAR1 = { 'ARRAY(0x7ffbb4ba2768)' => undef };

I've had quite a few Christmas drinks over the last few days, but I'm obviously missing something here. The documentation is wrong? The subroutine is failing to get the args into %param? TIA for anyone who can help me out!


In reply to Confused about Reddit::Client and how parameters are passed by Cody Fendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.