plu / Pithub

Perl Github v3 API

Home Page:http://metacpan.org/module/Pithub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow passing attributes to Pithub instance helpers

schwern opened this issue · comments

Sometimes it's useful to change an attribute just for one call. But the instance helpers don't take arguments, so you have to do it in two steps.

sub has_commits {
    ...
    my $commits = $p->repos->commits;
    $commits->per_page(1);
    return $commits->count;
}

If _create_instance took arguments it could use them to override the ones passed on from the parent object.

sub has_commits {
    ...
    return $p->repos->commits( per_page => 1 )->count;
}