10 ms·
Mojolicious – Perl real-time web framework
- perlgeek 12y agoI've done a few small projects with Mojolicious, and it's been real fun to work with. The only thing that's missing is a book that explains the concepts in more depth than the documentation. (I believe some folks in the community are working on that).
- walterbell 12y agoIt would be helpful to compare it with projects in other languages, e.g. pro/con with Node.js or Erlang.
- rihegher 12y agoI don't know much about erlang but I used to write node.js app and I still maintain some today. I really like the new concept brought by Node.js. However I realised that most of the time I don't need/want to write asynchronous code which I found harder to test and grow than synchronous code. Now Mojolicious is a non-blocking IO framework that simulate blocking IO by default. This means that with Mojo you can write code either with blocking or non-blocking IO. To do that you'll have to learn using the mojo::IOLoop which is less natural than node.js to do non blocking but does the job and got easier to use with the 5.0 release. With node.js you don't have that choice, you're stuck writing application entirely asynchronous.
- walterbell 12y agoThanks. I found a 3-part tutorial at http://blogs.perl.org/users/joel_berger/mojolicious/ http://blogs.perl.org/users/joel_berger/mojolicious/
- lazyloop 12y agoMy favourite IRC client is built with Mojolicious! http://convos.by/ http://convos.by/
- pimlottc 12y agoWhat exactly is a "real-time" web framework? Is that anything like being "web scale"?
- kraih 12y agoNot at all, it's a "real thing", the Wikipedia article might be of help. http://en.wikipedia.org/wiki/Real-time_web http://en.wikipedia.org/wiki/Real-time_web
- lumpypua 12y agoA framework that can natively communicate with a browser via mechanisms like Comet or WebSockets. An example is when a new message is posted to an inbox on the server, and your browser immediately updates the message count without polling. Non-realtime frameworks often have to resort to communicating with websockets over something like zeromq.
- agilityfeat 12y agoAnything that allows two browsers to communicate directly with each other without the user intervening can be called a real-time web framework. Examples include WebSockets, the WebRTC DataChannel, publish/subscribe networks, paid services like PubNub or Kaazing, etc.
- doesnt_know 12y agoThe "installation" instructions wgets a script (over http) which in turn curls a raw github link of cpanminus which is "a script to get, unpack, build and install modules from CPAN" which then downloads and installs the perl module. How many developers or "power users" would have just ran that command without even thinking about it? I guess signing packages with trusted keys and serving them over https is far too lame for devs these days. (Not that I'm calling out this particular project, it's seems to be crazy popular to offer "curl some.script | bash" as installation instructions lately for some reason.)
- mike-cardwell 12y agoHopefully, most people would check their package managers first. Debian and Centos both have packages for it at least.
- collyw 12y agoDistro packages are often a bit behind the official releases. I prefer to develop in the most recent version of a framework / library, as it generally makes things a bit more future proof.
- BugBrother 12y agoWhat collyw said. And most people prefer to use their own installation of Perl (see perlbrew) instead of the system Perl for development. The same seems to go for other scripting environments.
- singingfish 12y agonope, cpan is a fast changing target. You can make it easy on yourself by building your own perl (with perlbrew, super easy) and managing your cpan modules with cpanminus. The system perl is for the system, your perl is for you.
- txutxu 12y agoThis is a fully open source project. And that, includes all the packaging and deployment tools involved and available (tons of options). Big corps (and users which avoid smartphones, certain social networks, marketing campaigns, etc, like me), should develop their internal git mirrors, cpan mirror, build systems, etc. As usual. Many developers reproduce the same issue with node, python, ruby etc. That does not remove LOVE from this beautiful framework. I can state that the mojolicio.us "web development can be fun again" is true for me. Just go for it, check yourself the docs and the source, hack, and judge by yourself. We are talking about that, not about the lack of common sense of many developers, when the topic is about systems, security and operational tasks. Perl apps can be deployed securely after auditing them. What knowledge do you lack about this defocus topic ?
- f055 12y agoI've been using Mojolicious for about 5 years now - from somewhere around v1.0 - and it's been awesome. The more I learned the easier and quicker things got. Now I use if for all my backend needs, from SaaS, APIs to real-time websockets - and there's still a ton of things Mojo can do but I never tried them. Not to mention Perl itself. And CPAN. Let's face it - Perl is magic ;)
- Daviey 12y agoAs web frameworks go, I prefer the experience of Django.... but a recent project I did with Mojolicious was a really fast experience to 'get something' together, whilst also staying out of the way.
- odc 12y agoI love the combo Mojolicious + Mango (the MongoDB driver). They allow to build a completely non-blocking applications very easily.
- blue1 12y agoThe problem with framework reviews is that they are mostly written by people that have used just that one (not surprising since it takes some time to become proficient in such things), and always the conclusion is, oh it is awesome. I would be much more interested in a comparison with the alternatives, for example Mojolicious vs Catalyst, but apparently very few people are able to do that.
- rikacomet 12y agoI can true that. I usually see a lot of Perl Devs, think that Perl as a language is not worth learning from scratch, and the framework is all there is to it. As soon as you mention the outdated (indated by FCGI-mod_perl) CGI module .. you are thought to be living in the 90s. For production, I can agree partially with them, but for educational purposes, it twitches my nerve :/ Though, I like mojo over others due to its lean code.
- perlgeek 12y agoI've used both Catalyst and Mojolicious. Mojolicious is much easier to get started with, because you don't have to touch several namespaces just to get a single page to render. Also doing non-blocking stuff with Catalyst seems to be a real pain (though I haven't tried it yet).
- BugBrother 12y agoI liked the Catalyst tutorials and general documentation. But Catalyst is not Dancer, which is like chewing air to learn. :-) When I read up a little on Mojolicious to have an opinion a couple of years ago, it seemed more complex than Catalyst? I'll put my JavaScript hobby aside and look at it again. Any good links? [Except the one posted by walterbell at http://blogs.perl.org/users/joel_berger/mojolicious/ http://blogs.perl.org/users/joel_berger/mojolicious/ Grumble, that was already on my reading list.]
- Ultimatt 12y agoCatalyst is not less complex than Mojolicious, if that is your measure of goodness. From an installing pov or from usability. In Mojolicious you don't need Moose, and you don't have an explicit model layer so you aren't pushed towards using an ORM. You can use either, but they aren't a hard or suggested requirement. The MojoCasts might be a good place to start if all you've done is read and come up with a slightly off impression http://mojocasts.com/e1 http://mojocasts.com/e1
- instakill 12y agoExisting libraries around modern web frameworks sure do have a unicorn obsession.
- __Joker 12y agoIf say I want to build a web application and new to Ruby, Python and Perl. But I want to use one of the RoR, Flask (or Django), Mojolicious. Which one should I go for. I.e. either one it had some advantage than other ? Rather, I know Python so I should go for Flask, argument.
- ddorian43 12y agoI think your argument is enough.
- tmaly 12y agoIn the Perl realm I chose Mojolicious because it has very little dependencies. It does not come with an ORM or a built in user login. If you wanted that, Catalyst is a better way to go. The Mojo Lite aspect of Mojolicious makes it really easy to get a prototype up and running.
- ChikkaChiChi 12y agoI feel that it's more important to learn the fundamentals of the base language than it is to focus on any one particular framework. Virtually any web application of any measurable complexity is going to lead you into writing code outside the DSL that a framework might encumber you with.
- fibo 12y agoMojolicious is best Perl web micro framework, remember that the Author also started catalyst. Dancer is similar but I don't like dsl. Mojo is very fast, powerful and expressive with a lor of features, mature and more perlish. Try Mojolicious::Lite, there is no other web Framework that can write an app in a single,file.
- william20111 12y agoflask can?
- matthewmacleod 12y agoFlask, Sinatra, Rails, Express… actually, there are a lot of them.
- grimgrin 12y agoEven Django! https://github.com/readevalprint/mini-django/blob/master/mini_django.py https://github.com/readevalprint/mini-django/blob/master/min...
- Akron- 12y agoAs far as I can see this is no full single file app: The template is stored separately. In Mojolicious::Lite you can bundle all html/css etc. templates and even images (as base64) in the data section of the file.
- chawk 12y agoPeople still use Perl?
- wschroed 12y agoYes. And I am looking for Perl programmers right now: http://www.reddit.com/r/stljobs/comments/2a9940/seeking_software_developer_for_the_genome/ It gets the job done, is an easy language for people to get into, has enough flexibility to adapt to a huge number of programming patterns, and has a large and active community. We write real applications with it that help scientists find cures for diseases.
- collyw 12y agoWould there be any possibility of remote work from Europe? My current job is building / maintaining the LIMS system for a sequencing centre in Spain. I did that in Django, but I did years of Perl before hand.
- wschroed 12y agoNo. :( Our users -- lab folks -- are not particularly computer savvy, and everyone benefits from the face time, especially when it comes to translating what they said on a JIRA issue to their actual problem.
- masukomi 12y agoYes, and many more of us wish our employers would let us use it at work too.
- deleted 12y ago[deleted]
- n0body 12y agoeveryday, although I use Catalyst, not mojo, but it's still nice to see a Perl project on hacker news.
- 12y ago
- elb0w 12y agoThis is such a great project. I remember when it started back when I used to work in perl. The main devs on it are awesome. If I ever build anything in perl again that needs an webserver it would be this.
- ThePhysicist 12y agoIt's great to see such an awesome Perl project on HN, especially these days when most folks here write Python, Ruby and JS and love to make fun of those "nerdy old Perl hackers". I mostly use Python these days myself but I'll never forget the sense of power that Perl gave me when I learned it back in the late 90s (prior to Perl I had programmed in Turbo Pascal and Basic). To most programming enthusiasts back then it was what Python is today: A great, easy-to-learn, fun language that let's you solve almost any problem with just a few lines of code, mostly thanks to a huge ecosystem of powerful libraries (CPAN). Granted, the object-orientation felt more like a hack than a normal language feature (because it was one), but all in all it's still a really great language and just as powerful as Python, JS or Ruby.
- muraiki 12y agoIf you haven't played with Perl lately, it's worth looking into Moose, an object system for Perl. It not only offers a much nicer syntax for making objects, but provides features like read-only accessors, roles, introspection, and even types! http://search.cpan.org/dist/Moose/lib/Moose/Manual.pod http://search.cpan.org/dist/Moose/lib/Moose/Manual.pod I work with Perl professionally now after having spent most of my self-taught programming education using Python, and I've been pleasantly surprised with the language. I'm both coding new projects and working with a more than decade old code base, and I've found that Perl code is as good as the programmer. Yes, like any decades old language it has its warts, but Perl 5 itself is still being developed and improved upon. For those who know another scripting language, the free book Modern Perl is a great place to start learning: http://modernperlbooks.com/books/modern_perl_2014/ http://modernperlbooks.com/books/modern_perl_2014/
- lelf 12y ago> an object system for Perl. It not only offers a much nicer syntax for making objects, but provides features like read-only accessors, roles, introspection, and even types! and even metaobject protocol
- otterley 12y agoMoose is very clever, but all that cleverness has a cost. One of the things I like about Perl is that it offers tremendous performance, in addition to having an actually-useful debugger. Subroutine calls in Perl aren't free; in fact they have a significant performance penalty if overused. And that's exactly what Moose uses, in droves. Making Perl act like Ruby will also make it as slow as Ruby, and as difficult to debug.
- joeclark77 12y agoI used to love Perl... it's been about 15 years, though. What a great excuse to learn it again!
- vijayboyapati 12y agoI've been developing with Perl for almost 20 years and am a great fan of it. I think it's not difficult to write easy to read and understand Perl code (although it's also not difficult to write awful Perl code). I'm very interested to learn more about Mojolicious. I've been using and really enjoying Perl Dancer, which from the example on the landing page of Mojolicious looks very similar. Could someone familiar with the two give me a summery of the differences and pros and cons between them?
- sarciszewski 12y ago"curl get.mojolicio.us | sh" Delicious! Let's pipe data retrieved over raw HTTP and pipe it directly to sh. It's like one of those Head-On commercials (remember those?) only with digital cyanide.
- hadoukenio 12y agoAs opposed to blindly downloading a repo and running "make install"? What's the difference? If you really cared enough you would instead pipe it to a file to inspect first. But I don't think you inspect most packages you download from GitHub etc. So again, what's the difference as opposed to convenience with the pipe?
- andraganescu 12y agoWell, which is it more probable to to go unnoticed: a hack of the install script you fetch via http or an entire github commit infesting the software while it still lets it work as designed so no contributor notices? It is not a problem with mojolicious at all. Its a nice helper that should be carefully used.
- qmaxquique 12y agoYou can test and develop Mojolicious in a terminal.com container. Check my snapshot at https://terminal.com/tiny/8TRpbtVffh https://terminal.com/tiny/8TRpbtVffh