mojolicious

Match any GET path with Mojolicious::Lite

Hello! I’d like to match any GET request in Mojolicious::Lite. The code looks like this: get '.*' => sub { my $self = shift; $self->render(text => 'Nothing to see here, move along.'); }; This dies with “Modification of non-creatable array value attempted” at MojoX::Routes::Pattern.pm, line 301. I tried other arguments to get,...

Converting checkbox to select (perl)

Before: <input type='checkbox' name='killerFeature' id='killerFeature' <%= param('killerFeature') ? ' checked' : ''%> /> Now: <select name="killerFeature" id="killerFeature" class="select"> <option value="1">Enable</option> <option value="0">Disable</option> </select> How do I insert the same checked (should be 'selec...

Difference between '%p' and 'my %p' ?

% %p = ('option1' => 'Option 1', % 'option2' => 'Option 2', % 'option3' => 'Option 3' % ); <select name="killer_feature" id="killer_feature" class="select"> % foreach (keys %p) { % my $selected = param('killer_feature') && param('killer_feature') eq $_ ? 'selected="selected"' : ''; % if (!param('killer_feature') && $_ eq 'option2')...

Output command to socket without buffering using Mojo::IOLoop

How to do continiously output of command (for me it's long ping) in real-time mode on Mojo server? I'm looking for some example on Mojo::IOLoop. For example, client connects to server and requests for ping X.X.X.X, server returns an non-buffered output (while ping on server return each line to output, client receive this line from socket...

Why JQuery's .post returns no data?

I post JSON request to remote service. Everything is OK, service works fine and it response to me. But I have no data returned from remote service. How to get data from remote json service by JQuery via .post? Why this example returns the data -- ``null': <SCRIPT> $(function() { $('#zzz').click(function() { $('#lak').html('...