aggrolite / Mojo-Snoo

Mojo wrapper for the Reddit API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lazy attributes should trigger HTTP request

aggrolite opened this issue · comments

I can make objects directly from subclasses. For example:

my $link = Mojo::Snoo::Link->new('38pdo9');

However, the only attribute available so far, since no HTTP request has been made, is id.

say $link->id; # 38pdo9
say $link->author; # Can't locate object method "author" via package "Mojo::Snoo::Link"

Since I'd like to keep everything lazy, there needs to be a way for these attributes to trigger a HTTP request. This also brings up some other topics, such as how often should these lazy attributes be refreshed (if at all)?