Skip to content
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

Redesign to work with other user-agents #12

Open
oliwer opened this issue Mar 24, 2016 · 5 comments
Open

Redesign to work with other user-agents #12

oliwer opened this issue Mar 24, 2016 · 5 comments

Comments

@oliwer
Copy link

oliwer commented Mar 24, 2016

Hi,

After talking with @genio we thought it would be great if WWW::Shorten (and its plugins in particular) could become the universal way to shorten URLs in perl, which means it should work with any user-agent and both in blocking and non-blocking mode. That would be smarter than writing a shortener for each web framework out there.

So today I wrote a prototype : https://github.com/oliwer/www-shorten/tree/redesign

The most interesting change is the rewrite of the TinyURL plugin :

  • it does not depend on WWW::Shorten anymore
  • all the code depending on the user-agent has been removed
  • it is a lot shorter and simpler than the original
  • it can be used with non-blocking frameworks like Mojo or AnyEvent

All the WWW::Shorten code has been moved to the main package. The 'generic' and 'UserAgent' packages have been removed.

Anyway, tell me what you think.

@oliwer
Copy link
Author

oliwer commented Mar 25, 2016

Just look at how simple things can be! https://gist.github.com/oliwer/d1216099b998cff5c228

@oliwer
Copy link
Author

oliwer commented Mar 25, 2016

I have restored the generic and UserAgent package so that we are still compatible with the old API.

@genio
Copy link
Member

genio commented Apr 2, 2016

It looks good to me so far! I'm testing and trying to plan out a schedule to publish

@oliwer
Copy link
Author

oliwer commented Apr 4, 2016

Great! I will focus on tests and documentation then. A few questions though:

  • which function name do you prefer between shorterlink_start and shorterlink_request ?
  • do you plan to replace LWP by HTTP::Tiny one day?
  • do you know a way to get the email address of all WWW::Shorten plugin authors?

@genio
Copy link
Member

genio commented Apr 4, 2016

I'm in favor of brevity when naming functions shorter_start short_start etc. I'm flexible

It's absolutely in my list to change from LWP to HTTP::Tiny. I was hoping to get all ::Shorten service authors on board with this first.

As for their email addresses, what I've been doing thus far is to lookup all Shorten services on metacpan.org, find the author, and email them (there are less than 50 so it's not too terrible). I haven't had too great of a success rate on these. ::Bitly and ::Yourls are problematic as the author doesn't seem to have a valid email address anywhere. But, that's what the toolchain gang can help with once an appropriate amount of time has passed and proof of effort has been displayed.

If you're up for it, please feel free to contact Shorten service authors and see if they can pass off privileges. If we can get them all updated (and we don't break the current usage API) then I think we're ok.

Also, WWW::Shorten::Simple does nicen up the interface already. Maybe we can capitalize on that work some.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants