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

IRC log for #mojo, 2017-07-24

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

All times shown according to UTC.

Time Nick Message
00:00 zach Man I just kept staring at it, Galileo, and the Mojo guide like WTF am I doing wrong it looks exactly the same
00:32 zach Grinnz: new issue, the :token coming in gets truncated after the first .
00:32 Grinnz https://metacpan.org/pod/Mojolicious::Guides::FAQ#Where-did-my-file-extension-go?
00:34 zach are you kidding?
00:34 Grinnz ...no?
00:34 zach so I have to say, $t = $token + $self->param('format');
00:34 Grinnz no, you should use a relaxed placeholder
00:35 Grinnz since you want it to contain .
00:36 zach so instead of :token, #token ?
00:36 Grinnz yes
00:36 zach hmmm, let me try that real quick
00:41 zach awesome, works
02:04 noganex_ joined #mojo
02:49 kiwiroy joined #mojo
03:11 kiwiroy joined #mojo
03:42 kiwiroy joined #mojo
03:50 PryMar56 joined #mojo
03:57 kiwiroy joined #mojo
04:08 kiwiroy joined #mojo
04:42 kiwiroy joined #mojo
04:44 brunoramos joined #mojo
05:10 kiwiroy joined #mojo
05:11 inokenty-w joined #mojo
05:26 zach the sub is mojo pg is what makes it async, right?
06:07 bianca joined #mojo
06:18 dod joined #mojo
06:41 Lee joined #mojo
07:25 trone joined #mojo
07:41 AndrewIsh joined #mojo
07:41 Vandal joined #mojo
07:41 dod joined #mojo
07:47 crab joined #mojo
07:54 good_news_everyon joined #mojo
07:54 good_news_everyon [mojo] kraih tagged v7.37 at e0c7441: https://git.io/v7LER
07:54 good_news_everyon left #mojo
07:56 good_news_everyon joined #mojo
07:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v7LE2
07:56 good_news_everyon mojo/master 691cfd7 Sebastian Riedel: bump version
07:56 good_news_everyon left #mojo
08:24 petru_ joined #mojo
08:28 rshadow joined #mojo
09:26 karjala_ joined #mojo
09:27 karjala_ Grinnz, hi, I have an issue, and was wondering whether you could help me, with your experience on SQLite
09:28 karjala_ My main.pl file launches 10 forked children, each of which tries to write a row to the same sqlite database every second or so approximately.
09:28 karjala_ Is this a bad idea?
09:29 karjala_ Anyway, it *mostly* works, but at times, children die with this error:
09:29 karjala_ DBD::SQLite::st execute failed: database is locked at ./grab.pl line 174.
09:29 karjala_ grab.pl = main.pl
09:29 karjala_ Am I doing something wrong?
09:30 karjala_ Children open a DBI connection to SQLite when they are launched, and keep that connection open until their end.
09:32 karjala_ Thanks
09:40 karjala_ I chose sqlite as my database, over BDB, because I thought it allowed multiple processes to edit at (approximately) the same time. What did I do wrong?
09:45 nicomen PRAGMA journal_mode=WAL; ?
09:53 dod joined #mojo
09:53 bianca joined #mojo
10:46 prg joined #mojo
10:55 karjala_ nicomen, I set no_wal specifically so that I would be able to inspect the resulting .db file in the end with command-line sqlite3 utility (which is old)
10:55 karjala_ Is that the reason why the errors are happening?
11:20 tchaves joined #mojo
11:27 petru_ joined #mojo
11:28 dod joined #mojo
11:30 bianca joined #mojo
12:16 karjala_ Grinnz, I think I understood what was going wrong... Parent called $sql->db before the call to fork(). Child also called $sql->db (in a different scope). I think child was given the same object as parent, which I shouldn't do. I'm not sure, i just think so.
12:16 karjala_ So I did: $sql->db->dbh->disconnect, and then again: my $db = $sql->db;
12:16 karjala_ Am I right in my diagnosis, Grinnz ?
12:42 sri jberger: maybe an opportunity for collaboration? https://github.com/kraih/mojo/pull/1112
12:46 dod joined #mojo
12:47 meredith sqlite handles should be okay to hold across forks.  that lock error fires when it waits too long to get the lock from another writer
12:47 meredith which could be just a long operation, or holding a transaction open too long
12:48 meredith you can set a longer timeout, but that means anyone waiting to write is just going to block longer, so it's better to look at what could be a lock-holder first
13:08 bwf joined #mojo
13:13 petru_ joined #mojo
13:22 itaipu joined #mojo
13:26 gizmomathboy joined #mojo
13:28 Pyritic joined #mojo
13:43 karjala_ meredith, if by "sqlite handles" in the phrase "sqlite handles should be okay to hold across forks", you mean $dbh object, I think that you'll find DBD::SQLite documentation to say the opposite.
13:43 karjala_ I'll find it
13:44 karjala_ https://metacpan.org/pod/DBD::SQLite#DBD::SQLite-and-fork()
13:50 jabberwok joined #mojo
13:53 gryphon joined #mojo
13:58 marty joined #mojo
14:02 Pyritic joined #mojo
14:34 bianca joined #mojo
14:37 orev joined #mojo
14:53 bianca joined #mojo
14:57 Grinnz karjala: concurrent writes work best with wAL mode. maybe consider installing a newer sqlite3 utility
15:02 kgoess joined #mojo
15:20 zivester joined #mojo
15:21 karjala_ joined #mojo
15:22 karjala Grinnz: still, concurrent writes don't happen at the same time, even with WAL, right?
15:23 karjala ok
15:27 bianca joined #mojo
15:53 Grinnz karjala: yes, they do
16:08 rick_soc joined #mojo
16:09 rick_soc good morning
16:09 purl For you maybe.
16:12 rick_soc Quick question about using the I18N plugin
16:12 rick_soc Is there a recommended way of preserving the country code at the start of the URL, for links in rendered content
16:13 sh14 joined #mojo
16:14 * sri starts to wonder if this might actually end up in a good solution :o https://github.com/kraih/mojo/pull/1112
16:14 sri i only really hate this part https://github.com/kraih/mojo/pull/1112/files#diff-a497a33049109dc96208d13a14c1612aR294
16:15 rick_soc I'm thinking I probably need to grab the 2 letter code and prepend all the URLs in the template files, but wondering if there is a better way or automatic way to do this
16:16 PryMar56 joined #mojo
16:21 itaipu joined #mojo
16:22 CHYC joined #mojo
16:22 jberger sri I'll take a look later, I'm on my (almost) annual pilgrimage to Hawaii
16:22 jberger But evenings start early here. So I'll very a chance to take a peek
16:22 sri hehe
16:23 jberger If they can get that code over the finish line (or replace it compete, idk) I'll be overjoyed
16:26 sri definitely taking some shortcuts in the code, but nothing that can't be cleaned up
16:29 jberger Excellent
16:36 sri (at least as far as i can see after a quick review)
16:41 rick_soc oh yay
16:42 rick_soc I found an undocumented use of stash in the I18N plugin code, just need to use stash 'lang' in my templates to rebuild the URLs in my currently chosen language
17:13 Pyritic joined #mojo
17:15 dod joined #mojo
17:17 dod joined #mojo
17:17 sh14 joined #mojo
17:30 rick_soc joined #mojo
17:43 itaipu joined #mojo
17:48 rick_soc Slight problem with accessing stash 'lang'.  In my layout template that builds the menu, I've got an if defined line and if $lang exists, I set another variable for my prefix, if not then it is set as empty.
17:48 rick_soc But when the template renders, if $lang isn't set, it throws an error anyway, even though I'm checking if it is defined first.  So the rendering doesn't like me using it.
17:49 rick_soc Is there a good way to set this globally in the Controller, even if I don't have a sub for every page I'm rendering via that controller?
17:59 trone joined #mojo
18:00 rshadow joined #mojo
18:08 karjala_ joined #mojo
18:34 Pyritic joined #mojo
19:40 arcanez how can I specify a 'use lib' for plugins? ie: I have M::P::OpenAPI, but want to use the cloned git repo instead of the CPAN version for dev
19:41 preaction export PERL5LIB=... maybe?
19:43 arcanez I guess I could cheat and 'make install' from git :X
19:44 preaction or that
19:44 Pyritic joined #mojo
19:50 petru_ joined #mojo
20:01 bianca joined #mojo
20:29 rick_soc joined #mojo
20:31 ghandi joined #mojo
20:32 ghandi Hi there! I've got some troubles with exception handling in Mojo::UserAgent for async requests. How to handle errors like name resultion failes? Example: https://gist.github.com/ghandmann/f180bfa53576433f3eaae0d0244097b3
20:33 ghandi The Mojo::UA docs state in a comment in the synopsis that the useragent "dies on connection errors". Which seems only to be true for blocking requests?
20:40 Grinnz it occurs whenever you call ->result on the transaction object
20:41 Grinnz wrapping the nonblocking get in try/catch won't catch any errors that occur in the event loop
20:41 Grinnz a delay or future could help there
20:43 Grinnz https://metacpan.org/pod/Mojo::IOLoop#delay
20:43 Grinnz i find error handling to be easier to manage in futures, but there isn't a built in solution for that yet
20:43 Grinnz you would use https://metacpan.org/pod/Future::Mojo
20:47 ghandi Well than wrapping ->result() into a try-catch-block would work too?
20:49 Grinnz yes, that would let you catch the result there, and then you'd need to have the callback handle it somehow
20:50 Grinnz that's an alternative, but not always a feasible one for complex systems
21:17 rshadow joined #mojo
21:32 Peppard joined #mojo
21:33 bianca joined #mojo
21:37 rick_soc zzzz
21:37 rick_soc I solved my I18N url remapping dilemma by chaining calls to the controller
21:38 rick_soc ->to('pages#logged_in')->to('pages#lang_prefix') <-- hopefully this is an optimal way to do this
22:15 petru_ joined #mojo
22:17 tchaves joined #mojo
22:42 tchaves joined #mojo
23:27 kiwiroy joined #mojo
23:54 vicash rick_soc: you can use a hook like before_dispatch/after_dispatch http://www.mojolicious.org/perldoc/Mojolicious#before_dispatch
23:57 stryx` joined #mojo

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