Mojolicious 2.0: Modern Perl For the Web
Kvorg writes "After a year of rapid development, newly released version 2.0 of Mojolicious, the new generation real-time Perl web framework written by Sebastian Riedel and many others, offers a versatile and elegant web framework that is as good at web scraping and simple scripts as it is at building complex, interactive real-time applications with HTML5 and websockets. It supports easy 0-dependency installs, excellent developer mode, multiple deployment scenarios, many CPAN modules and plugins."
But is it prettier than regular Perl?
is perl dead, that slashdot denizens don't want to post even a "fristy prost" post...
Because clearly what we need is _yet another_ way to develop web applications.
Every time I look at a script I've written that's at least a year old, it's like the first time I've ever seen the code.
Not to take anything away from this framework, but now I'm curious since at first I took the post title too literally. Wasn't Ruby supposed to be modern Perl for the web? Whatever happened to that? People get bored? Web developer ADHD?
Web development is already "fun" with the likes of Django, Rails (not a favourite of mine but I see the appeal) and my personal favourite: Pylons/Pyramid.
I don't really get the desire to use Perl. I haven't touched Perl for a long time and can't think of any jobs where it would be the best tool. It's ugly.
Sure, it's still better than PHP but then, what isn't?
Another perl web framework. I can't wait. I'm champing at the bit. /yawn
I use perl all the time, and have yet to run into a framework that actually saves time overall. They're generally designed by Unix guys who really don't want to think about web design any more than they have to - and it shows.
#DeleteChrome
So true! Even if you use strict;, apply liberal comments, and avoid $_ and @_ whenever possible.
I hate you Perl.
If someone can make javascript look pretty, how about making perl pretty?
I suppose the idea is neat, but I personally don't have any particular applications where I need Perl to actually be the whole webserver for me. The things that do come to mind would involve a small system where there is no webserver installed, but going on port 80 would mean running the script with higher privileges and the whole mess of Perl and everything need to be jailed. Or maybe to try one of those utilities I heard about to pass privileged ports to an app, but I haven't had experience with those.
To be honest, frameworks left kind of a bad taste in my mouth when a language such as Ruby that had been around for years suddenly exploded when Ruby on Rails showed up. Everybody and their brother thought it was the new hip thing to use, until a lot of the bigger websites which had deployed it started to actually dump it due to limitations. Nobody wanted to take the time to write good code to start with, and it bit them in the butt.
Using frameworks (whether it's .NET or on the web or otherwise) usually starts out as a means to set up a new project quickly, but the problem is that they end up being an excuse to make sloppy bloated coat for the final product. Perl was always fast and efficient; people should learn to develop in it that way.
So how did the camel icon lose its head? Is it the new security to protect us from zombie camels?
I eat only the real part of complex carbohydrates.
Don't avoid $_ and @_; use them when they are useful, even in implicit form. Perhaps especially in explicit form.
What's more elegant?
or
or
I have seen far too much misguided code of the first and second type.
Have the comments explain what the purpose of the code is, not how it does it. The way to fix perl code isn't to read and understand the actual code, but replace the part that doesn't work as expected with code that does. If you understand your comment and know how to write perl, you don't really need to understand how a cryptic line does something - it's faster to rewrite it from scratch to do what you want.
Why loop when you can use a regex? Isn't that what perl is for?
Purrrrfect Perl! I salute you, my dear sir.
Excuse me, but please get off my Pennisetum Clandestinum, eh!
Err, I need to look at the preview before posting... There should be a $ in there
Anyone expecting users to run some random script from url (and not even https) using sudo is just fucking retarded.
I wonder if the rest of this framework is just as wonderfully secure as its installation method.
Indeed. While it's slower than "chomp while chomp", it doesn't depend on $/ being set correctly.
(If you can rely on $/, and you golf, s-$/+$-- is even shorter)
I've never understood exactly what people mean by "pretty" when it comes to code.
I assumed it meant easier to read but longer to write, but looking over some comments here, is it used as a synonym for "made it easier?"
I mean, I find perl ugly but only because I can't read it very well. Otherwise I find it elegant.
Wouldn't that be Perl6?
LMFAO - true, so true.
If you understand your comment and know how to write perl, you don't really need to understand how a cryptic line does something - it's faster to rewrite it from scratch to do what you want.
That assumes that the comment correctly describes what the code intends to do. This is a very big assumption to make and I've worked on numerous projects where the comments were significantly different from what the code did. Looking through the change logs, this situation always arises because someone updated the code but didn't bother to update the comments.
This brings me to my point: The code doesn't lie.
If you can't understand a piece of code, you're going to be working off assumptions. Refactoring code based on assumptions is dangerous unless you have very rigorous unit tests. I've found that the level of code obfuscation is negatively correlated with the quality (or even presence!) of unit tests. YMMV.
Mojolicious has releases almost every day. 2.0 is just 1.99 + 0.01.
So what's new? It's just a new release that break things, like almost every others...
The last time i fiddled with a Perl web framework was with Mason - i've been checking out Mojolicious and it looks really cool. It implements a lot of stuff that Django got right in a language that deserves more love than it usually receives.
Really cool stuff. I'll have to try it later at home.
I'm pretty much over it to be completely honest. To me modern Perl is Python. All the stuff you learn to hate about Perl just kind of goes away when you use Python. The only thing Perl really has going for it is CPAN. I have yet to find a programming language that has a resource that even compares to CPAN.
I just looked.
Though I'm an old time Perl coder; I like the look of Ruby with Sinatra better: http://www.sinatrarb.com/
WebDyne - another embedded Perl interpretation. See the examples here. Just a hobby project, but it scratches an itch - and makes active web pages easier for me to make at least ..
s/\s+$//s ?
What's more elegant?
(or mystring = mystring.rstrip('\r\n') if you're pedantic about only removing EOL chars)
Dewey, what part of this looks like authorities should be involved?
It is informed by catalyst, which I have found useful on a number of projects and I especially liked running with FastCGI. Complex page rendering logic to build a yahoo style web directory with under 0.2s per query. I waited for Mojolicious to mature and they say it is concise, has json xml parsing and rest built in.Using Perl 5.12 it sounfs like it is fun too. It looks like a quixk way to buld web services.
Totally apart from a pretty slick MVC framework the Mojolicious project has my undying affection for producing the mojo tool.
How many times have you wanted to scrape something out of a web page and you thought "I know, I'll use wget (or curl) and sed! Easy enough." so you write
# get story titles from slashdot
wget slashdot.org -O - 2>/dev/null | sed -e 's/uh, what now?//'
And then you get stuck fiddling with ever-crazier sed expressions to filter down to just the data you want? I know I've been there a dozen times and wound up with various unpleasant solutions or, when necessary, I've broken down and written a proper perl script which parses the HTML (and taken about 20 times as long as I planned to take to do it!) Maybe you try
And just go with it, because it's good enough. Well, no more! Now I can say
And have my results just like that!
Just as jQuery was a revolution in DOM scripting, to the point where I just won't write JS without it, so is mojo a revolution for these kinds of applications. I can now pull down pages and parse the actual structure and select just what I need. Beautiful.
I want my Cowboyneal
apply liberal comments
Don't do it - liberal comments always lie! Comment conservatively instead. ~