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

IRC log for #mojo, 2015-04-30

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

All times shown according to UTC.

Time Nick Message
00:00 Grinnz lluad, you can. you just can't use the same $db, you should do $pg->db->query, $pg->db->query
00:01 lluad Oh, OK.
00:01 lluad Will they be the same database connection (i.e. can I use transactions)?
00:02 Grinnz no, that's the reason
00:03 Grinnz DBD::Pg async has some oddities that led to that change
00:03 lluad OK, that could be worse, I guess.
00:03 lluad Short term, some plpgsql will work. Longer term, beat up on DBD::Pg. :)
00:03 lluad Thanks!
00:06 basic6 joined #mojo
00:54 zivester joined #mojo
01:20 klapperl joined #mojo
02:35 davido_ joined #mojo
02:52 noganex joined #mojo
02:53 jberger I love stumbling on ancient CPAN modules: https://metacpan.org/pod/D::oh
02:53 jberger you'll especially like the tests (which are still passing!)
03:04 preaction wow. custom TAP output
03:20 inokenty-w joined #mojo
03:32 irq joined #mojo
03:55 basic6_ joined #mojo
04:09 kaare joined #mojo
04:10 melo joined #mojo
06:07 dod joined #mojo
06:13 dod joined #mojo
06:19 bramirez joined #mojo
06:24 inokenty-w joined #mojo
06:45 Lee joined #mojo
06:57 Vandal joined #mojo
07:13 eseyman joined #mojo
07:24 wariat joined #mojo
07:36 trone joined #mojo
07:39 amon joined #mojo
07:44 dod joined #mojo
07:47 sjn joined #mojo
07:58 dod joined #mojo
08:01 bramirez joined #mojo
08:16 jb360 joined #mojo
08:23 irq joined #mojo
08:40 fhelmber_ joined #mojo
08:45 dustinm joined #mojo
09:12 meshl joined #mojo
09:19 wariat_ joined #mojo
09:23 meshl joined #mojo
09:23 wariat joined #mojo
09:23 btyler Grinnz/mst: thanks a lot for taking a peek at my talk materials. talk went well, although apparently everyone hates the use of the fat comma leading to $d->begin
09:25 dod joined #mojo
09:25 wariat_ joined #mojo
09:31 wariat joined #mojo
09:43 meshl joined #mojo
09:51 batman btyler: haha. "everyone" is strange :)
09:51 batman you should lure them over with candy
10:04 noganex_ joined #mojo
10:09 btyler yeah I dunno. I guess I picked it up from the style delays use in the mojo docs
10:09 btyler and it makes sense to me
10:11 batman :)
10:14 marcus =>.<=
10:14 marcus batman: here at the dark side we lure people with *cookies*, not candy.
10:15 batman ok
10:22 marcus http://shirtoid.com/wp-content/uploads/2013/11/dark-side-of-the-rainbow-chip-cookie.jpg
10:25 marcus http://th03.deviantart.net/fs70/200H/i/2011/097/8/d/the_dark_side_have_cookies_by_darthmiller-d3df016.jpg
10:26 btyler the other bit of feedback was that it felt weird for the arguments from multiple concurrent actions in a single delay step to be flattened into the same list
10:26 btyler I guess as opposed to putting each action's args into an arrayref and passing those as the args to the next step
10:29 batman btyler: yeah, i can imagine... i don't really mind, since i rarely do more than maybe two things in one step
10:30 batman the exception is when i use Mojo::Redis2, but then i have https://metacpan.org/pod/Mojo::Redis2::Bulk#SYNOPSIS
10:30 btyler and if you have more, the actions were (probably) started in a loop, and you're (probably) processing them in a loop
10:32 batman makes sense :)
10:45 Kripton joined #mojo
11:13 McA joined #mojo
11:52 neilhwatson joined #mojo
11:59 polettix joined #mojo
12:02 nicomen is it possible to do Mojo::UserAgent calls in parallell on a backend that is not running non-blocking?
12:12 jberger nicomen: sure, if you can start the loop
12:12 jberger best way is $delay->wait
12:12 jberger that way the loop is started and then stopped again when done
12:13 nicomen but a loop _is_ already running basically right?
12:13 marcus nicomen: no?
12:13 marcus if a loop is running, you are non-blocking
12:13 nicomen oh I thought mojo accepted requests and handled as part of a loop
12:13 jberger nicomen: define "on a backend that is not running non-blocking"
12:13 nicomen right rigth, sorry
12:14 nicomen whqat I mean is, no code cares about non-blocking as it is. but can I cram in some parallell get requests, with a final call-back to render and it will "just work" ?
12:15 nicomen I remmebr you mentioning that once you have something that is blocking, all non-blocking code would not work?
12:15 marcus nicomen: you can't share user agent between blocking and non blocking code
12:15 jberger nicomen: remember that while any actual work is being done, the single execution thread is busy
12:16 jberger its only the waiting that can be ignored
12:16 nicomen hm, ok. I guess the best answer is to try of course ;)
12:16 nicomen thanks
12:16 jberger so if some part of your handler is doing "sleep 5" nothing else is happening
12:16 marcus nicomen: but note that if you're using PSGI you're not running non-blocking
12:18 nicomen marcus: right, so I understand that each child process is "sequential", what I wonder is if, I can do parallell requests in the middle of a blocking request. but like you said, I would need to ensure a loop is running
12:18 marcus nicomen: Mojo::IOLoop::Delay->wait will start it for you
12:19 nicomen great, thanks ;)
12:27 ajr_ joined #mojo
12:29 tchaves joined #mojo
12:31 bramirez joined #mojo
12:34 nf joined #mojo
12:39 polettix is this behaviour of $req->to_string() expected? https://gist.github.com/polettix/4811572938ecd4103fe6
12:39 polettix if not, I’ll file an Issue
12:41 polettix basically, it seems that calling to_string() “freezes” the $req object and that it’s not possible to change it any more. I hit me while doing some debugging.
12:41 polettix *It
12:48 bramirez joined #mojo
12:58 asarch joined #mojo
13:03 polettix I’ll just assume it’s a bug then :)
13:13 jberger polettix: I haven't ever called that method, but the documentation does look like perhaps that's what it is meant to do
13:13 jberger "Render whole message."
13:15 polettix well, it’s a bit vague to me. “render” might mean “give you a rendition” but does not imply that it freezes the object so that it cannot be rendered again, possibly after changing some parameters
13:15 polettix at least, this should be explicit in the documentation, otherwise it’s very easy to overlook
13:15 mtths joined #mojo
13:16 jberger polettix: but you don't do anything with the result? what is it that you would have it do?
13:16 Grinnz btyler, yeah, i tend not to use the fat comma in that spot, there's no reason to
13:16 jberger perhaps I'm coming with the bias that $c->render is rather "final"
13:16 jberger and so render has a certain context to me
13:16 polettix jberger: if you look at the example, the behaviour is different depending on wether to_string is called or not
13:17 polettix jberger: this is OK, but the fact is that after_dispatch allows you to do some last-minute mangling on the response
13:17 polettix and this mangling is performed fine *unless* you call to_string on the request object
13:17 btyler Grinnz: apparently it is a contentious issue :)
13:18 Grinnz heh
13:18 btyler I thought it fit nicely, as a way of distinguishing the bind params of the query from the callback/delay
13:19 jberger polettix: perhaps I'm blind, and I'm supposed to be working, but what is the difference between the two responses?
13:19 btyler but others said you should only use that if you're using an anon sub in that spot
13:19 jberger oh the header
13:19 purl the header is probably 'Referer:'
13:20 polettix jberger: the “Server” header is changed to “AnotherServer” in the working case, but is left to “Mojolicious (Perl)” in the not-working case
13:20 polettix changing the Server header is what is done in after_dispatch
13:21 polettix but of course I’m a… silly person and wrote “User-Agent” instead of “Server” in the comment!
13:21 Grinnz btyler, that distinction seems odd, i just wouldn't use it because there's no key => value relationship, and the first arg is not a bareword string
13:22 btyler Grinnz: well, I think it's by analogy to things like: get '/foobar' => sub ($c) { #... stuff! };
13:22 Grinnz yeah, that's a logical separation i guess
13:23 Grinnz but $delay->begin is just a callback
13:23 polettix jberger: I fixed the comment in the gist to make it clear
13:23 btyler well, so is that, right?
13:23 Grinnz right, i mean i dont see how that makes a difference ;)
13:24 btyler anyways, I was pleased enough that my usage of the fat comma was the one thing people took issue with
13:24 Grinnz hehe
13:26 btyler well, that and my cargo-cult usage of render_later
13:26 mtths joined #mojo
13:26 btyler forgot that you only need it if you'd normally be relying on automatic rendering by finding a template with the same name as the route
13:27 Grinnz yeah; i don't usually need it, because any time i need to turn off automatic rendering i'm using the delay helper which does it for you
13:27 btyler ah, nice
13:28 jberger btyler: what fat comma?
13:29 jberger <3 fat comma
13:29 btyler jberger: https://github.com/kanatohodets/delays-talk/blob/master/delay.pl#L30 for exmaple
13:29 btyler example, even
13:34 cpan_mojo Mojolicious-Command-migration-0.12 by LIKHATSKI https://metacpan.org/release/LIKHATSKI/Mojolicious-Command-migration-0.12
13:37 gryphon joined #mojo
13:50 mattastrophe joined #mojo
13:51 polettix I filed a pull request for a test about my problem, let’s see. Thanks all!
13:53 storskegg joined #mojo
13:53 storskegg @jberger o/
13:54 storskegg good morning all
13:54 jberger btyler: what's wrong with the fat comma there?
13:55 jberger btyler: do like sri and call it the "hash rocket"
13:55 jberger then no one will complain
13:56 romel :)
13:57 jberger jberger: the way you are using it isn't for the "quote the word on the left" since the thing on the left isn't a word
13:57 jberger therefore its just a comma
13:57 jberger and in that case it is a designation to the reader that you are thinking of it in terms of pairs, which you are
13:57 jberger hash rocket
13:58 jberger also, so everyone can be introduced, storskegg is a front-end dev at my $work who I'm corrupting to the dark side of Perl and Mojo ;-)
13:58 asarch Why <a href="file:///foo/bar/baz.txt">baz</a> doesn't work in the templates? If I copy the URL and paste it to another tab in Firefox it doest
13:59 asarch When I clic the link, it doesn't open the selected file
14:00 btyler jberger: I don't think there's anything wrong with it, but it was sufficiently confusing to a room full of professional perl people that it was the most-discussed question after my talk on delays
14:01 jberger btyler: that is really surprising
14:01 shadowpaste "asarch" at 217.168.150.38 pasted "<!DOCTYPE html> <html> <head>" (61 lines) at http://paste.scsys.co.uk/475384
14:01 btyler well, maybe 'confusing' isn't the word -- the room consensus seemed to me that it was a misleading stylistic choice
14:01 btyler *seemed to be
14:01 asarch That's part of the template output
14:06 Grinnz_ jberger: imo there's no relationship between the parameter and the callback there
14:11 jberger Grinnz_: I guess that's true
14:11 jberger anyway, it seems too bad that after a talk about a complex and often confusing topic like delays that the conversation would be about the use of a comma
14:12 sh4 joined #mojo
14:13 btyler maybe it needs more parens: $c->db->pg->query(('SELECT count(1) from beer_log where customer_id = 4', $bind_value) => $d->begin); :D
14:14 jberger btyler: there you go!
14:14 btyler jberger: well, I think I might have actually pitched the talk a little too easy for the room
14:15 btyler so it seems equally likely that I happened to stop on a slide where the => $d->begin was visible for questions
14:15 jberger if you didn't get at least one complaint about the name of the method "begin" then you haven't taught it in depth enough :-P
14:15 Grinnz_ hehehe
14:15 btyler heh, stevan asked about that actually
14:16 btyler thankfully I can say "yep, dunno, just a user!"
14:16 jberger it has been debated ad nauseum
14:16 Grinnz_ #nobegin4lyfe
14:16 risugg joined #mojo
14:16 jberger in fact it is one of the rare things that I can say has been "discussed at length over a delicious moose dinner"
14:17 Grinnz_ i prefer a Moo dinner
14:29 ajr_ joined #mojo
14:34 cpan_mojo Mojolicious-Plugin-Narada-0.3.1 by POWERMAN https://metacpan.org/release/POWERMAN/Mojolicious-Plugin-Narada-0.3.1
14:36 jb360 joined #mojo
14:40 odin22 joined #mojo
14:50 nicomen re: [non-blocking requests in blocking server] tried the example here and I get premature connection close: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Concurrent-blocking-requests
14:50 Grinnz_ nicomen: the useragent object must be stored somewhere where it won't be released before the transaction completes
14:51 Grinnz_ (that's usually the reason if i get premature connection close)
14:51 Grinnz_ $delay->wait is a no-op if the loop is running alraedy
14:53 nicomen https://gist.github.com/nicomen/27d230c124585532276f
14:53 nicomen yeah I believe it is stored right?
14:53 nicomen ah
14:53 nicomen or
14:53 nicomen hm
14:53 Grinnz_ you'd have to do that render in the delay, because it won't happen until the next tick
14:53 Grinnz_ or later in the event loop
14:53 nicomen fair enough
14:54 Grinnz_ and likewise, you'd need to store the useragent somewhere outside that action
14:54 Grinnz_ like in a helper
14:54 Grinnz_ i think i did something like "undef $ua" in a delay step to work around that once
14:55 nicomen aha
14:55 nicomen thanks!
14:55 Grinnz_ yeah: Mojo::IOLoop->delay(sub { $ua->get($url, shift->begin) }, sub { do stuff with $tx; undef $ua });
14:56 nicomen why does undef $ua work?
14:56 Grinnz_ it closes over the ua object
14:56 nicomen oh, lol
14:56 Grinnz_ same thing is used in the delay helper for $tx
14:57 Grinnz_ (different $tx)
14:58 nicomen ok
14:59 Grinnz_ by the way, since you're making a delay related to rendering, you should probably use that delay helper :P
15:03 nicomen instead of?
15:04 storskegg joined #mojo
15:05 Grinnz_ a raw delay
15:06 Grinnz_ $self->delay()
15:06 Grinnz_ it will turn off automatic rendering, keep a referece to the request $tx, and call wait()
15:06 Grinnz_ and handle exceptions
15:09 storskeg_ joined #mojo
15:11 storskegg joined #mojo
15:15 asarch Do you any command to enable external local files in Mojo?
15:15 asarch Do you need...
15:16 risugg I my tests, I set four headers via ua->on(start => sub {...}) - content-type, accept, authorization, and a custom header x-token:1. Randomly, all the headers except for authorization drop out. I can run prove over and over with no changes, and sometimes the headers are set, and sometimes they aren't. I could paste the code, but it's pretty straightforward, and was hoping someone could point me in the right direction without it.
15:16 Grinnz_ you mean, for static rendering?
15:17 risugg using Mojolicious version 6.10, btw
15:19 Grinnz_ asarch: https://metacpan.org/pod/Mojolicious::Guides::Rendering#Serving-static-files and https://metacpan.org/pod/Mojolicious#static
15:22 Repaster joined #mojo
15:28 Grinnz_ risugg: I don't see the problem, can you paste your code?
15:33 risugg Grinnz_ - http://pastebin.com/UtZXq8Yu  -  running this over and over will fail sometimes and succeed sometimes. The headers are checked in $routes->under("/" => sub {...}), where I see the authorization header usually makes it, but the others do not.
15:33 Repaster Repasted text from risugg: http://fpaste.org/217248/30408010
15:33 jb360 joined #mojo
15:35 storskegg joined #mojo
15:41 Grinnz_ risugg: perhaps the problem is that you need to call encode_base64 with a second argument of '', otherwise it will add a newline
15:41 Grinnz_ risugg: you can use Mojo::Util::b64_encode for that btw
15:41 Grinnz_ (same second argument)
15:42 risugg dern - that was it. I think I hit this before and forgot -- that new line messes up the header parsing. Thanks!
15:42 Grinnz_ indeed.
15:49 storskegg joined #mojo
15:53 meshl joined #mojo
16:02 storskegg joined #mojo
16:07 ToApolytoXaos joined #mojo
16:22 nicomen is there some way I could pass an extra param to the non-blocking ->get() call? I would like to store the result in a table, or use some accompanied data with the result
16:23 Grinnz_ nicomen: you can store data in the delay object
16:23 nicomen which in turn I pass to get() ?
16:23 Grinnz_ if you're using $delay->begin you're already passing it in a way
16:24 nicomen thing is I don't have a way to map the incoming url to get to an element that could be stored in the dealy
16:24 Grinnz_ your resulting transactions will always be ordered
16:24 nicomen oh!
16:27 Grinnz_ nicomen: you can also use $delay->pass or a wrapper around the callback returned by $delay->begin to get it to show up in the next sub's arguments
16:32 risugg joined #mojo
17:01 mattastrophe joined #mojo
17:12 fhelmber_ joined #mojo
17:48 Grinnz_ i'm so lonely on freenode atm
18:12 vmbrasseur joined #mojo
18:14 mikelieman joined #mojo
18:16 mikelieman left #mojo
18:22 storskegg joined #mojo
18:25 storskeg_ joined #mojo
18:29 storskegg joined #mojo
18:35 storskeg_ joined #mojo
18:40 storskegg joined #mojo
18:45 storskegg joined #mojo
18:49 storskeg_ joined #mojo
19:05 amon joined #mojo
19:17 berov joined #mojo
19:32 storskegg joined #mojo
19:33 mattastrophe joined #mojo
19:38 storskegg joined #mojo
19:41 storskeg_ joined #mojo
19:57 wariat joined #mojo
20:04 damaya joined #mojo
20:05 damaya I've just introduced someone to Mojolicious. I want to get them into it. Are the screencasts from tempire still relevant? I.e., are they too outdated?
20:06 tempire They're still relevant. See https://github.com/kraih/mojo/wiki for things that have changed.
20:09 ajr_ joined #mojo
20:10 melo joined #mojo
20:19 damaya tempire: awesome, thank you!!
20:19 damaya and thanks for the awesome screencasts
20:19 Repaster joined #mojo
20:28 Repaster joined #mojo
20:33 meshl joined #mojo
20:38 damaya How come all the newb guides/screencasts are geared towards lite apps?
20:38 damaya Anything geared towards full apps?
20:39 mst because the idea is to get newbies up and running
20:39 mst and then they can use the Growing guide to get further
20:39 damaya Hey mst, I'd love to have a conversation with you at some point about some stuff
20:39 damaya In a few weeks
20:40 damaya I'm loving your mstpan articles btw
20:40 risugg joined #mojo
20:45 punter joined #mojo
21:06 mst damaya: sweet
21:06 mst I'm not done, just doing them when I feel inspired :)
21:09 jberger damaya: the distinction between lite and full is so minimal once you know how it works
21:09 jberger so it really is just convenience
21:15 storskegg joined #mojo
21:49 Zoffix God, I love Mojolicious... It's funny. I heard about it over a year ago, but didn't want to try because I hated the name, thanks to Austin Powers movies, which I hate.. and he always takes about his "mojo" :)
21:49 disputin joined #mojo
21:49 Zoffix (this was the drunken programmer's version of "I love you, man")
21:53 mattastrophe joined #mojo
21:53 AirDisa joined #mojo
21:54 Grinnz_ heh
22:35 jberger Zoffix++
22:38 hernan604 mojo is super!!
22:46 * pink_mist also doesn't care for austin powers -- but this has merely lead me to not watch the movies and thus not associate 'mojo' with them
22:46 * Grinnz_ thinks austin powers is pretty funny
22:47 Zoffix It might have to do with English being my second language and my first and only interaction with word "mojo", prior to Mojolicious has been with Austin Power s :P
22:48 Grinnz_ that is most of the other usages of the word, yeah
22:48 Grinnz_ also see Mojo Jojo
22:49 Grinnz_ not to be confused with either Mojo or Jojo
22:49 jberger app->start used to be shagadelic
22:49 Grinnz_ rofl
22:49 Zoffix 0.
22:51 hernan604 and where is sri ?
22:51 purl sri is A PONIE!!1! and a  or no more a javascript noob or evil or a spelling guerilla or the temporary channelclown or a snob now or the perl guerilla or a small mouse with a big head aiming for world domination or the evil sith or has no clue about fuzzy logic or no longer a real hacker :/ or a copycat or pimp to many children or a holy man or looks a lot like pitr or puny or making Mojolicious delicious
22:52 jberger https://github.com/kraih/mojo/blob/master/Changes#L3570
22:52 Grinnz_ heh
22:52 hernan604 hah crazy!
22:53 Zoffix :D
22:55 storskegg joined #mojo
22:58 storskeg_ joined #mojo
23:13 fhelmber_ joined #mojo
23:35 storskegg joined #mojo
23:45 storskeg_ joined #mojo
23:49 * jberger is trying not to gripe about http://perlmaven.com/getting-started-with-mojolicious-lite
23:49 jberger szabgab tries
23:51 jberger hmmmm I guess that's kinda old anyway
23:51 jberger I wonder why it showed up on reddit again?
23:52 jberger ah I should have guessed; self promotion
23:52 jberger the comment about why the hash constructor is not a block gets funnier every time I think about it
23:57 asarch joined #mojo

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