The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-05-09

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:26 sri joined #mojo
00:30 Pierre joined #mojo
00:31 noganex joined #mojo
00:57 mib_80vmoo joined #mojo
01:10 Pierre joined #mojo
01:15 punter joined #mojo
01:31 dikim joined #mojo
01:54 itaipu joined #mojo
02:08 zivester joined #mojo
02:42 punter joined #mojo
02:49 noganex_ joined #mojo
02:49 maschine joined #mojo
02:54 mib_9kpytj joined #mojo
02:55 mib_9kpytj Hi there! I'm looking for best practices about using Mojolicious with Mysql, specially regarding closing connections even when generating 500 errors and connection pool
03:00 Grinnz i use DBIx::Connector. there's also Mojo::mysql. storing either object in a helper and retrieving handles from it in small scopes works well
03:00 Grinnz no need to close the connection on 500 errors. the connection may be shared among several simultaneous requests
03:01 Grinnz that's up to the connection pool object to manage
03:02 Grinnz example of storing object in a helper: https://metacpan.org/source/SRI/Mojo-Pg-3.05/examples/blog/lib/Blog.pm#L15 (you can also use a closed-over lexical variable instead of 'state')
03:03 mib_9kpytj Thanks Grinnz!
03:35 aborazmeh joined #mojo
03:57 mrallen1 joined #mojo
04:10 disputin joined #mojo
04:53 Grinnz joined #mojo
05:38 skaji joined #mojo
05:47 dod joined #mojo
05:52 dod joined #mojo
06:00 Pierre joined #mojo
06:53 AndrewIsh joined #mojo
06:53 Vandal joined #mojo
07:13 stryx` joined #mojo
07:17 prg joined #mojo
07:20 karjala_ joined #mojo
07:20 trone joined #mojo
07:21 dod joined #mojo
09:18 Pierre joined #mojo
09:24 gregf_ joined #mojo
09:29 karjala_ quick question: when (under hypnotoad/production) a route action 'die's, where/how is the error output logged?
09:40 karjala_ I mean, with systemd, how can I capture the error messages?
09:42 batman karjala_: i think it goes into syslog by default.
09:42 batman ...when using systemd
09:44 karjala_ this page is messed up: https://metacpan.org/search?q=mojolicious
09:48 nic heh, the Dancer equivalent works
09:48 nic I knew they'd be bitter about the poll results.  But this?  Really?
09:55 Pierre joined #mojo
10:41 jberger There was some bug in the search code, affected lots of searches, it has been reverted
10:44 karjala_ I can't find the "list of breaking changes" between versions of mojolicious: https://github.com/kraih/mojo/wiki
10:44 karjala_ could someone please provide the URL?
10:45 karjala_ (Accidentally updated Mojolicious somewhere)
10:46 karjala_ I have the URL on my home computer (but I'm at work now)
10:47 nic https://github.com/kraih/mojo/wiki/Upgrading
10:47 karjala_ thanks!
10:48 nic (the js on) that page is broken for me today -- I can't search or "See 41 more pages" -- probably just this browser
10:49 nic so I used google
10:52 Trick14 is there an easy table parser part of mojo dom?
10:57 nic yes, table parsing is reasonably easy; no, there's not an explicit part for it
11:00 Trick14 so it's find('tr')->each
11:00 Trick14 and for everyelement of that one find('td')->each
11:06 Xyem Trick14: I think you can turn a table into a 2D array like this: http://codepad.org/sGI5ioH7
11:08 Xyem For very simple tables, at least.
11:10 tchaves joined #mojo
11:20 itaipu joined #mojo
12:19 Trick14 thanks Xyem
12:25 Zx3 joined #mojo
13:13 gizmomathboy joined #mojo
13:23 stryx` joined #mojo
13:24 Grinnz karjala_: logs go to a folder called log/ in the application dir if that exists, otherwise to stderr (not very useful in hypnotoad)
13:27 karjala_ Doing a $app->log(Mojo::Log(path => $path)), I placed the log where I wanted
13:31 Armen a fine morning to all
13:31 karjala_ Good morning to you too, Armen
13:32 Grinnz karjala_: try overriding the log attribute instead. if you make a new bare log object it wont set level based on mode
13:32 karjala_ do you mean I should do this? $app->log->path($path) ?
13:32 Grinnz https://metacpan.org/source/SRI/Mojolicious-7.31/lib/Mojolicious.pm#L27
13:33 Grinnz no, define sub log in your app
13:33 Grinnz er attribute log
13:33 Grinnz include the last line there to set the level
13:34 karjala_ I'm a bit confused
13:34 karjala_ I shold define attribute log?
13:35 Grinnz yes to override the base with one that defaults to the path you want
13:35 Grinnz unfortunately setting path on an existing object won't work on a log object that has been used already which is why i made Mojo::Log::Clearable
13:36 Grinnz but overriding the attribute default is cleaner for setting path on startup
13:36 karjala_ ok
13:36 Grinnz i use both, override the default to return a Clearable so i can change the path later
13:48 Grinnz i wonder if i should have Clearable provide an option to globally add the clearer to Mojo::Log
13:48 Grinnz seems ugly but would be more convenient
13:49 CHYC joined #mojo
14:04 maschine joined #mojo
14:05 maschine joined #mojo
14:10 CHYC joined #mojo
14:16 karjala_ On my PC's development hypnotoad, I get MOJO_LOG_LEVEL affecting the log level of $app->log(Mojo::Log->new(path => $path)). On the server however it's as if MOJO_LOG_LEVEL has no effect. I wonder what might have gone wrong.
14:19 gregf_ joined #mojo
14:20 Grinnz i already told you that won't be affected by log level
14:21 karjala_ oh
14:21 cheako joined #mojo
14:21 karjala_ I thought you said it wouldn't be affected by mode
14:21 karjala_ ok
14:21 Grinnz oh right, sorry
14:23 Grinnz log level env should affect it
14:23 karjala_ I placed in my template <%= $ENV{MOJO_LOG_LEVEL} %> and I got blank
14:23 karjala_ is that normal?
14:23 karjala_ is that expected, if I have setup the env var?
14:23 karjala_ in systemd
14:24 Grinnz setting env var won't affect hot restart, you need to do a full restart if it's hypnotoad
14:24 karjala_ Does that mean I haven't set up the env var?
14:24 karjala_ ok
14:24 Grinnz that's why hypnotoad relies on config
14:24 karjala_ Should it be displayed in the template, though?
14:24 Grinnz not if you haven't set it
14:26 Grinnz also make sure you've done systemctl daemon-reload after editing the service file
14:29 Grinnz Environment= should go in a specific section in service file, can't check atm
14:31 karjala_ Everything fixed. Thanks Grinnz
14:42 dmanto joined #mojo
14:51 zivester joined #mojo
14:53 dmanto Hi!, when you use hypnotoad, is there a way to guarantee that same session hits same PID all the time?. Or it is round-robin all the time?
14:55 dmanto I mean, something similar to "session persistance" in load balancers, but between the main PID and the toads
14:59 Pyritic joined #mojo
15:01 Grinnz no
15:02 Grinnz use an external database or the session cookie if you need a common data store, but note the session cookie is visible in plain text
15:03 dmanto ah ok
15:05 Grinnz redis is also nice for such things if you don't have/want a full db
15:05 Grinnz i use it in conjunction with the relational db often
15:05 dmanto yes I agree
15:06 dmanto I'm using Mojo::Pg for this application, I will go with the pubsub pattern
15:06 Grinnz cool
15:54 vytas joined #mojo
16:01 jabberwok with Mojo::Pg, should I be concerned about calling 'hash' without 'finish' as in: >>  say $self->pg->db->query('select version() as version')->hash->{version}; << as the DBI docs suggest that finish() happens automatically when additional requests occur?  or should we write  ->hashes->first->{version} ?
16:23 tchaves joined #mojo
16:23 itaipu joined #mojo
16:28 PryMar56 joined #mojo
16:30 stryx` joined #mojo
16:41 Grinnz i tend to use ->hashes->first in Mojo::SQLite, but that's mostly because SQLite is finicky about open handles. in Pg there should be no difference (it calls ->finish when it goes out of scope)
17:01 Pyritic joined #mojo
17:04 ladnaV joined #mojo
17:21 Pyritic joined #mojo
17:36 dod joined #mojo
17:44 Pyritic joined #mojo
17:47 punter joined #mojo
17:50 disputin joined #mojo
17:54 punter joined #mojo
17:55 itaipu joined #mojo
18:16 howitdo joined #mojo
19:16 punter joined #mojo
19:49 jabberwok thanks Grinnz
19:55 Pyritic joined #mojo
20:37 jberger IIRC Pg doesn't really iterate the data anyway
20:48 dikim joined #mojo
20:54 CHYC left #mojo
21:06 someguy joined #mojo
21:07 someguy Is there a non-helper way to define blocks of templates that are shared between tempaltes, or is that exactly what helpers are for?
21:09 jberger That's a great use for helpers
21:09 * jberger boards the plane for PTS
21:09 jberger o/
21:34 someguy http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Restrictive-placeholders ... Are they available in a ::Lite?
21:34 someguy is it just get '/:id' => [ ... ] => sub {}?
21:37 Grinnz everything is available in Lite
21:42 disputin joined #mojo
22:44 punter joined #mojo
22:54 gizmomathboy joined #mojo
23:34 disputin joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary