[Mojolicious] Re: struggling with OAuth(2) from google

2019-04-16 Thread Jan Henning Thorsen
Have you tried https://metacpan.org/pod/Mojolicious::Plugin::OAuth2 ? On Tuesday, April 16, 2019 at 7:48:41 AM UTC+7, iwe...@g.ucla.edu wrote: > > > dear M experts. I am again struggling with the OAuth module. this is > perhaps because I installed a new ubuntu 18.04.2 machine, and then updated

[Mojolicious] Re: Nordic Perl Workshop and Mojoconf in Oslo

2018-08-09 Thread Jan Henning Thorsen
15:49 AM UTC+2, Jan Henning Thorsen wrote: > > Nordic Perl Workshop 2018 will be held in Oslo, 6 - 7 September, 2018. > > The conference topic is “Perl in the cloud”, with focus on web > development, and deployment methods. We are pleased to announce that we > will have members fr

Re: [Mojolicious] Nordic Perl Workshop and Mojoconf in Oslo

2018-05-08 Thread Jan Henning Thorsen
Sebastian is right: All talks will be in English. On Tuesday, May 8, 2018 at 11:46:22 AM UTC+2, sri wrote: > > Is english main language for the conference talks? >> > > Yes, i believe all talks will be in english. > > -- > sebastian > -- You received this message because you are subscribed to

[Mojolicious] Nordic Perl Workshop and Mojoconf in Oslo

2018-05-08 Thread Jan Henning Thorsen
Nordic Perl Workshop 2018 will be held in Oslo, 6 - 7 September, 2018. The conference topic is “Perl in the cloud”, with focus on web development, and deployment methods. We are pleased to announce that we will have members from the Mojolicious core team attending and a track dedicated to the M

[Mojolicious] Re: Is it possible to avoid repetitive validation code?

2018-02-27 Thread Jan Henning Thorsen
Yes. Put it in a helper: $app->helper("validate.page" => sub { shift->validaton->optional('page')->num(1, 100) }) and use it as: $c->validate->page; Or you could also route condition or a "under route" where you add the validation before your action is called: * http://mojolicious.org/perldo

[Mojolicious] Re: Localization of validation messages

2018-02-18 Thread Jan Henning Thorsen
I've tried to be clever about this many times, and it always ends up in a huge mess. So instead of trying to detect the exact issue, I will rather just tell the user what needs to be done: % if (validation->has_error('username') { <%=l 'You need to fill in a username, which needs to be...' %>

[Mojolicious] Re: Mojo::Base get all attributes names

2018-02-14 Thread Jan Henning Thorsen
Not quite sure what to call such a module, but I just wrote a proof of concept here: https://gist.github.com/jhthorsen/0ad4c5c84661588e89da910a08460e88 On Monday, February 5, 2018 at 11:14:06 AM UTC+1, Konstantin Cherednichenko wrote: > > Hello! > > Is there any easy way to get all attributes

[Mojolicious] Re: Test buttons or links in Mojo::Test

2017-12-28 Thread Jan Henning Thorsen
I've always done this manually. Something like this: $t->get_ok('/')->status_is(200)->element_exists('a[href*="msgid"]'); $t->get_ok($t->tx->res->dom->at('a[href*="msgid"]')->{href})->status_is(302)->header_like(Location => qr{something}); $t->get_ok($t->tx->res->headers->location)->status_is(20

Re: [Mojolicious] Re: Newbie question : How to run a bash script from inside a Mojolicious application ?

2017-10-31 Thread Jan Henning Thorsen
Hi, You could also consider looking into these alternatives: * https://metacpan.org/pod/Mojo::IOLoop::Subprocess - Run long running (blocking) code in a sub process * https://metacpan.org/pod/Mojo::IOLoop::ForkCall - Pretty similar to Subprocess * https://metacpan.org/pod/Mojo::IOLoop::ReadWrit

[Mojolicious] Re: client url

2017-10-31 Thread Jan Henning Thorsen
Hi, Do you mean $c->req->url ? On Tuesday, October 31, 2017 at 4:35:05 AM UTC+8, amka...@gmail.com wrote: > > Hi, > > How can I please get the client utl ? > > Thanks :) > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe fro

[Mojolicious] Re: A pair of processes using 8% of CPU each

2017-07-24 Thread Jan Henning Thorsen
There's no guarantee that SIGCHILD isn't set, so I can't use that. Ran into that issue in Mojo::IOLoop::ReadWriteFork. Please open a PR with tests if you want to improve it. On Tuesday, July 11, 2017 at 5:08:51 AM UTC+2, Charlie Brady wrote: > > > On Mon, 10 Jul 2017, J

[Mojolicious] Re: A pair of processes using 8% of CPU each

2017-07-10 Thread Jan Henning Thorsen
e looking for. > > Rgds. > Hans > > > Am Donnerstag, 29. Juni 2017 16:10:46 UTC+2 schrieb Charlie Brady: >> >> >> On Thu, 29 Jun 2017, Jan Henning Thorsen wrote: >> >> > Hey, >> > >> > It doesn't look like "daemon"

