Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Mojolicious 2.0: Modern Perl For the Web

Soulskill posted more than 2 years ago | from the new-and-shiny dept.

Perl 132

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."

cancel ×

132 comments

Sorry! There are no comments related to the filter you selected.

Syntax (1)

colinrichardday (768814) | more than 2 years ago | (#37746560)

But is it prettier than regular Perl?

Re:Syntax (1)

draven (387) | more than 2 years ago | (#37747464)

It's very pretty. Look on the homepage to see an example.

no post = dead (0)

Anonymous Coward | more than 2 years ago | (#37746566)

is perl dead, that slashdot denizens don't want to post even a "fristy prost" post...

Re:no post = dead (1)

ferongr (1929434) | more than 2 years ago | (#37746576)

Netcraft confirms that Perl is dead.

Re:no post = dead (2)

bragr (1612015) | more than 2 years ago | (#37746584)

Says the AC posting on a site written in perl.

Yet Another (2)

bragr (1612015) | more than 2 years ago | (#37746574)

Because clearly what we need is _yet another_ way to develop web applications.

Re:Yet Another (0)

Anonymous Coward | more than 2 years ago | (#37746738)

I just need recongnition, Wikipedia entry, book at Amazon, TShirt shop at the site, you know... to be somebody online, really need that job at Google. That syntax is not really meant to be readable, it is just so it looks academic and a bit blurry for the mob, so they be willing to buy my book..

Re:Yet Another (3, Insightful)

grcumb (781340) | more than 2 years ago | (#37746932)

Because clearly what we need is _yet another_ way to develop web applications.

Frankly, yes. As long as we're advancing and improving, yeah, it always makes sense to keep trying new approaches. I'm using Mojolicious for two apps currently in development. One of them was already in progress using other modules, bit with the Mojolicious::Lite module, I was able to cut my code base nearly in half.

I'll tell you what - why don't.you try it first, then complain about it if you still don't like it.

Re:Yet Another (1)

Serious Callers Only (1022605) | more than 2 years ago | (#37747432)

Because clearly what we need is _yet another_ way to develop web applications.

Well, why not?

Doesn't matter to the end users what language was used for the back-end, and some programmers will be more familiar or comfortable with Perl. Maybe you don't need this, and I personally have no intention of using it, but some people might find it interesting.

Re:Yet Another (0)

Anonymous Coward | more than 2 years ago | (#37747806)

Yeah. Fuck innovation!

Re:Yet Another (1)

drinkypoo (153816) | more than 2 years ago | (#37748104)

I still can't figure out how it's actually called. If it lets you use mod_perl then it has a reason to exist. But it probably doesn't.

Re:Yet Another (2)

drjones78 (961270) | more than 2 years ago | (#37748590)

mod_perl is out - no reason to use it any more, especially since its tied explicitly to Apache. Yuk. Who wants to write a web app that requires a specific web server?

Mojo runs on PSGI, like most new generation web frameworks for perl. Its similar to WSGI (Python).

There's some really cool stuff happening in the PSGI world. Check out Plack [plackperl.org] .

Re:Yet Another (4, Informative)

MadMartigan2001 (766552) | more than 2 years ago | (#37748602)

Mojolicious is a complete HTTP 1.1 stack. No mod_perl required. It has its own built in webserver, hypnotoad which can be used in production. You can install Mojolicous with a single curl command

sudo sh -c "curl -L cpanmin.us | perl - Mojolicious"

And three lines can make a complete "hello world" application....

use Mojolicious::Lite;
get '/' => {text => 'Hello World!'};
app->start;

Part of what make Mojolicous so powerful is Perl's syntax and expressiveness. I know it's hip to beat up on Perl these days, but perl is still way ahead of most languages in its ability to be expressive. The author of Mojolicous is a really good programmer and insanely picky about well structured code, consistency and test driven development. Hence, the framework is very easy to use and understand. This framework is definitely worth a look.

Re:Yet Another (1)

larry bagina (561269) | more than 2 years ago | (#37749502)

Wow, let's run a perl script from a random website, site unseen. Even better, let's run it with root permissions. What could possibly go wrong?

Re:Yet Another (1)

geminidomino (614729) | more than 2 years ago | (#37749900)

Okay then.

$ curl -L cpanmin.us > poison_pill.txt
$ vi poison_pill.txt

Voila.

Re:Yet Another (2)

Just Some Guy (3352) | more than 2 years ago | (#37750514)

I know it's hip to beat up on Perl these days, but perl is still way ahead of most languages in its ability to be expressive.

But far behind the languages that it's competing with in this space. There's a reason why literally ever Perl programmer I know has migrated to Ruby or Python.

I'd much rather write a web app in Perl than C or Pascal. And by roughly the same margin, I'd much rather write the same app on Rails or Django or Pyramid.

Re:Yet Another (1)

drinkypoo (153816) | more than 2 years ago | (#37750446)

OIC. Well that is nifty I guess, although frankly, I would prefer something that I could use with Apache, because I already use Apache, and nonstandard ports suck. I guess if you're doing anything real you can probably dedicate a box.

Re:Yet Another (0)

Anonymous Coward | more than 2 years ago | (#37748956)

It's shit like this that gets modded up on here that has led me to spend more and more time on Hacker News.

Re:Yet Another (0)

Anonymous Coward | more than 2 years ago | (#37750762)

What would Dennis Ritchie do?

Perl is the most refreshing programming language (5, Funny)

Anonymous Coward | more than 2 years ago | (#37746604)

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.

Re:Perl is the most refreshing programming languag (1)

nullchar (446050) | more than 2 years ago | (#37746676)

So true! Even if you use strict;, apply liberal comments, and avoid $_ and @_ whenever possible.

Re:Perl is the most refreshing programming languag (4, Informative)

arth1 (260657) | more than 2 years ago | (#37747080)

Don't avoid $_ and @_; use them when they are useful, even in implicit form. Perhaps especially in explicit form.

What's more elegant?

# Declare variable $mystring
my($mystring);
# Get rid of $_
$mystring = $_;
# Strip line endings from string
# We use chomp because it will only delete CR and LF,
# unlike chop which will delete any character.
$mystring =~ chomp($mystring);
# We do it twice in case the string ended in CR+LF
# which is common in MSDOS
$mystring =~ chomp($mystring);

or

require 5.9.0; # avoid ugly $foo =~ chop $foo
my $mystring = $_;
# Strip newlines
while ($mystring =~ m/[\r\n]$/) {
  # String has CR or LF at end, strip it
  chop $mystring;
}

or

# chop any number of CR and LF from end of string:
chomp while chomp;

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.

Re:Perl is the most refreshing programming languag (0)

Anonymous Coward | more than 2 years ago | (#37747234)

Why loop when you can use a regex? Isn't that what perl is for?

# chop any number of trailing CR/LF:
s/[\r\n]+//;

Re:Perl is the most refreshing programming languag (1)

flyingfsck (986395) | more than 2 years ago | (#37747252)

Purrrrfect Perl! I salute you, my dear sir.

Re:Perl is the most refreshing programming languag (0)

Anonymous Coward | more than 2 years ago | (#37747264)

Err, I need to look at the preview before posting... There should be a $ in there

# chop any number of trailing CR/LF:
s/[\r\n]+$//;

Re:Perl is the most refreshing programming languag (2)

arth1 (260657) | more than 2 years ago | (#37747522)

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)

Assumptions (5, Insightful)

CadentOrange (2429626) | more than 2 years ago | (#37748418)

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.

Re:Perl is the most refreshing programming languag (0)

Anonymous Coward | more than 2 years ago | (#37750464)

s/\s+$//s ?

Re:Perl is the most refreshing programming languag (2)

Just Some Guy (3352) | more than 2 years ago | (#37750574)

What's more elegant?

mystring = mystring.rstrip()

(or mystring = mystring.rstrip('\r\n') if you're pedantic about only removing EOL chars)

Re:Perl is the most refreshing programming languag (0)

Anonymous Coward | more than 2 years ago | (#37748288)

LMFAO - true, so true.

Wasn't that supposed to be Ruby? (2, Interesting)

Sarusa (104047) | more than 2 years ago | (#37746624)

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?

Re:Wasn't that supposed to be Ruby? (1)

furbearntrout (1036146) | more than 2 years ago | (#37746864)

Yes [jwz.org] .

Re:Wasn't that supposed to be Ruby? (1, Interesting)

Anonymous Coward | more than 2 years ago | (#37747122)

Hard to do serious web apps in a language that can't even handle the basics of unicode.

And once you got past scaffolding, rails turned out to be a toy MVC framework that 1) monkeypatches base classes and breaks other libraries, 2) has a toy ORM that can't generate joins properly, and 3) has a template language that basically amounts to script-in-page.

Re:Wasn't that supposed to be Ruby? (2)

Kagetsuki (1620613) | more than 2 years ago | (#37747988)

Sounds like you haven't touched Rails in 10 years. It handles unicode extremely well now, arguably better than any other framework out there, and even has an extended set of localization options that are way more accessible than probably anything else. As for your other arguments:
1. Monkey patching is dangerous in any language - luckily with modern Rails there is significantly less need for it and it's generally discouraged
2. ?? Sounds like you were doing something wrong
3. You don't understand what the C in MVC means, do you?

Re:Wasn't that supposed to be Ruby? (1)

Rysc (136391) | more than 2 years ago | (#37750686)

Sounds like you haven't touched Rails in 10 years. It handles unicode extremely well now, arguably better than any other framework out there,

I invite you to consult Unicode: Good, Bad, Ugly [98.245.80.27] and then make that statement again. Full disclosure: Yes, it was written by a Perl guy, but I've not seen any dispute about the facts.

Re:Wasn't that supposed to be Ruby? (1)

Anonymous Coward | more than 2 years ago | (#37748318)

That's pretty outdated, although I see where it's come from. Most of the issues arise from the old versions on Ruby in use - the ones with shoddy Unicode support, and which require patching of the base classes to gain useful functionality.

The ORM can now be swapped out (and new versions of ActiveRecord/Arel have made queries much more fun).

The older erb templates are not the prettiest (though if you're doing PHP style script-in-page, you're using the tools wrong) - but using something like Haml is much, much better.

One of the problems people have with Rails is that if you try to fight against the framework you'll not get very far. Either go with it, or use the tools that are available for letting you perform tasks outside the norm. Trying to repurpose the "opinionated" tools is the wrong approach, and you should just use something simpler (Sinatra?)

Re:Wasn't that supposed to be Ruby? (0)

Sarusa (104047) | more than 2 years ago | (#37747538)

Oh for fuck's sake. I get moderated down for asking a serious question? I really do want to know. What the hell is wrong with you people? I apologize if I stepped on the tail of a Ruby diehard, but the bloom is off the rose and I am curious why.

Re:Wasn't that supposed to be Ruby? (3, Insightful)

RDW (41497) | more than 2 years ago | (#37747772)

You can write 'Modern Perl' in the sense used here without switching to an entirely different language:

http://www.onyxneon.com/books/modern_perl/index.html [onyxneon.com]

Re:Wasn't that supposed to be Ruby? (1)

Kagetsuki (1620613) | more than 2 years ago | (#37748002)

Rails 3.1 is just coming out and offers some really, really nice features. Rails use is becoming more and more wide spread, and there are even hosts and cloud services that focus on it specifically (EG; Heroku).

Re:Wasn't that supposed to be Ruby? (0)

Anonymous Coward | more than 2 years ago | (#37748128)

Actually, it isn't becoming more widespread at all. According to the tiobe index it's been in steady decline since 2009.

Re:Wasn't that supposed to be Ruby? (2)

CadentOrange (2429626) | more than 2 years ago | (#37748458)

Ruby has been in decline. Interestingly, so have PHP and Python. At it's peak in 2009, Ruby barely exceed's Python's current usage.

Ruby: http://www.tiobe.com/index.php/paperinfo/tpci/Ruby.html [tiobe.com]

Python: http://www.tiobe.com/index.php/paperinfo/tpci/PHP.html [tiobe.com]

PHP: http://www.tiobe.com/index.php/paperinfo/tpci/Python.html [tiobe.com] .

"Web development can be fun again" (1)

neonmonk (467567) | more than 2 years ago | (#37746634)

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?

Re:"Web development can be fun again" (2)

nullchar (446050) | more than 2 years ago | (#37746704)

The only exciting part of this new Mojolicious is to expand on a bunch of Perl web stuff you might already maintain. I don't have any large apps (like slashdot), but many "single page" type applications that process data or serve up custom reports. The simple pages simply flush stdout so when displaying long output appear speedy to the user. Others use some javascript and cludgy .html() replacements. Websockets and json support would be nice when extending these applications where the "bulk" of the code written in plain Perl doesn't need to be modified.

Re:"Web development can be fun again" (2)

arth1 (260657) | more than 2 years ago | (#37746834)

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.

String parsing and massaging.
Hashes.

Also, system administration. Like sed and awk, perl should be in most sysadmins' arsenal, seeing daily use.
Want to replace all occurrences of foo with bar in all files, while making a backup?

perl -pi.bak -e 's/foo/bar/g' *

What perl is not good for, and frequently is abused for is providing multiple layers of abstraction. You burn memory at an alarming rate, and your code becomes even harder to maintain by "simplifying" it. If good perl code looks cryptic, add comments!

Re:"Web development can be fun again" (3, Insightful)

Anrego (830717) | more than 2 years ago | (#37746960)

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.

It's still _the_ tool for quick one-off type stuff. I know of no other tool that lets you just mash data together and produce something useful as easily and quickly as perl. That said, I'd never use it for a serious application or anything that had to be maintained for more than a few weeks. Those days are gone.. maintainability and reliability are king.

Re:"Web development can be fun again" (2, Informative)

Anonymous Coward | more than 2 years ago | (#37747088)

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.

It's still _the_ tool for quick one-off type stuff. I know of no other tool that lets you just mash data together and produce something useful as easily and quickly as perl. That said, I'd never use it for a serious application or anything that had to be maintained for more than a few weeks. Those days are gone.. maintainability and reliability are king.

Well the really smart guys that figure out DNA started using it. Many startups use it. I've used it pretty much everywhere I've gone and it's leaps and bounds above what I find in use in most places. It's huge in Japan. It was the favorite language of the guy who created Ruby, he just wanted more.

So yeah no serious application or anything that had to be maintained, no never that, because how could anyone possibly write maintainable Perl. Instead you should use a programming language where maintainability and reliability are king, that language of course is ...???

By the way Slashdot the not so serious site you are on is written in Perl.

Re:"Web development can be fun again" (1)

outsider007 (115534) | more than 2 years ago | (#37747850)

Perl is for really old guys, period. If you're under 45 you're using python or ruby.

Re:"Web development can be fun again" (0)

Anonymous Coward | more than 2 years ago | (#37747986)

Yes, the old guys had their share of position-is-part-of-the-syntax by having used COBOL.

Re:"Web development can be fun again" (1)

sqldr (838964) | more than 2 years ago | (#37748682)

python isn't. colon starts a block. unindent ends the block. you can indent with what you like.

Re:"Web development can be fun again" (1)

geminidomino (614729) | more than 2 years ago | (#37749982)

unindent ends the block

And that's not "position-is-syntax"... how, again?

Re:"Web development can be fun again" (1)

Anrego (830717) | more than 2 years ago | (#37750148)

That, uh, would seem to be the definition of position being part of the syntax. Unless I'm missing something...

Re:"Web development can be fun again" (1)

sqldr (838964) | more than 2 years ago | (#37750338)

don't you indent your code? The position is implied, even in perl. If you're indenting properly, then the closing brace becomes redundant.

Re:"Web development can be fun again" (1)

Anrego (830717) | more than 2 years ago | (#37750492)

Didn't say it was a bad thing (although I don't like it.. I find those redundant braces do add clarity for some reason.. ), still doesn't change the fact that in python, indenting is part of the syntax, whereas in other languages is just a good idea.

Re:"Web development can be fun again" (1)

sqldr (838964) | more than 2 years ago | (#37750778)

I guess. Then again, if your blocks in python are more than 3 or 4 lines long, then you're probably doing something wrong. It's referred to derogatively in python-land as "potato programming". Stuff like functools/itertools and list comprehensions are useful for avoiding "indent hell" where the indent becomes longer than the page and you start to lose track of where it all started. I hardly ever use if/for statements. It tries to encourage you to use it as a functional language rather than a procedural one.

Re:"Web development can be fun again" (2)

zippthorne (748122) | more than 2 years ago | (#37748484)

Your example of Perl is Slashcode? I'm not sure that has the desired affect on the audience...

Re:"Web development can be fun again" (2)

Anrego (830717) | more than 2 years ago | (#37749138)

Never said it _hasn't_ been used to write something maintainable.. just that I wouldn't use it for that (any more.. ).

Yes you can write maintainable code in perl if you make a specific effort to do so, but to me that defeats the point. It's primarily a hack and slash language that lets you crank out code while you think. To me writing maintainable perl is like writing a quick one-off script in c++ or java. Yes you can do it, but why bother. Use the tool that is suited for the task.

And the DNA thing is a perfect example of the kind of "we need an answer to this question, then don't care about the code afterwards" situations where perl is king.

Re:"Web development can be fun again" (0)

Anonymous Coward | more than 2 years ago | (#37747532)

python

non cryptic and has all the good stuff that perl has too.

Re:"Web development can be fun again" (2)

Jimmy King (828214) | more than 2 years ago | (#37749178)

Perl can be as easy to read and maintain as the developer can be bothered to make it. Sloppy Perl is written by sloppy developers. It has proper variable scoping, namespacing, packages, object inheritance, etc. You also don't have to squeeze as much functionality into one line using as many special characters as possible.

Sure, there's plenty of ugly Perl out there. I suspect much of that is stuff that started as a small, quickly hacked together script which grew into something larger. Perl also used to hold PHP's place as THE language to use for web back end stuff, so it had a lot of amateur devs doing stupid crap. I can find you awful code in any language you want, though. I've got some crazy Python in front of me right now.

I'm not saying it's the best language to use anymore, but it's not even 1/4 as bad as people like to make it out to be around here. Plus many of its libraries are still easier to use and have more functionality than the equivalent libraries in other more popular languages (opinions on that may vary, of course). LWP is still my favorite web client library.

Re:"Web development can be fun again" (1)

MadMartigan2001 (766552) | more than 2 years ago | (#37749540)

If you like LWP, you should check out the UserAgent for Mojolicous along with its CSS dom selectors and other goodies. Amazing stuff.

Re:"Web development can be fun again" (2)

Anrego (830717) | more than 2 years ago | (#37749644)

I agree that it's possible to write maintainable perl, but from my vantage point, perl is not really designed for this.

To me it's more of a hack n` slash language. Code while you think. All those shortcuts and lack of boilerplate code and ability to just say "take this data, compare it with this, and do whatever" in a few lines is to me perl's strength. The fact that the resultant code is hard to read is the weakness. If you are not going to do that, and write code in a more rigid, designed manner to avoid this, why use perl in the first place? To me it's like writing a quick one-off type script in c++.. you can do it, but why would you want to? For the libraries as you said maybe.

The argument that it's not the tools it's the developer stands, however I do think some tools are more oriented towards maintainability (java, c++) and others towards rapid development (perl). You get ugly code in every language, but perl almost directly encourages it. The CPAN tool is _the_ definition of perl. Works, but oh my god is this code or cyphertext!

Re:"Web development can be fun again" (1)

Jimmy King (828214) | more than 2 years ago | (#37751130)

Yeah, I think we mostly agree. I agree that it's not the best option anymore except for the super short stuff, although I'd keep using it for nearly everything if I could. I just don't feel it's terrible for the big stuff and definitely not as terrible as its reputation would suggest. Some would argue that even enabling such hard to maintain code to be written in the first place is is just as bad, but I see it as flexibility with a tradeoff. You can write harder to read/maintain, really short scripts to do something quickly or slightly more verbose code, but still way shorter than Java or C++, which is maintainable and viable for use in a larger system.

Part of why I've moved on to Python (as opposed to Ruby, the other big contender as a Perl replacement) is that it feels somewhat like a more modern Perl (and Perl's object model is actually based on Python's, I believe). Some day I may do some side by side comparisons of Python vs Perl code length (although I bet someone else already has) using properly written, maintainable Perl. I don't expect there to be a huge difference in number of lines.

Re:"Web development can be fun again" (1)

Rysc (136391) | more than 2 years ago | (#37750896)

This a thousand times.

The purpose I see for Mojolicious is to provide an alternative to PHP, not Ruby, Python, etc.. If we can get people to use Mojolicious over PHP then when their project becomes a big deal it's easier to manage and maintain.

Re:"Web development can be fun again" (1)

SailorMeeko (204259) | more than 2 years ago | (#37749248)

That said, I'd never use it for a serious application or anything that had to be maintained for more than a few weeks. Those days are gone.. maintainability and reliability are king.

I created an entire social networking site in Perl, called World of Anime [worldofanime.com] , using the Catalyst Web Framework. I'd consider it serious, at least for me, and have been maintaining it for way more than a few weeks.

Re:"Web development can be fun again" (1)

Anrego (830717) | more than 2 years ago | (#37749714)

I created an entire social networking site in Perl

Not saying people don't use it, or that it's impossible to write maintainable code with it (or any other language), just that it wouldn't be my first choice. Perl doesn't force you to write messy unreadible code, but it does heavily encourage it, and to me writing rigid perl kind of defeats (in my view) the point of perl.

All that said, when it comes to web programming languages you don't exactly have a great set of choices.

and have been maintaining it for way more than a few weeks.

I guess the question would be, is it just you maintaining it. Would someone else be able to come in and pick up where you've left off. This to me is perls huge weakness. Languages like c++, and to an extreme degree java, you can have someone come in and start working. It takes a much longer time to grok perl code.

Re:"Web development can be fun again" (0)

Anonymous Coward | more than 2 years ago | (#37749746)

It's still _the_ tool for quick one-off type stuff. I know of no other tool that lets you just mash data together and produce something useful as easily and quickly as perl. That said, I'd never use it for a serious application or anything that had to be maintained for more than a few weeks. Those days are gone.. maintainability and reliability are king.

It's always incredible to read this kind of comment. A good programmer will write maintainable code in any language. A bad programmer will deliver a mess in any language, whatever its level of sophistication.

Re:"Web development can be fun again" (1)

Anrego (830717) | more than 2 years ago | (#37750110)

You can write a web server in VB6 if you want to, doesn't mean you should.

Perl doesn't force you to write ugly code, and with effort you can write maintainable code, but to me perl isn't designed for this. Perl is a hack and slash language, if you are going to stick to rigid designed code, why use perl in the first place.

Re:"Web development can be fun again" (2)

grcumb (781340) | more than 2 years ago | (#37746976)

I won't defend Perl's syntactical constructs; either you like the fluidity of the language or you don't. But Mojolicious is a modern, useable framework, far superior in important ways to Django.

For my part, I find it remarkably easy to implement RPC calls, CRUD especially, using this framework. Go to CPAN, read the Mojolicious::Lite exampes and decide for yourself whether it's worth your while.

Re:"Web development can be fun again" (2)

AlXtreme (223728) | more than 2 years ago | (#37747726)

By the looks of it Mojolicious does support stuff plain Django doesn't pay much attention to or leaves to the webserver (long polling for instance). Useful!

Then again, Mojolicious doesn't have a built-in ORM or input-validation via forms. Together with URL handling and the request/response loop these are the basic building blocks in Django.

So 'superior in important ways' depends on what you find important. I'm guessing 99% of Django users beg to differ.

Re:"Web development can be fun again" (0)

Anonymous Coward | more than 2 years ago | (#37747770)

Why would you want a built-in ORM? DBIx::Class is only a CPAN download away.

I'm serious. What is it with modern programmers wanting 'everything-but-the-kitchen-sink' frameworks? What happened to modularity?

Mart (AC because I'm moderating in this thread)

Re:"Web development can be fun again" (2)

CadentOrange (2429626) | more than 2 years ago | (#37748474)

What happened to modularity?

Django advocates loose coupling between it's modules. You can easily use Django's ORM in a non-Django app, or use a different ORM (e.g. SQLAlchemy) in a Django app. Having said that, I've found that the Django ORM is nice and intuitive if you're a programmer (like me!) and really want to avoid working with SQL directly while SQLAlchemy caters to people who are more comfortable with SQL.

Re:"Web development can be fun again" (1)

grcumb (781340) | more than 2 years ago | (#37747994)

I won't. say you're wrong, but I will say that building asynchronous apps using CRUD and the like is remarkably easy. I have friends who swear by Django, so I'm not blind to its appeal. Mojolicious has different areas of emphasis and the things it does, it does exceptionally well. URL handling in Mojo is simple and elegant, but I simply don't know enough about Django's input validation to comment.

Re:"Web development can be fun again" (1)

Lisandro (799651) | more than 2 years ago | (#37749108)

Much agreed - this is one of the things Django does very well. Having said that, i think the model handling part of Django is it's weaker point. If you need to do anything remotely complex regarding persistance it gets too much in the way.

But yes. Most of the time, having a CRUD interface built automatically from the model it's a Godsend.

Oh boy (2, Insightful)

93 Escort Wagon (326346) | more than 2 years ago | (#37746674)

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.

Re:Oh boy (1)

draven (387) | more than 2 years ago | (#37747486)

I think you are wrong there. Sebastian actually cares about the web. http://mojolicio.us/ was designed by the author of the framework himself, and as you can see it's not your typical Perl project home page. He even drew all the artwork.

Let's be hatin' on Perl! (0)

Anonymous Coward | more than 2 years ago | (#37746746)

I hate you Perl.

Make a CoffeeScript for Perl (0)

Anonymous Coward | more than 2 years ago | (#37746802)

If someone can make javascript look pretty, how about making perl pretty?

Re:Make a CoffeeScript for Perl (1)

maxwell demon (590494) | more than 2 years ago | (#37746948)

Isn't Perl 6 intended to do that? At least it finally gets rid of changing sigils by context. Which is probably the most confusing "feature" of Perl.

Re:Make a CoffeeScript for Perl (1)

Anonymous Coward | more than 2 years ago | (#37746992)

Like putting makeup on a .... Hydra? Giyagas? Fuck, I don't know, but it still isn't pretty pretty.

Re:Make a CoffeeScript for Perl (1)

TheLink (130905) | more than 2 years ago | (#37750310)

I don't need perl pretty. You want pretty, you write perl programs in a pretty style, or switch to python or something else.

But if they can make perl as fast as the fastest javascript that would be very nice.

Useful for just certain applications (3, Insightful)

FyberOptic (813904) | more than 2 years ago | (#37746926)

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.

Re:Useful for just certain applications (3, Interesting)

skazatmebaby (110364) | more than 2 years ago | (#37747024)

If I'm reading the docs correctly, the webserver part of Mojolicious is optional:

http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#DEPLOYMENT [mojolicio.us]

It also supports a pretty substantial list of alternatives to its build in web server. Want to only run it as a CGI script? Then do that. Run your app as a PSGI script? Yeah, you can do that too. Started as a CGI script by now need a lot more HP? Not so hard to move what you started on something simple to something with a little more Umph.

So that's I guess, "neat"

Re:Useful for just certain applications (1)

drjones78 (961270) | more than 2 years ago | (#37748610)

PSGI is like Python's WSGI or Ruby's rack, and is what Mojolicious supports. It abstracts your web app from your web server... so any web server supporting PSGI will support Mojolicious - so you don't have to use a perl webserver. PSGI is supported by most webservers, like Apache.

Off topic (1)

Megahard (1053072) | more than 2 years ago | (#37746982)

So how did the camel icon lose its head? Is it the new security to protect us from zombie camels?

Re:Off topic (1)

InfiniteZero (587028) | more than 2 years ago | (#37747228)

Apparently the span tag, which contains the icon and is narrower is width, has "overflow" set to "hidden".

Ironic in a thread about web development.

Installation (0)

Anonymous Coward | more than 2 years ago | (#37747430)

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.

Re:Installation (1)

draven (387) | more than 2 years ago | (#37747450)

I recommend using perlbrew (http://perlbrew.pl) to install the latest version of perl in your home directory. Then you can just drop the sudo. You *could* also just install this thing using the normal cpan shell that ships with perl, cpanmin.us is just a convenience to make things easier.

With regards to the https - You might notice that http://cpanmin.us redirect to - https://raw.github.com/miyagawa/cpanminus/master/cpanm

Re:Installation (1)

larry bagina (561269) | more than 2 years ago | (#37750710)

And where will it redirect when the DNS is poisoned or hacked?

pretty? (1)

lynnae (2439544) | more than 2 years ago | (#37747882)

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.

Modern Perl? (1)

sco08y (615665) | more than 2 years ago | (#37748210)

Wouldn't that be Perl6 [perl6.org] ?

Re:Modern Perl? (1)

hey (83763) | more than 2 years ago | (#37748532)

Does it work yet?

Re:Modern Perl? (1)

sqldr (838964) | more than 2 years ago | (#37748714)

I checked the release schedule.

First alpha: 2045

Second alpha: 3110

First beta: shortly before the north american continent collides with the asian continent

Second beta: approximately around the time of inteplanetary space travel

Release candidate 1: Dolphins have evolved fingers

Release:candidate 2: Human race enslaved by dolphins

Release: Universe dies of heat death

2.00 = 1.99 + 0.01: what's new? (1)

dolmen.fr (583400) | more than 2 years ago | (#37748766)

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...

About time! (1)

Lisandro (799651) | more than 2 years ago | (#37748826)

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.

Programming with Perl 40hrs/week x 14 years (1)

Anonymous Coward | more than 2 years ago | (#37748896)

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.

wanna migrate to ruby (0)

Anonymous Coward | more than 2 years ago | (#37748970)

I just looked.

Though I'm an old time Perl coder; I like the look of Ruby with Sinatra better: http://www.sinatrarb.com/

Might as well plug my own framework .. (1)

aspeer (131086) | more than 2 years ago | (#37749924)

WebDyne [wedyne.org] - another embedded Perl interpretation. See the examples here [webdyne.org] . Just a hobby project, but it scratches an itch - and makes active web pages easier for me to make at least ..

Looks useful (0)

Anonymous Coward | more than 2 years ago | (#37751048)

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.

mojo (3, Interesting)

Rysc (136391) | more than 2 years ago | (#37751134)

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

# get story titles from slashdot
wget slashdot.org -O - 2>/dev/null | sed -n '/"title-/{s/<[^>]*>//g;s/^[ \t]*//;p}'

And just go with it, because it's good enough. Well, no more! Now I can say

mojo get slashdot.org 'h2.story > span:first-child>a' text

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.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>