[Mojolicious] Re: checkbox in form with Plugin::BootstrapHelper

2019-02-22 Thread Daniel Mantovani
Hi, %= check_box "some-name" => (class => "form-control") should do exactly that. You can check it with this one-liner: $> perl -Mojo -E 'a({inline => "%= check_box \"some-name\" => (class => \"form-control\")"})->start' get / Returning: BR, Daniel El jueves, 21 de febrero

Re: [Mojolicious] Using 'state' in a helper

2018-11-20 Thread Daniel Mantovani
Hi, not sure if this is what you need, but I wrote an example on how to trigger some state machine with a post request, and later be able to check some status with other requests: https://github.com/dmanto/mojo-stateful-server-experiment/blob/master/stateful.pl Hope it can help BR, Daniel El l

[Mojolicious] Re: how to run bash script in nonblocking mode?

2018-04-24 Thread Daniel Mantovani
does its work. And web > page is working. > But when I run second batch whens first one is still working web page > hangs until second one finisz its work. > Do you know why is that? and how could it be fixed? > > Thank you, > > tj > > > W dniu niedziela, 22 kwie

[Mojolicious] Re: how to run bash script in nonblocking mode?

2018-04-22 Thread Daniel Mantovani
Hi tj, I understand that for the run method both subs are required. If you don't want to do anything when the batch finish, the second one could be just sub {} i.e. > $subprocess->run(sub { `sh runImportPhen`}, sub {}); BR, El sábado,

[Mojolicious] Re: Test::Mojo with uploading files

2018-01-04 Thread Daniel Mantovani
Hi, You can find an example of file upload testing here: https://metacpan.org/pod/Test::Mojo#post_ok I haven't tested what follows, but in your case (using "file" as the name of the file input field and "/uploadsave" as the url to post) that should be: my $upload = {file => {file => '/path/to

Re: [Mojolicious] Re: hypnotoad systemd start problem

2017-11-26 Thread Daniel Mantovani
t's running ok when manually start. > I try to check the perl. > > David > > > 在 2017年11月24日星期五 UTC+8下午9:58:54,Daniel Mantovani写道: >> >> Hi David, those 'Compilation failed in require at ... ' normally mean >> that perl is not able to find some mo

Re: [Mojolicious] Re: hypnotoad systemd start problem

2017-11-24 Thread Daniel Mantovani
s assigned (I'm not sure on the > details for this option). You can use > https://metacpan.org/pod/Mojolicious::Plugin::SetUserGroup to drop > permissions after starting as root. > > -Dan > > On Thu, Nov 23, 2017 at 7:45 PM, Daniel Mantovani > wrote: > >> Hi

Re: [Mojolicious] Re: hypnotoad systemd start problem

2017-11-24 Thread Daniel Mantovani
20 localhost.localdomain systemd[1]: mojo_test.service: > control process exited, code=exited status=2 > Nov 24 18:23:20 localhost.localdomain systemd[1]: Failed to start My > Mojolicious application. > Nov 24 18:23:20 localhost.localdomain systemd[1]: Unit mojo_test.service > entered fa

Re: [Mojolicious] Re: hypnotoad systemd start problem

2017-11-23 Thread Daniel Mantovani
Hi, Type=forking should work just fine, I am not sure that with Type=simple you will have all the functionallity you can get from systemd. A couple of advices though: 1) to get more confortable with systemd, you probably want to replicate as much as possible the example in Mojolicious::Guides:

Re: [Mojolicious] Re: Mojo::IOLoop->recurring start several job at the same time

2017-11-22 Thread Daniel Mantovani
As a (probably not very efficient) option, you can consider to coordinate the different processes through a database, something like: use Mojolicious::Lite; use Mojo::IOLoop; use Mojo::Pg; helper pg => sub { state $pg = Mojo::Pg->new("postgresql:///test") }; app->pg->migrations->from_data->migra

Re: [Mojolicious] How to execute a long running task in the background and report its progress to the browser?