[Mojolicious] Re: A pair of processes using 8% of CPU each

2017-06-29 Thread Jan Henning Thorsen
Hey, It doesn't look like "daemon" mode. It looks like you used "morbo" to start the application. On Wednesday, June 14, 2017 at 11:11:31 PM UTC+2, Charlie Brady wrote: > > > I'm running a Mojolicious UI in daemon mode on a PowerPC embedded system > (running Wind River Linux, perl 5.22.0, kern

[Mojolicious] Re: Static cache header plugin

2017-06-29 Thread Jan Henning Thorsen
Hey, I think you want https://metacpan.org/source/LDIDRY/Mojolicious-Plugin-StaticCache-0.01/lib/Mojolicious/Plugin/StaticCache.pm#L15 to be this: if ($mode ne 'development' || $even_in_dev) { And I think I would store $mode and $even_in_dev outside of the "after_static" hook. On Thursday

[Mojolicious] Re: Controllers vs Actions

2017-04-26 Thread Jan Henning Thorsen
Normally, I would say that a class is an object which does things. So I would name the controllers Users and Activities. On Thursday, April 27, 2017 at 7:20:31 AM UTC+2, Stefan Adams wrote: > > I'm building a website that can pull and push activities, and within each > of these modes, you first

[Mojolicious] Re: Cookie Jar in get command?

2017-04-03 Thread Jan Henning Thorsen
I think this looks like a good idea. On Saturday, April 1, 2017 at 9:29:55 PM UTC+2, Stefan Adams wrote: > > What do you think about adding a cookie jar command to the Mojolicious > Command "get"? > > My use case is when I want to fetch a URL with "get" but the resource > requires that I be log

[Mojolicious] Re: Mojolicious application to show markdown as slides

2017-01-12 Thread Jan Henning Thorsen
That's one of the things I like about https://metacpan.org/release/App-remarkpl, or rather https://remarkjs.com/ ... It will scale the slide to the screen, so as long as the presentation fits, it will never scale out. You still need to set the appropriate font size, but the defaults have worked

[Mojolicious] Re: Mojolicious application to show markdown as slides

2017-01-09 Thread Jan Henning Thorsen
ute string: > $c->render(template => 'browser', web_dir => $web_dir->to_abs_string, > files => \@files); > > It has taken me a while to find what the issue was as the output of > "$web_dir/$file->[0]" showed the right value. ;-) > >

[Mojolicious] Re: Mojolicious application to show markdown as slides

2017-01-08 Thread Jan Henning Thorsen
. I will try this in my code. I will also try to understand > the more idiomatic parts of your code :D > > Cheers! > > El dissabte, 7 gener de 2017 15:28:55 UTC+1, Jan Henning Thorsen va > escriure: >> >> Hi, >> >> Not sure if this is interesting, but I h

[Mojolicious] Re: Mojolicious application to show markdown as slides

2017-01-07 Thread Jan Henning Thorsen
Hi, Not sure if this is interesting, but I have a competing project for rendering markdown files. Haven't gotten around to complete it... https://github.com/jhthorsen/app-mdweb On Tuesday, January 3, 2017 at 2:22:21 AM UTC+1, mimosinnet wrote: > > I have been working this Christmas in an appli

[Mojolicious] Re: How to stop rendering after user error?

2016-12-04 Thread Jan Henning Thorsen
I think this is code smell. There's probably a much better design pattern you can use, than using an exception to stop rendering. I would try my best to avoid this pattern and look for some other solution. On Thursday, December 1, 2016 at 6:52:29 PM UTC+1, Peter Valdemar Mørch wrote: > > Say i

[Mojolicious] Re: form validation

2016-12-04 Thread Jan Henning Thorsen
Hey, Not sure if I understand your problem, but why don't you just use $c->validation? Have a look here for more information and examples: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Form-validation Which version of Mojolicious do you have? Run "mojo

Re: [Mojolicious] Handling different types of JSON requests

2016-09-28 Thread Jan Henning Thorsen
If you think M::P::OpenAPI is too much, then you can use JSON::Validator instead. Check out these links: https://metacpan.org/pod/JSON::Validator#SYNOPSIS https://metacpan.org/source/JHTHORSEN/JSON-Validator-0.85/t/validate-json.t On Sunday, September 25, 2016 at 9:47:54 AM UTC+2, myf wrote: >

[Mojolicious] Re: Mojo::JSON->true encoded as 1 instead of true

2016-09-28 Thread Jan Henning Thorsen
Hey, I think your issue is elsewhere. That code should work as expected. You can also try it out with a one-liner: $ perl -le'use Mojo::JSON "encode_json"; print encode_json {flag => Mojo::JSON->true}' {"flag":true} On Wednesday, September 28, 2016 at 9:31:56 AM UTC+2, Lachlan Deck wr

