-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trait idea: cursors #17
Comments
I like the idea, Rob. Sorry for the delay. Broke an arm last week which slowed me down considerably. Typing is a an exercise in frustration. I wonder if it might be better to have a my $tw = Twitter::API->new(...);
my $cursor = $tw->cursor(favorites => { tweet_mode => 'extended'});
while(my $tweet = $cursor->next) {
# process $tweet here...
} That way, it would work with any existing or new endpoint that uses cursors. Hmm. It may need a parameter to specify the name of the results array. That varies: ids, statuses, etc. It may be discoverable though. In any case, it's a good idea. You may want to mix code that uses the cursors with code that doesn't, so overriding |
Ouch, sorry to hear that! Get well soon!
Yeah, that's one thing that gaves me pause about a If I implemented this as a trait, I would have something like |
I just thought I'd follow up on this; I haven't had a chance to try this idea out, because amusingly enough my wife went into labor a hours after my last message, so time has been a little short for me lately! I did, however, have a thought about my idea of blessing a regular array into a cursor class - one drawback to that is if one uses Another potential issue is ordering of results - let's use |
Congratulations! Turns out I see Scalar::Util::RefType is deprecated and suggests Ref::Util instead. Twitter::API already has a dependency on Ref::Util, so we can readily use it. I'm still in hunt-and-peck mode. Cast comes off one week from today so hopefully, I'll become more useful soon. |
@semifor Right - I was thinking of offering a cursor-like abstraction that abstracts over details like whether something uses |
Hi there! I was thinking about implementing a new trait, and I wanted to see if you had any feedback on its design and whether it would be appropriate for inclusion with
Twitter::API
or it should be its own standalone thing.Basically, there are two things that I don't like about working with the Twitter API (not this module in particular - it's great! Just the API in general):
next_cursor
/cursor
system, some usesince_id
andmax_id
.I would much rather write code like this, which is more concise and less error prone:
The
$favorites
value would be a cursor object that you could use above, but could still be an array reference so that it's backwards compatible with traditional usage. What do you think?The text was updated successfully, but these errors were encountered: