Questions tagged [mojolicious]

Mojolicious is an MVC web framework in Perl.

Back in the early days of the web there was this wonderful Perl library called CGI, many people only learned because of it. It was simple enough to get started without knowing much about the language and powerful enough to keep you going, learning by doing was much fun. While most of the techniques used are outdated now, the idea behind it is not. Mojolicious is a new attempt at implementing this idea using state of the art technology.

Features An amazing web framework supporting a simplified single file mode through Mojolicious::Lite. Powerful out of the box with RESTful routes, plugins, Perl-ish templates, session management, signed cookies, testing framework, static file server, I18N, first class unicode support and much more for you to discover.

Features

  • An amazing MVC web framework supporting a simplified single file mode through Mojolicious::Lite. Powerful out of the box with RESTful routes, plugins, Perl-ish templates, session management, signed cookies, testing framework, static file server, I18N, first class unicode support and much more for you to discover.
  • Very clean, portable and Object Oriented pure Perl API without any hidden magic and no requirements besides Perl 5.8.7.

  • Full stack HTTP 1.1 and WebSocket client/server implementation with IPv6, TLS, Bonjour, IDNA, Comet (long polling), chunking and multipart support.

  • Builtin async IO web server supporting epoll, kqueue, UNIX domain sockets and hot deployment, perfect for embedding.

  • Automatic CGI, FastCGI and PSGI detection.

  • JSON and XML/HTML5 parser with CSS3 selector support.

  • Fresh code based upon years of experience developing Catalyst.

Resources and links

613 questions
9
votes
1 answer

Mojolicious and delayed WebSocket

I have this code snippet, I'm trying to push a string to the server every X seconds like: #!/usr/bin/env perl use Mojolicious::Lite; use EV; use AnyEvent; use POSIX qw(strftime); get '/' => sub { my $self = shift; …
snoofkin
  • 8,449
  • 12
  • 45
  • 84
9
votes
1 answer

How can I prevent Mojolicious from character-escaping stash data?

I am trying to send HTML to a template in Mojolicious and am finding that the html is getting replaced with safe strings somewhere along the way. $self->stash(portalHeaderHtml => ""); Becomes <html> In the source The template: <%=…
shaneburgess
  • 14,832
  • 15
  • 44
  • 65
9
votes
3 answers

Mojolicious Basic Authentication using "under" without Mojolicious::Lite

I am looking for a clean and simple example of how to use the "under" functionality in a "Mojolicious" application. All the examples I find are dealing with "Mojolicious::Lite" (which I don't use). For example I listened to the screencast here…
Boris Däppen
  • 1,136
  • 7
  • 20
9
votes
1 answer

Request Useragent in Mojolicious

I am trying to read the UserAgent from a request and perform operations based on it. Can anyone tell me, how I can get request UserAgent in Mojolicious. Thanks.
PMat
  • 1,761
  • 2
  • 24
  • 41
8
votes
1 answer

Setting cookies in mojolicious response

How do i set a cookie in mojolicious response and later read it from the request. I tried different ways but none of them set cookie on the response object. tried these ways $self->res->cookies({name => 'foo', value =>…
PMat
  • 1,761
  • 2
  • 24
  • 41
8
votes
1 answer

Mojolicious::Lite: How to pass parameters when using "redirect_to";

#!/usr/local/bin/perl use warnings; use 5.014; use Mojolicious::Lite; use DBI; # ... get '/choose' => sub { my $self = shift; my $lastname = $self->param( 'lastname' ); my $sth = $dbh->prepare( "SELECT id, firstname, birthday FROM…
sid_com
  • 21,289
  • 23
  • 89
  • 171
8
votes
2 answers

Mojo::UserAgent and JavaScript

I wondering if something like the below could be possible to do with Mojo::UserAgent : let's say i have the below code : my $ua = Mojo::UserAgent->new; my $res = $ua->get('mojolicious.org/perldoc')->result; is it possible to intercept…
jsor
  • 567
  • 3
  • 10
8
votes
1 answer

How can I access the current template name in Mojolicious?

I'd like to access the template name in Mojolicious from inside the template itself for debugging purposes, in the same way the Template Toolkit does (see here) The variable __FILE__ works neatly but it refers to the current file and not to the top…
simone
  • 3,644
  • 4
  • 18
  • 32
8
votes
2 answers

Shutting down a Mojo::IOLoop recurring event connected to a Mojo websocket

I'm playing around with Mojolicious and websockets. I want to send the output of multiple external commands on the server to the webpage. I have no problems with connecting and receiving messages, but I also want to send a message back to the server…
brian d foy
  • 121,466
  • 31
  • 192
  • 551
8
votes
1 answer

Mojolicious over HTTPS

I am using Mojolicious for a web app that requires an encrypted connection, but I don't know how to add SSL support to Mojolicious. My coworker sent me these: files domain.key, domain-bundle.crt, domain.crt and my Mojolicious startup looks like…
user2348668
  • 718
  • 5
  • 19
8
votes
3 answers

How can you invoke interactive Perl debugging with hypnotoad or morbo?

I'm new to mojolicious but have been using Perl for some time. I have to jump through some hoops but I can get the interactive Perl debugger (and Komodo) working with remote connections for Apache but I can't find anything about interactive…
8
votes
2 answers

How to use my own subroutines (globally) in a Mojolicious::Lite Application

I need to be able to write and call my own subroutines in a Mojolicious::Lite Application. However, the intuitive way to do this doesn't seem to be working. I emailed a colleague who has more Mojolicious experience than I do with this question and…
0112
  • 3,194
  • 6
  • 28
  • 53
8
votes
1 answer

How to fix the Mojolicious-Boilerplate app?

Today I started to learn the Mojolicious framework. IMHO, the best way is "learn by examples", so study some "already done" application a play with it. Therefore I downloaded the Mojolicious-Boilerplate, what should be a demo of Mojolicious and…
kobame
  • 5,686
  • 2
  • 28
  • 57
8
votes
2 answers

How can I get the port that Mojolicious::Lite chooses?

Joel Berger posted this little program to start a web server to serve local files, and it works great: use Mojolicious::Lite; @ARGV = qw(daemon); use Cwd; app->static->paths->[0] = getcwd; any '/' => sub { shift->render_static('index.html'); …
brian d foy
  • 121,466
  • 31
  • 192
  • 551
7
votes
2 answers

Passing arguments to redirect_to in mojolicious and using them in the target controller

I am passing arguments to redirect_to like $c->redirect_to('named', foo => 'bar'); or $c->redirect_to('named, query => {foo=> 'bar'}); but I am not sure how to use it or retrieve the value of foo in the target controller.
PMat
  • 1,761
  • 2
  • 24
  • 41
1
2
3
40 41