Re: [Mojolicious] IOLoop Connections

2016-07-27 Thread Jan Henning Thorsen
The list of events are right there in the documentation: https://metacpan.org/pod/Mojo::IOLoop::Server#EVENTS On Wednesday, July 13, 2016 at 2:11:44 AM UTC+2, Brian Shaw wrote: > > Thanks. That worked well. Do you know if there is a complete list of > events? > > Brian > > > On Sunday, July 10

[Mojolicious] Re: How to find out the name of a placeholder the route is using

2016-07-27 Thread Jan Henning Thorsen
Why not just hard-code %url_params? Often it will be a lot more obvious to see what you're actually passing on. $url_params{foo} = $db_row->{whatever}; I used to think making everything very dynamic was a good idea. I don't anymore. There's a bunch of cases where being specific can make the c

[Mojolicious] Re: Deployment: launch hypnotoad on boot

2016-07-27 Thread Jan Henning Thorsen
I just use cron for starting on boot: $ crontab -l @reboot /path/to/myserver.sh 1>>/path/to/log/file.log 2>>/path/to/log/file.log The reason why I have a shell script first is to set up %ENV and friends. If you don't need that, then you can just point directly to the application. I also so

Re: [Mojolicious] Re: Secrets Question

2016-06-28 Thread Jan Henning Thorsen
How does the start of that package look like? Do you have this: package MyApp; use Mojo::Base "Mojolicious"; The string after "package" need to match whatever you pass on to start_app(). Another thing: I would not run my code as "root". If you want to listen to port 80, I would advice usin

[Mojolicious] Re: Wishlist thread (fourth edition)

2016-06-23 Thread Jan Henning Thorsen
When it comes to JSON validation, I would like to mention... - https://metacpan.org/pod/JSON::Validator - Much more up to date than JSON::Schema - https://metacpan.org/release/Swagger2 - Framework for building REST APIs - https://metacpan.org/pod/Mojolicious::Plugin::OpenAPI - Going to be succes

[Mojolicious] Re: Competing for exclusive flag among toad workers

2016-05-22 Thread Jan Henning Thorsen
A more interesting questions is "why do you want this?" This comes up from time to time, and often the right solution is to run another daemon in parallell. On Friday, May 13, 2016 at 9:19:03 AM UTC+2, Matija Papec wrote: > > I would like to give exclusive flag to one of the workers in a way th

[Mojolicious] Re: Using IO::Loop on websocket connection

2016-05-02 Thread Jan Henning Thorsen
I don't get why you put that code inside delay(). I would suggest moving it out of delay and right into the websocket sub. What are you trying to accomplish by putting it inside delay()? On Friday, April 29, 2016 at 3:20:29 PM UTC+2, Matija Papec wrote: > > > When I set websocket events inside

[Mojolicious] Re: Posting with useragent after rendering

2016-04-28 Thread Jan Henning Thorsen
Ivan: It's not a safe thing to do "something else" after the request has been sent to the client. At least not if you use hypnotoad / prefork. The reason for this is that the children gets recycled from time to time, and doing that might kill the outgoing request. I would much rather suggest pu

[Mojolicious] Re: How to use production.log under command line ?

2016-03-23 Thread Jan Henning Thorsen
Oh! I missed out on "debug.log" as well. Could it be wrong file permissions? There's a lot that can go wrong when running from "cron". I normally add "1>/tmp/cron-app-tmp.log 2>&1" when I can't figure out what is going on. On Wednesday, March

[Mojolicious] Re: How to use production.log under command line ?

2016-03-23 Thread Jan Henning Thorsen
Have you tried "perl /home/lab/MyApp get -m production /update?filter=opened" ? For more information: mojo get --help On Wednesday, March 23, 2016 at 12:09:37 PM UTC+1, Pavel Serikov wrote: > > I'm calling one of route of my Mojolicious::Lite app via cron, using > command-line > interface

Re: [Mojolicious] What's the proper way to exit morbo server

2016-03-19 Thread Jan Henning Thorsen
Why do you need that? On Friday, March 18, 2016 at 7:00:43 AM UTC+1, BINLEI XUE wrote: > > Hi, > > Call exit only exit the process of morbo, but the script process is still > running. > > Any idea about how to gracefully shutdown? > -- You received this message because you are subscribed to the

[Mojolicious] Re: How to restrict quantity of the concurrent connections TO REMOTE server using Mojo::UserAgent

2016-03-10 Thread Jan Henning Thorsen
There's no limit on how many connections Mojo::UserAgent can make, so you have to restrict that yourself. Something like this might work: my $mainarray = []; my $ua = Mojo::UserAgent->new; my $gather; $gather = sub { my ($ua, $tx) = @_; my $graphname = "whatever"; $tx->res->c

Re: [Mojolicious] Re: Hosting Mojolicious project in web Server

