

A web service to unshorten short URLs, in modern Perl - jrockway
http://blog.jrock.us/articles/Unshortening%20URLs%20with%20Modern%20Perl.pod

======
jrockway
I posted this so that people can see what Perl applications actually look like
these days. A lot of folks here haven't looked at Perl since 1995, and assume
it's the same now as it was then. It's not :)

~~~
petercooper
Hang on, this _wasn't_ satire? I wasn't 100% sure so I came to see the
comments and.. it seems I'm wrong :)

~~~
jrockway
What did you think was satire? That variable names have dollar-signs in front
of them? Haha, that's so funny!

Next we'll hear that Lisp has parentheses.

~~~
petercooper
No, not the sigils, but the level of over-engineering just to get going. Look
at that first code example. Unintelligible or what. If this is where Perl's
going, I'm glad I ditched it several years ago.

~~~
jrockway
It's unintelligible to use a "class" keyword for defining classes?

~~~
petercooper
No.. why? Was that a joke? It's a poor show of one's convictions when one has
to resort to playground tactics to try and make someone look silly rather than
discuss something like an adult :(

------
andr
In modern Python:

    
    
        def expand_url(url):
            return urllib2.urlopen(url).geturl()

~~~
jrockway
Sure, now do that asynchronously (including DNS lookups) and add a web
frontend. Then you will have something close to what the article describes.

The equivalent to what you describe is:

    
    
        LWP::UserAgent->new->get($url)->request->uri

~~~
andr
Agreed, it is not the same, but I'm saying if I needed to resolve a shortened
URL, I would do it myself instead of sending an HTTP request to you so that
you can send an HTTP request on my behalf. At any rate, using your service
would be slower because of the extra roundtrip, and more unreliable.

However, I appreciate your post for enlightening what modern Perl looks like.
After a quick skim I thought I was looking at Rails.

~~~
jrockway
One advantage of my "service" is that if the URL redirector goes down, you
still have a chance at getting my cached copy.

The point of the article is not the service, but rather what the code looks
like. Returning "Hello world" is almost as instructive, but not quite, so I
chose a dumb example instead.

~~~
systems
which is also most definitely not just about having TryCatch and Class syntax

It's also about Kiouku , POE and Moose's Modern Object system. And how Perl5
is still evolving and being actively modernized.

