[Pdx-pm] Mojolicious anyone?
Shlomi Fish
shlomif at iglu.org.il
Sun Jan 9 12:56:33 PST 2011
Hi Daniel,
On Sunday 09 Jan 2011 07:29:05 Daniel Hedlund wrote:
> Has anyone had a chance to play around with Mojolicious
> (http://mojolicio.us/)? If so, what's been your experience with it?
I worked on a paid project where I was instructed to use it and KiokuDB back
in the 0.9999-something days. I've given a presentation about my experience to
a Tel Aviv web-developers knowledge sharing meeting:
http://www.shlomifish.org/lecture/Perl/Lightning/Mojolicious/
After all that, one of Mojo's developers complained that my code was ugly, and
later on banned me from Mojolicious' irc.perl.org channel, and refused to lift
the ban, even after my boss contacted him about it. We ended up having to seek
a different alternative and ended up choosing Catalyst.
I also recently studied Dancer ( http://perldancer.org/ ), which seems very
similar to Mojolicious::Lite due to the fact they were both inspired by
Sinatra. As opposed to Mojolicious, it has some dependencies on external CPAN
modules, and likely less re-invented and included (but possibly rounder)
wheels.
I've written this very stupid app with it:
{{{
#!/usr/bin/perl
use Dancer;
use IO::All;
my ($id, $end_at) = io->file("params.txt")->chomp->getlines();
get '/id' => sub {
content_type 'text/plain';
if ($id == $end_at)
{
return "-1\n";
}
else
{
return (($id--)."\n");
}
};
dance;
}}}
(I'm not sure it will work with all the service models of Dancer, but worked
with the standalone server which was good enough for me.).
> It looks very cool and reminds me a lot of the Sinatra DSL for Ruby,
> but with support for some HTML5 features out of the box (i.e.
> websockets). If there's any interest, I could try to give a
> demonstration at a future meeting.
>
> A couple examples from their website...
>
> # Simple route with plain text response
> get '/hello' => sub { shift->render(text => 'Hello World!') };
>
> # WebSocket echo service
> websocket '/echo' => sub {
> my $self = shift;
> $self->on_message(
> sub {
> my ($self, $message) = @_;
> $self->send_message("echo: $message");
> }
> );
> };
>
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf
Chuck Norris can make the statement "This statement is false" a true one.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
More information about the Pdx-pm-list
mailing list