2016-02-29 Thread Jan Henning Thorsen
I think the answers depends on your situation, but here is what I do, both at work and in personal projects: 1. Deploy with morbo, plackup, hypnotoad "morbo" is not a best practice. You need very specific reasons to use that in production. "morbo" is for development, because it has the ability t

Re: [Mojolicious] Re: Hosting Mojolicious project in web Server

2016-02-26 Thread Jan Henning Thorsen
; > $ENV{PLACK_ENV} = 'production'; > $ENV{MOJO_HOME} = '/path/app'; > $ENV{MOJO_MODE} = 'deployment'; > > > SetHandler perl-script > PerlResponseHandler Plack::Handler::Apache2 > PerlSetVar psgi_app /path/app > AllowOverride

[Mojolicious] Re: Hosting Mojolicious project in web Server

2016-02-22 Thread Jan Henning Thorsen
application. Best regards, Jan Henning Thorsen On Monday, February 22, 2016 at 2:44:57 PM UTC+1, mouleeshwara...@jothisoftware.com wrote: > > Hello everyone, i had completely developed an application in perl with > mojolicious framework. since i am new to perl and its frameworks i don'

[Mojolicious] Rewriting Mojolicious::Plugin::AssetPack

2016-02-21 Thread Jan Henning Thorsen
Hi, I've been working on a rewrite of Mojolicious::Plugin::AssetPack for quite some while. I first thought about making a completely new plugin, but I think I can make the old and the new co-exist for a while before dropping the old API. Please have a look at these resources for more informati

Re: [Mojolicious] How include HTML as HTML in templates?

2015-11-30 Thread Jan Henning Thorsen
You can also turn the string into a ByteStream object: # this... use Mojo::ByteStream "b"; my $x = b "hello!"; $c->stash(x => $x); # or this... $c->stash(x => $c->b("Hello!")); https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Plugin/DefaultHelpers.pm#b On Monday,

[Mojolicious] Re: Mock Useragent calls in controller for testing

2015-11-13 Thread Jan Henning Thorsen
What I do is that I have a "base url" that I can override. That way I can make the requests go the the local process instead of to the internet. You can have a look here for an example https://github.com/jhthorsen/mojolicious-plugin-stripepayment/blob/master/lib/Mojolicious/Plugin/StripePayment.

Re: [Mojolicious] Singleton(s) and workers

2015-10-31 Thread Jan Henning Thorsen
is hosted)... Is > there one? > > Thanks, > > -- > Boris > > > > Le 23/10/2015 21:10, Boris Baldassari a écrit : > > Le 23/10/2015 12:22, Jan Henning Thorsen a écrit : > >> If it's not critical that changes in the file is visible instantly,

Re: [Mojolicious] Singleton(s) and workers

2015-10-23 Thread Jan Henning Thorsen
hypnotoad would be the way to go. How could I do that > from the code itself, apart from executing shell commands? > > Another option would be to load the data at startup, and write it down to > the disk on shutdown (through a END sub). Not sure about the reliability of > such a so

Re: [Mojolicious] Singleton(s) and workers

2015-10-22 Thread Jan Henning Thorsen
Could you give some more details/examples on what kind of information that is changed during run? Also, how often does this information change? Reason for asking, is that you might come up with a far too complicated solution for this. In some cases, it would be enough to just change the config

[Mojolicious] Re: How to get list box selected values in controller

2015-10-15 Thread Jan Henning Thorsen
What is an list box? Is it a ? If so, just access the data using $c->param("select_name"). If it's a , then you need $c->every_param("select_name") On Wednesday, October 14, 2015 at 11:50:00 AM UTC+2, Ragini Prasad wrote: > > I have a list box on my form and I want to retrieve the selected opt

[Mojolicious] Re: Architectural question - Best practice?

2015-10-02 Thread Jan Henning Thorsen
In this case, I don't think I would go for a lite app, but rather create controller classes and a full app. You can then do things like: package MyApp::Controller::User; use Mojo::Base "Mojolicious::Controller"; sub some_action { my $c = shift; $c->render(text => "both app

[Mojolicious] Re: Are you using Mojolicious::Plugin::AssetPack and assets in memory?

2015-09-25 Thread Jan Henning Thorsen
memory leak I will hopefully make a standalone reloader module. Not sure yet. The original implementation was one ugly hack, so I'm glad I took that out. On Tuesday, September 22, 2015 at 3:42:43 PM UTC+2, Jan Henning Thorsen wrote: > > Hey, > > I want to remove the support for

[Mojolicious] Are you using Mojolicious::Plugin::AssetPack and assets in memory?

2015-09-22 Thread Jan Henning Thorsen
e of this functionality, so I might just remove it without a warning even if it's not documented as EXPERIMENTAL. Best regards, Jan Henning Thorsen, aka batman -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from

[Mojolicious] Re: hypnotoad vs uwsgi

2015-09-11 Thread Jan Henning Thorsen
I don't see how uwsgi would give you anything extra. Can you explain? When it comes to number of connections, you should make your application non-blocking. At work I went from 80+ workers to 8 after I changed from blocking code to non-blocking code. The reason is that Mojo::IOLoop is able to m