2017-08-16 Thread Daniel Mantovani
...an example of a very simple example... oops, sorry about that :( El miércoles, 16 de agosto de 2017, 14:57:36 (UTC-3), Daniel Mantovani escribió: > > Hi Franz, it could be a litle late but as an example of a very simple > example that I think should be very portable (at the e

Re: [Mojolicious] How to execute a long running task in the background and report its progress to the browser?

2017-08-16 Thread Daniel Mantovani
Hi Franz, it could be a litle late but as an example of a very simple example that I think should be very portable (at the expense of something more efficent, like using message queues for instance), if your external background process could report its advance atomically to a file like this bas

Re: [Mojolicious] Simple Mojo::Test with Form Example Needed

2017-05-27 Thread Daniel Mantovani
El viernes, 26 de mayo de 2017, 20:23:09 (UTC-3), iaw4 escribió: > > > dear M users / stefan : still stuck. this probably has a simple answer. > here is my attempt at a simple form page and a test: > > #!/usr/bin/env perl > use Test::More; > use Test::Mojo; > > my $t = Test::Mojo->new; > $t->g

Re: [Mojolicious] Re: Update cache only in one process and read it in all other processes (how to?)

2017-04-18 Thread Daniel Mantovani
and update > cache - only in process #7038 > Workers #7040..7054 must be used only to read cache and send replies to > users in a predictable time. > In my opinion, workers must not be involved in any heavy processing, > because its area of responsibility is user requests - it mu

[Mojolicious] Re: Update cache only in one process and read it in all other processes (how to?)

2017-04-17 Thread Daniel Mantovani
Hi, I am not sure I fully understand your question, but if you already have Redis and you want that only one spawned process receives an event, and that on next event next spawned process do the same, you could use queue commands from Redis for that (instead of PUB/SUB that would be addressed t

Re: [Mojolicious] Problem with utf8 chars in test messages (compatibility between Test::Mojo and Test::More::UTF8 modules)

2016-12-12 Thread Daniel Mantovani
hen using test libraries like Test::Mojo. > You should not use them together. > > On Mon, Dec 12, 2016 at 9:18 AM, Daniel Mantovani > wrote: > >> When testing Mojo apps, many times you need to use both Test::Mojo and >> Test::More. In those cases, I found difficult to

[Mojolicious] Problem with utf8 chars in test messages (compatibility between Test::Mojo and Test::More::UTF8 modules)

2016-12-12 Thread Daniel Mantovani
When testing Mojo apps, many times you need to use both Test::Mojo and Test::More. In those cases, I found difficult to print utf8 coded strings as test messages. See this example: $ cat with_More-UTF8.t use Test::More tests => 3; use utf8; use Test::More::UTF8; use Test::Mojo; use Mojolicio

Re: [Mojolicious] Handling different types of JSON requests

2016-09-24 Thread Daniel Mantovani
multipart/form-data also supports binary data natively (i.e. uploading files). You could use Base64 to convert the binary data, but it depends whether the overheads (33% on network and corresponding processing load) may be a problem or not for your particular case. El sábado, 24 de septiembre d

[Mojolicious] Re: set a link to http from https

2015-06-14 Thread Daniel Mantovani
in your controller should be like this: $c->url_for()->.->scehme('https') El domingo, 14 de junio de 2015, 9:07:13 (UTC-3), Ivan Kolisnyk escribió: > > Hello everybody. > I'm developping CMS for web on Mojolicious. I have a problem with setting > up a link from admin part under https pro

[Mojolicious] Re: write_chunk

2015-06-11 Thread Daniel Mantovani
A few weeks ago I run in a similar problem trying to repetitively run a group of steps for a simple get operation without blocking the controller. After receiving some advices from the #mojo irc channel folks I end up with a plugin that should be able to repeat a set of steps without block the

[Mojolicious] Re: Problem with Mojo::Pg

2015-03-24 Thread Daniel Mantovani
In Mojo::IOLoop either $delay->begin or $delay->end must be invoked BEFORE you leave each step. It doesn't seem to be the case in the first step. There is a very nice explanation of what is hapening here: http://www.slideshare.net/deepfountainconsulting/asynchronous-programming-patterns-in-perl

[Mojolicious] Interactive debugging in Mojolicious tests

2015-01-22 Thread Daniel Mantovani
I wonder if there is a recommended way to run Mojolicious tests under perl debugger. Actually I saw that if you write a Makefile.PL with Exutils::MakeMaker and then perl Makefile.PL make you will be able to run Mojo tests under perl debugger like this: make testdb TEST_FILE=t/mytest.t (ex

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-10-03 Thread Daniel Mantovani
n Sunday, June 29, 2014 10:21:28 PM UTC+2, Daniel Mantovani wrote: >> >> Perfect then, thanks Jan >> >> El domingo, 29 de junio de 2014 03:50:09 UTC-3, Jan Henning Thorsen >> escribió: >>> >>> The on(message => $channel => ...) API is not g

[Mojolicious] Re: What databases are you using with Mojolicious? (Poll)

2014-09-26 Thread Daniel Mantovani
Postgresql & DBIx::Class Daniel El jueves, 25 de septiembre de 2014 16:07:07 UTC-3, sri escribió: > > Lets have a little poll, what databases are you using with Mojolicious? > And which modules are you currently using to access them? > > -- > sebastian > -- You received this message because yo

Re: [Mojolicious] Re: Wishlist thread (second edition)

2014-07-15 Thread Daniel Mantovani
horsen escribió: > > About SSH tasks: > Have you looked at https://metacpan.org/pod/Mojo::IOLoop::ReadWriteFork? > (Feedback wanted) > > On Monday, July 14, 2014 4:11:08 PM UTC+2, Daniel Mantovani wrote: >> >> Thanks for the feedback, took a look at the code and I think

Re: [Mojolicious] Re: Wishlist thread (second edition)

2014-07-14 Thread Daniel Mantovani
Thanks for the feedback, took a look at the code and I think it's a nice way to integrate ssh tasks to Mojolicious. Not realy non-blocking in the way Mojo::UserAgent is though, as far as I understood it uses one process per ssh connection. (Mojo::UserAgent just runs inside the ioloop instead).

[Mojolicious] Re: Wishlist thread (second edition)

2014-07-12 Thread Daniel Mantovani
Hope is not too late, my list: - Some kind of EventEmitter that allows you to subscribe and emit events from and to any process when using hypnotoad. I think it should support several backends (like Mojo::Plugin::Minion does), ie: File, Mango, Redis - SSH and Telnet clients on Mojo::IOLoop

[Mojolicious] Re: Websocket example under hypnotoad

2014-07-12 Thread Daniel Mantovani
Hi, as far as I know there is no easy way to communicate among different processes, so I guess that example is not really intented to work with hipnotoad. As a suggestion, take a look to Mojo::Redis module that will allow you to subscribe and publish to "keys" from and to any process (using red

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-29 Thread Daniel Mantovani
lpop(), brpop(), brpoplpush <http://redis.io/commands#list>() is > that they are blocking on the server side. > > > On Saturday, June 28, 2014 2:12:01 AM UTC+2, Daniel Mantovani wrote: >> >> Yes it absolutly matters, I need a different channel per connected >&

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Daniel Mantovani
the Redis database, since Mojo::Redis2 >> is re-using the same subscribe connection >> >> Unfortunatly, issuing (P)SUBSCRIBE will only allow "subscribe like" >> commands <http://redis.io/commands/subscribe>, which renders any Redis >> module unab

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Daniel Mantovani
Hi Jan, I´ve using Mojo::Redis and find it very convenient as the glue that allows to comunicate non-blocking among different processes (toads) when running hypnotoad (using subscribe and publish, just as the "Websocket example" in the module's synopsis). Something I would suggest for you to