Questions tagged [mojolicious-lite]

A single-file DSL for the Mojolicious web framework for the Perl language. It is just a tiny wrapper around Mojolicious, so [tag:mojolicious] may be more appropriate for questions not about the DSL itself.

Related Tags:

77 questions
1
vote
1 answer

Mojolicious url_for operation insecure in webservice

I am trying to return content with a web service. Behind an apache proxy if fails with "Operation insecure". I read about adding an apache hook but it won't work for me. Setting the environment variable neither. This is what I tried: how to make…
Francesc Guasch
  • 317
  • 1
  • 9
1
vote
1 answer

How to store values ​of an input_tag in a variable?

I am trying to send data from an input_tag when I press a button with the templates in mojolicious. use Mojolicious::Lite; get '/' => 'index'; app->start; __DATA__ @@ index.html.ep
1
vote
1 answer

Can I forward to action in same controller in Mojolicious

If I split my application with Controller classes I can do get '/foo/bar' => { controller => 'Foo', action => 'bar' }; can I do the same if my action is inside the same Mojolicious::Lite file? For now I do sub foobar { my $c = shift; …
simone
  • 4,667
  • 4
  • 25
  • 47
1
vote
1 answer

Mojolicious Lite route with regular expressions

I am trying to catch a route with regular expressions in Mojolicious Lite. This is the route: get qr!/messages/read/(.*).json! => sub { my $id = $1; my $c = shift; return $c->render(json => { $id => 1 }); }; It just returns page not…
Francesc Guasch
  • 317
  • 1
  • 9
1
vote
0 answers

How to understand subcall "sub ($c) {...}"?

I'm reading a mojo example from: https://mojolicious.org/ Below is the code: use Mojolicious::Lite -signatures; # Render template "index.html.ep" from the DATA section get '/' => sub ($c) { $c->render(template => 'index'); }; ...... My question…
Hao
  • 418
  • 3
  • 8
1
vote
1 answer

Mojolicious base URL when running Mojolicious Lite app on Apache under subdirectory

I'm trying to run a tiny Mojolicious Lite app on Apache (shared hosting) in a subdirectory: http://www.example.com/mymojoapp/. And I mostly tried to follow this guide. The mymojoapp is an actual directory on the server, and app structure as…
flamey
  • 2,311
  • 4
  • 33
  • 40
1
vote
1 answer

Perl Mojolicious IIS routes going to POST method

Here we go, I have a Mojolicious application that works when running on the morbo server. When I run it in IIS it seems to work, but when you submit any form, it's like IIS isn't sure which route is the GET or POST method. so currently I have routes…
gregnnylf94
  • 370
  • 3
  • 16
1
vote
4 answers

Mojolicious Angular POST JSON

i am new to Perl and Mojo and i've got one problem by receiving POST-Data from Angular: My AngularCode is var datainput = JSON.stringify({"test":"orcl"}); $http.post('http://localhost/perltest/perltest.pl/post', datainput) …
user7445564
1
vote
1 answer

Mojolicious: Can't call method "render" on an undefined value

I'm getting this error and cannot understand why this happens. It happens when I jump to another subroutine. Perhaps there is something I need to understand about Mojolicious on why this happens. Here is the source code of my…
gpwr
  • 988
  • 1
  • 10
  • 21
1
vote
1 answer

Posting a JSON true value with Mojolicious

I am trying to post the following JSON with Mojo::UserAgent use Mojo::UserAgent; my $ua = Mojo::UserAgent->new; my $ip = ... $mojo->post( 'https://$ip:443/query' => json => { value=> True, Query => ... } ); I get an error Bareword "JSON::true"…
smith
  • 3,232
  • 26
  • 55
1
vote
2 answers

Optional POST Parameters in Mojolicious Lite with Perl

Is there a way to denote a POST parameter as optional in Perl using Mojolicious Lite? For instance, is there a way to make the server not return 404 if param2 is not defined in the request body? post "/my_post" => \&render(post_callback); sub…
Danny Sullivan
  • 3,626
  • 3
  • 30
  • 39
1
vote
1 answer

Mojolicious database plugin - helper error

I am trying to use Mojolicious database plugin, and find some difficulties. My first two pages of Google results about this topics are already visited. Scenario is very simple: connect to a db (mysql), fetch some data, display it. Here is an excerpt…
1
vote
1 answer

How to do things after the app->start; in Mojolicious websocket for Perl

I have a server side websocket running on Linux and at the end the websocket is running but there need to be executed more after the app->start; Like in the code bellow I put a print hello world to try it but it doens't work. Somebody knows how to…
Noise
  • 41
  • 1
  • 3
1
vote
1 answer

Mojolicious: redirecting in a /subdir/subdir/some.cgi won't yield an absolute url

I am trying to redirect in the file /subdir/subdir/some.cgi which calls the following method: $self->redirect_to("/anothersubdir/some.html"); However, the above call will redirect to /subdir/subdir/some.cgi/anothersubdir/some.html instead. So how…
Hellyna Ng
  • 13
  • 2
1
vote
1 answer

Mojolicious and directory traversal

I am new to Mojolicious and trying to build a tiny webservice using this framework , I wrote the below code which render some file remotely use Mojolicious::Lite; use strict; use warnings; app->static->paths->[0]='C:\results'; get '/result'…
smith
  • 3,232
  • 26
  • 55