Re: [Mojolicious] Using hypnotoad with upstart

2015-09-10 Thread Jan Henning Thorsen
If you run hypnotoad in the foreground, you can't do hot reload. I would say you're better off with prefork unless you need hot reload: $ yourapp.pl prefork -h If you know of an "init script to upstart adapter", you could use Toadfarm https://metacpan.org/pod/Toadfarm#SYNOPSIS which provide

[Mojolicious] Re: Mojo::IOLoop and epoll bug?

2015-09-10 Thread Jan Henning Thorsen
I cannot replicate the issue I "fixed" in Mojo::Redis2 without EV installed. On Thursday, September 10, 2015 at 2:54:39 PM UTC+2, sri wrote: > > Also confirmed on OS X with kqueue. >> > > Actually i was wrong, because now i can't replicate the problem anymore. > > -- > sebastian > -- You recei

[Mojolicious] Re: Mojo::IOLoop and epoll bug?

2015-09-10 Thread Jan Henning Thorsen
I've experienced the same issue: https://github.com/jhthorsen/mojo-redis2/issues/12 I think this is an EV issue, which can't be fixed by Mojolicious. I could be wrong though. On Wednesday, September 9, 2015 at 4:42:59 PM UTC+2, Хозов Андрей wrote: > > I have a strange behavior Mojo::IOLoop::Cl

[Mojolicious] Re: Terminating mojolicious application

2015-07-31 Thread Jan Henning Thorsen
> restarted. Some > ​​events will be lost in this case. So I think you need to catch > terminating application event. > > There is another option to catch TERM and QUIT signals. But it doesn't > look too reliable. > > > On Fri, Jul 31, 2015 at 9:27 PM, Jan Henni

[Mojolicious] Re: Terminating mojolicious application

2015-07-31 Thread Jan Henning Thorsen
It sounds like you're seeking the wrong solution, but it's impossible to tell for sure without more detailed information. If you're on the right track, then maybe you need END {...}, but there's no guaranties for any of these solutions to actually work. On Friday, July 31, 2015 at 5:51:41 PM U

Re: [Mojolicious] Automatically extend user session expiration when active websocket connection only

2015-07-28 Thread Jan Henning Thorsen
Finally I got the new computer set up :-) Anyway... Here is the code: https://ssl.thorsen.pm/paste/4313bc059551 On Saturday, July 25, 2015 at 7:06:49 AM UTC+2, Александр Грошев wrote: > > I will wait. Thanks > -- You received this message because you are subscribed to the Google Groups "Mojol

Re: [Mojolicious] Form validation and redirects

2015-07-28 Thread Jan Henning Thorsen
use third party login services. On Tuesday, July 28, 2015 at 1:37:41 AM UTC+2, Stefan Adams wrote: > > > On Fri, Jul 24, 2015 at 4:07 AM, Jan Henning Thorsen < > jan.henn...@thorsen.pm> wrote: > >> The only reason to do a redirect is when you want to avoid the "d

Re: [Mojolicious] Automatically extend user session expiration when active websocket connection only

2015-07-24 Thread Jan Henning Thorsen
I wasn't disagreeing with the first suggestion. It is also a lot simpler. I was simply suggesting another way of transferring the same cookie as data over the ws connection and set it on client side. I'm unable to make a code example to make it easier to understand, since I currently don't have

[Mojolicious] Re: Form validation and redirects

2015-07-24 Thread Jan Henning Thorsen
"variant", "template" or if/else inside the template. You decide what is best. -- 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+unsubscr...@googlegrou

Re: [Mojolicious] Automatically extend user session expiration when active websocket connection only

2015-07-24 Thread Jan Henning Thorsen
I suppose you can also transfer a new version of the session cookie over the websocket, and then use document.cookie do write this new verified cookie on the client side. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this

[Mojolicious] Form validation and redirects

2015-07-24 Thread Jan Henning Thorsen
You should render() when the posted data contain invalid input. Actually, you should almost always render(). The only reason to do a redirect is when you want to avoid the "do you want to repost the form" when someone click the "refresh wheel" or F5. Remember that you can easily render a comple

[Mojolicious] Re: Mojo::mysql parsing uri

2015-07-17 Thread Jan Henning Thorsen
You need to escape the password to make it a valid URL. Something like this will do: my $uri = sprintf 'mysql://%s:%s@%s/%s', map { Mojo::Util::url_escape($_) } $user, $pass, $host, $dbname; On Thursday, July 16, 2015 at 5:54:25 PM UTC+2, Richard Sugg wrote: > > I ran into an issue where the d

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

2015-06-17 Thread Jan Henning Thorsen
Out of curiosity, why don't you use HTTPS everywhere? On Sunday, June 14, 2015 at 2:07:13 PM UTC+2, Ivan Kolisnyk wrote: > > Hello everybody. > I'm developping CMS for web on Mojolicious. I have a problem with setting > up a link from admin part under https protocol to client part under http > p

