Mojo + Perl 6 + Inline::Perl5

176 views
Skip to first unread message

Brian Duggan

unread,
Dec 20, 2016, 3:58:25 PM12/20/16
to mojol...@googlegroups.com
Hi All,

So, after reading today's p6 advent calendar entry, I gave
this a try:

$ cat mojo.p6
#!/usr/bin/env perl6

use Mojolicious::Lite:from<Perl5>;

app.routes.get: '/', -> $c { $c.render( :text("hello\n") ) };

app.start;

and it works!

$ ./mojo.p6 get /
[Tue Dec 20 15:49:43 2016] [debug] GET "/"
[Tue Dec 20 15:49:43 2016] [debug] Routing to a callback
[Tue Dec 20 15:49:43 2016] [debug] 200 OK (0.001791s, 558.347/s)
hello

$ ./mojo.p6 daemon
[Tue Dec 20 15:52:22 2016] [info] Listening at "http://*:3000"
Server available at http://127.0.0.1:3000

Hurray!

Brian

Stefan Adams

unread,
Dec 20, 2016, 4:03:26 PM12/20/16
to mojolicious
Hey, that's awesome! But it doesn't look nearly as pretty as native p5 code! :D Maybe I just still need to get used to p6 yet. Actually I know I do.



Brian

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscribe@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

sri

unread,
Dec 20, 2016, 4:09:32 PM12/20/16
to Mojolicious
        $ cat mojo.p6
        #!/usr/bin/env perl6

        use Mojolicious::Lite:from<Perl5>;

        app.routes.get: '/', -> $c { $c.render( :text("hello\n") ) };

        app.start;

That doesn't even look good... Perl 6 is such a disappointment to me.

--
sebastian 

Brian Duggan

unread,
Dec 20, 2016, 4:40:16 PM12/20/16
to mojol...@googlegroups.com
How about

use Mojolicious::Lite:from<Perl5>;
app.routes.get: '/', *.render: :text("hello\n");
app.start;

If not, any ideas for a slang that would improve the appearance? :)

Brian

Matt Hicks

unread,
Dec 21, 2016, 11:49:25 AM12/21/16
to Mojolicious


On Tuesday, December 20, 2016 at 4:40:16 PM UTC-5, bduggan wrote:
If not, any ideas for a slang that would improve the appearance? :)


Maybe it's the lambda/pointy block?  IMO, those don't always improve readability.
Reply all
Reply to author
Forward
0 new messages