Re: [Mojolicious] Get at name of current template?

2015-06-03 Thread Jan Henning Thorsen
While developing, you can see which templates are rendered on screen, with either: $ morbo script/yourapp.pl $ MOJO_LOG_LEVEL=debug perl script/yourapp.pl daemon You will then see something like this in the log: [Wed Jun 3 10:39:22 2015] [debug] Rendering template "index.html.ep" [Wed Jun 3 1

[Mojolicious] Re: Mojolicious Preforking

2015-06-03 Thread Jan Henning Thorsen
I don't undestand what you're doing... Why are you looking at the hypnotoad source code? Are you building a web application or a TCP/web server? Also, why are you looking at version 4.60. That is very old. Current version is 6.11. If you're looking for how to make a web application, I would sta

[Mojolicious] Re: toadfarm - how to tell which domain is calling app ?

2015-05-13 Thread Jan Henning Thorsen
You should also be able to use: $domain = $c->req->url->to_abs->host; On Wednesday, May 13, 2015 at 1:55:45 PM UTC+2, mjb152 wrote: > > apologies for self answering, but it might be of use to somebody else. > > my $base = $self->req->headers->header('X-Request-Base'); > -- You received this m

Re: [Mojolicious] Perhaps missing something...but emulate SSH terminal session?

2015-05-13 Thread Jan Henning Thorsen
I've implemented a basic terminal: https://metacpan.org/pod/App::screenorama You can try it out with something like this: SCREENORAMA_STDIN=1 screenorama daemon -- bash I've been looking at stealing some code from https://github.com/chjj/term.js to make arrow keys work, but haven't gotten to

[Mojolicious] Re: coro interface to Mojolicious

2015-05-13 Thread Jan Henning Thorsen
I haven't done this myself, but looks like sri drafted an idea which you might get some ideas from: https://gist.github.com/kraih/6082061 On Friday, May 8, 2015 at 3:57:57 PM UTC+2, Eugene Toropov wrote: > > Greetings, > > Is there a working recipe to run mojo application in “coro mode” so that

[Mojolicious] Re: is mojoconf 2015 really canceled?

2015-05-06 Thread Jan Henning Thorsen
I can confirm. I updated http://www.mojoconf.com today. On Tuesday, May 5, 2015 at 10:28:29 PM UTC+2, Karl Boehnker wrote: > > I saw this today: > http://blogs.perl.org/users/brian_d_foy/2015/05/mojoconf-is-cancelled-im-scrambling-to-do-something-anyway.html > > Can anyone else confirm or deny?

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-05-01 Thread Jan Henning Thorsen
Check out these resources for running behind nginx: * https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/BehindReverseProxy.pod * https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/RunningToadfarm.pod#Init-script * https://metacpan.org/pod/distribution/Mojolicious

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-30 Thread Jan Henning Thorsen
I wonder what kind of output you expect... So when I start the test apps with log level "debug", I see this in test1/log/development.log [Thu Apr 30 23:09:30 2015] [debug] Routing to a callback [Thu Apr 30 23:09:30 2015] [debug] Rendering template "index.html.ep" [Thu Apr 30 23:09:30 2015] [debug

[Mojolicious] Re: Troubleshooting Hypnotoad Workers

2015-04-27 Thread Jan Henning Thorsen
Nathan: Maybe you could write an extension (a command or plugin) to Toadfarm, if it doesn't do what you want already: https://metacpan.org/pod/Toadfarm https://metacpan.org/pod/Toadfarm::Manual::RunningToadfarm On Tuesday, April 28, 2015 at 7:37:46 AM UTC+2, sri wrote: > > I was hoping to be ab

Re: [Mojolicious] [Security] Mojolicious 6.10 (user/group assignment)

2015-04-27 Thread Jan Henning Thorsen
These are the issues I know of: * If you only specify "user", then the workers will run with the groups of "root". * If you specify a "group", then the workers will only run as that group and not all the secondary groups of the user you specified. On Monday, April 27, 2015 at 10:39:57 AM UTC+2

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-27 Thread Jan Henning Thorsen
Pickup domain1 and domain2: Oh! I've forgot to document that the matching headers can also take a regex. I will fix that later today. So... you can either of these works: # use a regex mount "test1" => {Host => qr/domain\d+\.com/}; # ...or mount the same app twice mount "test1"

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-26 Thread Jan Henning Thorsen
Please don't say code you haven't run doesn't work or doesn't work the way you expect. It makes it impossible to help. > On 26. apr. 2015, at 17.22, mjb152 wrote: > > that was a bad example from my side, I'll play with the config below and > transfer in another domain to test it .. > > moun

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-26 Thread Jan Henning Thorsen
The config below is not possible. You can't "merge" two apps at the same mount_point, and you don't need "Host" if you're not trying to filter on the value. mount "/home/mojouser/apps/test1/script/test1"=> {mount_point => "/"}; mount "/home/mojouser/apps/test2/script/test2"

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-26 Thread Jan Henning Thorsen
gt; Don't delay dinner !!, I'm running now and starting to play around with it. > > thx > > On Sat, Apr 25, 2015 at 5:41 PM, Jan Henning Thorsen < > jan.henn...@thorsen.pm> wrote: > >> I'm guessing "sudo" doesn't inherit the PATH from your us

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-25 Thread Jan Henning Thorsen
I'm guessing "sudo" doesn't inherit the PATH from your user, so it doesn't find hypnotoad. I guess I could make Toadfarm a bit more clever when it comes to finding "hypnotoad", but I'm making dinner now so the "improvement" won't be available until tomorrow. Anyhow, try running "sudo -E" instea

Re: [Mojolicious] change from morbo to hypnotoad for multiple domains

2015-04-25 Thread Jan Henning Thorsen
Thanks Stefan! mjb152: Good timing, since I just released a much simpler Toadfarm yesterday :) I think it will fit your needs perfectly. Please let me know if there's anything you think is complicated or not very intuitive about it. https://metacpan.org/pod/Toadfarm https://metacpan.org/pod/di

Re: [Mojolicious] app in a model

2015-04-20 Thread Jan Henning Thorsen
d be great if someone could provide a link. > Thank you. > > Cheers > Eugene > > On Apr 20, 2015, at 11:49 AM, Jan Henning Thorsen > wrote: > > It's so funny how this questions comes up over and over again. I even have > to battle it myself from time to time, even

Re: [Mojolicious] app in a model

2015-04-20 Thread Jan Henning Thorsen
in? I feel it doesn’t seem good > but can’t find any other way in Mojo to do it so thought someone had found > the solution... > > Cheers > Eugene > > On Apr 20, 2015, at 11:18 AM, Jan Henning Thorsen > wrote: > > I pass on $db to every instance of a model in MCT: &

Re: [Mojolicious] app in a model

2015-04-20 Thread Jan Henning Thorsen
ata are > and how to fetch it and pass to controller? Also it’s simply inconvenient > to always have one (or even 2 - app->db and app->redis for example) > arguments passed to every model, no? > > Cheers > Eugene > > On 20 Apr 2015, at 10:07, Jan Henning Thors

[Mojolicious] Re: app in a model

2015-04-20 Thread Jan Henning Thorsen
You don't. Passing $app or $c to a model is not a good idea. Reason for this is that it makes it hard to reuse the models elsewhere. What you can do, is passing data from $app when you construct your models, but I would strongly advice against passing $app. On Friday, April 17, 2015 at 4:38:06

Re: [Mojolicious] How to have a non-blocking 'any' route, which proxies multiple method requests?

2015-04-12 Thread Jan Henning Thorsen
Are you building a proxy..? Maybe you want to have a look at either of these: https://metacpan.org/pod/Mojolicious::Plugin::Proxy https://github.com/mojoconf/MCT/blob/master/lib/MCT/Plugin/ACT.pm On Saturday, April 11, 2015 at 11:06:03 PM UTC+2, Charlie Brady wrote: > > > On Sat, 11 Apr 2015, Da

[Mojolicious] Re: Troubleshooting Hypnotoad Workers

2015-04-07 Thread Jan Henning Thorsen
About SO_REUSEPORT: https://metacpan.org/pod/Mojo::Server::Daemon#reuse http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Zero-downtime-software-upgrades On Monday, April 6, 2015 at 8:12:31 PM UTC+2, Nathan Waddell wrote: > > Yeah, I concur that the standard hot swap model probably isn't co

[Mojolicious] Re: Troubleshooting Hypnotoad Workers

2015-04-06 Thread Jan Henning Thorsen
No, sending USR2 (not reloading) to a foreground process does not make any sense. http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#USR2 On Monday, April 6, 2015 at 5:58:10 PM UTC+2, Nathan Waddell wrote: > > I was hoping to be able to take advantage of hot swapping, but the service > manager d

Re: [Mojolicious] Hypnotoad Feature Request: -v and --version

2015-04-06 Thread Jan Henning Thorsen
No. On Monday, April 6, 2015 at 5:13:08 PM UTC+2, Nathan Waddell wrote: > > Thanks, Glen. That's exactly what I'm using at the moment, but would a > patch to Mojolicious::Command::hypnotoad that provides the same > functionality be seen as having value? > > On Friday, April 3, 2015 at 4:43:05 PM

[Mojolicious] Re: Troubleshooting Hypnotoad Workers

2015-04-06 Thread Jan Henning Thorsen
Why do you use hypnotoad if running in the foreground? I don't see any benefit over using "prefork": $ perl /path/to/app.pl prefork On Monday, April 6, 2015 at 5:11:26 PM UTC+2, Nathan Waddell wrote: > > Thanks for the advice and input. > > I am running Hypnotoad underneath a UNIX service mana

[Mojolicious] Re: Why does Mojo::Server::Daemon debugging print to STDERR?

2015-04-06 Thread Jan Henning Thorsen
That is simply not true. STDERR is not just for "errors", despite the name. It is also for diagnostic messages, and pretty much anything that should not be considered the "regular ouput" from the application. I will never vote in favor of allowing any such DEBUG messages (enabled by an environm

[Mojolicious] Re: Troubleshooting Hypnotoad Workers

2015-04-04 Thread Jan Henning Thorsen
Sounds like you have very bad code running... Do you have a reverse proxy infront of hypnotoad? If you have nginx, I would probably count how many 499, 500, 502 and 504 you got in the access log, compared to 200. I suspect the number is very high. About "no heartbeat": https://metacpan.org/pod

Re: [Mojolicious] Re: Why does Mojo::Server::Daemon debugging print to STDERR?

2015-04-04 Thread Jan Henning Thorsen
Note that MOJO_DAEMON_DEBUG (and similar environment variables) does not use Mojo::Log, but simply print to screen using "warn": https://metacpan.org/source/SRI/Mojolicious-6.05/lib/Mojo/Server/Daemon.pm#L193 The reason I don't want them to screen is that they would clutter the "real" output fr

[Mojolicious] Re: Mojo::IOLoop::Delay

2015-03-15 Thread Jan Henning Thorsen
I agree! Very constructive. On Saturday, March 14, 2015 at 4:44:50 PM UTC+1, sri wrote: > > My research on this topic: >> http://rec.data-flow.ru/articles/2015/3/circular-references-memory-leaks-and-mojo.html >> >>

Re: [Mojolicious] Re: Strange route behavior

2015-02-15 Thread Jan Henning Thorsen
UTC+1, Stanislav Blinov wrote: > > Thanks! I have disabled format detection and it works. > Is there any way to disable it globally, without creating a separate > 'under' route? > > 2015-02-15 14:05 GMT+03:00 Jan Henning Thorsen : > >> The extension is not part of th

Re: [Mojolicious] Re: Strange route behavior

2015-02-15 Thread Jan Henning Thorsen
ear to only numerics: month => > qr/\d{2}/, year => qr/\d{4}/ > Why it matches .html? > Also, this route: $cms_route->route('/members/branches')->to(controller > => 'Admin::Members', action => > 'edit_branches_list')->name('ed

[Mojolicious] Re: Strange route behavior

2015-02-15 Thread Jan Henning Thorsen
The reason is that you have default values set for :year and :month, so they get "filled in", when not specified. On Sunday, February 15, 2015 at 10:43:27 AM UTC+1, Stanislav Blinov wrote: > > Hi, > I have a route: > $r->get('/news/:year/:month' => [month => qr/\d{2}/, year => > qr/\d{4}/])->t

[Mojolicious] Re: Interactive debugging in Mojolicious tests

2015-01-30 Thread Jan Henning Thorsen
Most tests are plain perl scripts, so you should be able to just do perl -d t/mytest.t On Friday, January 23, 2015 at 12:31:31 AM UTC+1, Daniel Mantovani wrote: > > > I wonder if there is a recommended way to run Mojolicious tests under > perl debugger. > > Actually I saw that if you write

[Mojolicious] Re: Swagger2: "The World's Most Popular Framework for APIs"

2015-01-03 Thread Jan Henning Thorsen
I've put a demo of the editor online now if anyone wants to see. https://ssl.thorsen.pm/swagger2 On Wednesday, December 17, 2014 1:56:54 PM UTC+1, Jan Henning Thorsen wrote: > > Version 0.12 contains a mojo command which can validate and generate pod. > It also contains a webserv

Re: [Mojolicious] How to use string as a subroutine ref in Mojo?

2014-12-18 Thread Jan Henning Thorsen
Yes. That is what I tried to write :-) On Thursday, December 18, 2014 12:41:39 AM UTC+1, Charlie Brady wrote: > > > On Wed, 17 Dec 2014, Jan Henning Thorsen wrote: > > > Pavel, you can do this: > > > > my $b = __PACKAGE__->can($a); > > $b->("s

[Mojolicious] Re: Swagger2: "The World's Most Popular Framework for APIs"

2014-12-17 Thread Jan Henning Thorsen
0.12 while fixing another bug with $ref's that was not expanded. Patches are welcome to get it back in. (I will look at it as soon as I have the opportunity) On Friday, December 12, 2014 7:42:53 AM UTC+1, Rajasekar Venkatesan wrote: > > Hi, > > > On Tuesday, 9 December 2014

Re: [Mojolicious] How to use string as a subroutine ref in Mojo?

2014-12-17 Thread Jan Henning Thorsen
Pavel, you can do this: my $b = __PACKAGE__->can($a); $b->("stuff") if $code; You can replace __PACKAGE__ with whatever package name you want. The special symbol "__PACKAGE__" contains the current package, can() returns a ref to a function/method if $a has the correct method name which can be f

  1   2   >