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

IRC log for #mojo, 2016-05-17

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

All times shown according to UTC.

Time Nick Message
00:10 * sri is still not sure if he should call the feature job dependencies or job dependency graphs
00:10 sri since it's actually cooler than most dependency systems
00:20 jberger if its cooler, sell the cool
00:25 meshl joined #mojo
00:28 jberger plicease: around?
00:28 jberger I just added travis to Mojo::Phantom
00:30 plicease I am here-ish
00:30 jberger in that case, mind if I rebase your commits?
00:32 plicease not at all.
00:32 jberger I don't know if the PR will see that work but I can close with a link
00:33 plicease I can do it too if you want won't take me long
00:33 plicease hold on.
00:33 jberger start with no-exit
00:34 jberger (I set this up so I wouldn't have to futz around and now I'm doing even more futzing :s)
00:34 jberger oh well, this is a good one to have travis on
00:38 plicease I did no-exit.  the other branches might not work without the cpanfile commit.
00:39 jberger no-exit is the least contentious anyway
00:39 plicease right that is why I put it in there.
00:39 plicease it looks good: https://travis-ci.org/jberger/Mojo-Phantom/builds/130716508
00:39 plicease if you want to merge it I can rebase the other two and we can discuss decide later whatever works for you.
00:39 plicease I can also do it tomorrow if that works.
00:41 jberger interesting ... https://travis-ci.org/jberger/Mojo-Phantom/jobs/130716513#L230
00:41 jberger that's not the fault of no-exit though
00:43 plicease yeah.
00:44 jberger discussing that one in #toolchain
00:44 plicease it is in the pre no-exit commits too https://travis-ci.org/jberger/Mojo-Phantom/jobs/130714390
00:44 jberger right, I didn't wait for the old perls to finish :s
00:46 plicease old version of M::M?  Module::Metadata
00:46 plicease https://metacpan.org/changes/distribution/Module-Metadata#L97
00:48 jberger plicease: as I said we're working on that in #toolchain
00:52 jberger all green now, I've made the change in Mojo::Phantom's cpanfile for now but I'll open a PR on AMBT to require the higher version
00:53 plicease right.
00:53 plicease i've rebased the other two branches.
00:55 jberger plicease++
01:02 bpmedley CSRF schenanigans https://www.irccloud.com/pastebin/jpQFopOa/csrf.pl
01:03 bpmedley I'm not sure what I'm doing wrong.. I'm trying to use CSRF in an AJAX POST request.
01:05 jberger bpmedley: I don't know if you can extract the CSRF token from headers
01:05 shotgundriver joined #mojo
01:05 bpmedley Looking over the code again, I think I'm overwritting the extracted CSRF via input..
01:06 * Grinnz keeps confusing CSRF with CRLF
01:07 jberger bpmedley: I think the issue is using the built-in validation to try to validate a header
01:08 jberger IIRC validation is only useful with query parameters
01:08 jberger which are meant to be built with csrf_field from the tag helpers plugin
01:09 bpmedley https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L339 <-- This bit seems to indicate that the X-CSRF-Token is unique
01:09 jberger interesting
01:09 jberger I didn't know about that
01:10 jberger then I'll shut up :-P
01:10 jberger I don't know what is wrong
01:23 vicash bpmedley: you need to encapsulate the button tag in a form tag with a csrf_field tag helper. then the server will send a CSRF token to the form, and when you click the button you can send that back for verification. i believe that should work
01:24 bpmedley vicash: Hrmm.  That would probably make my life easier; however, I'm trying to do this with an adhoc header..
01:25 vicash bpmedley: do you mean you want to be able to check for an arbitrary header rather than CSRF ?
01:26 mattp huh dbd::mysql asynchronous queries is still limited to 1 query per connection
01:27 mattp thats not very useful if your app is DB-bound
01:28 vicash bpmedley: if that's the case, and the header is not being sent in the ajax request then you may want to run Wireshark to check what is being sent along. Or use a cookie maybe.
01:28 bpmedley No, not arbitrary; my understanding is that the X-CSRF-Token header should work with validations.  I'm not sure of the best way of approaching that with an AJAX request and JSON.
01:29 vicash bpmedley: since it is a post request, if you use a form, the csrf token will be sent with the form back as well.
01:29 vicash that's how I understand it and in my code I validate simply by doing $validation->csrf_protect->has_error('csrf_token').
01:33 bpmedley https://www.irccloud.com/pastebin/jpQFopOa/csrf.pl <-- I updated my pastebin, this seems functional
01:33 bpmedley vicash: I think I understand your point about using a form.  I simply don't wanna use a form.. :-O
01:33 jberger bpmedley: what was the issue?
01:34 bpmedley jberger: Lines 14 and 15 in the new pastebin.  I'm not sure that what I'm doing is idomatic, however..
01:35 bpmedley I'm pretty sure I was overwriting the csrf_token from the input() that was already done via $c->validation.
01:35 bpmedley Does that make sense?
01:36 jberger ah, yeah
01:37 jberger I have no idea if that is "recommended" but I'm not going to dissuade you either
01:42 jberger mattp: that's what the connection pooling is for
01:46 mattp jberger: its easier to just throw more forks :) im actually relying on CHI::Driver::DBI right now so itd be some work to async it
01:46 jberger mattp: oh I assumed you were talking about Mojo::mysql
01:46 mattp jberger: I was. well porting over the driver to something that interfaces with it
01:46 sri please review https://github.com/kraih/minion/commit/6bc239f8b7694e8105198d798427e37768efdcb6
01:46 jberger I don't think the CHI interface lends itself to async anyway
01:48 jberger sri: reading
01:59 jberger I guess I've never noticed the attributes on Minion::Job
01:59 jberger but suddenly I wonder if they should be documented as read-only or changes are ignored or something
01:59 jberger that doesn't have anything to do with this feature though
02:00 sri that's not actually true
02:00 jberger the only comment I have is should we make it more clear that the parents must exist and be finished to progress?
02:01 jberger oh?
02:01 sri you can change ->args for example in the start event
02:01 sri which can be very nice for extensions that send extra stuff in args
02:02 jberger ah, interesting
02:02 sri remove the first or so
02:02 jberger still children would certainly be read only
02:02 sri children has no attr
02:02 * jberger goes back to diff, thought he saw that
02:03 sri just a field in the ->info hash
02:03 jberger yeah, I needed to expand the folded diff
02:03 jberger sorry
02:03 jberger ok, so that leaves my other comment about noting that the parent job needs to exist
02:04 noganex joined #mojo
02:06 zivester_ joined #mojo
02:18 jberger other than that it looks great!
02:37 mcsnolte joined #mojo
03:28 jberger perltricks shared this earlier and it is really good
03:28 jberger https://vimeo.com/165527044#t=28m10s
03:29 jberger both from a perspective of Perl directly (this could apply equally to Perl) and from the perspective of seeing Ruby in a similar position as Perl
03:40 Grinnz the part about what entrepreneurs hear about ruby applies pretty directly to perl yeah
03:50 sri that's pretty good
04:04 mcsnolte agreed nice video
04:27 shotgundriver left #mojo
04:51 sri hmm, i guess you should be able to retry a job with different parents
04:52 sri or maybe not
04:52 sri something to keep an eye on
04:53 sri it doesn't really fit into the command line client, but there might be use cases where a parent went away and you want to retry the job without parents
04:55 sri guess i'm going to add a --parent flag to the command line client anyway
04:56 bpmedley Should --parent support Getopt arrays, JSON, or comma separated parents?
04:59 bpmedley PopeFelix: Did anyone answer your exception question?
05:06 sri well, that was easy https://github.com/kraih/minion/commit/d183b1d3fe574bc438068059f7411055388890df
05:06 Guest-quest joined #mojo
05:08 inokenty-w joined #mojo
05:15 sri omg, he really went out of his way not to use the pull request template https://github.com/kraih/mojo/pull/961
05:18 sri not that i think the template is good enough yet
05:18 sri https://github.com/kraih/mojo/blob/master/.github/PULL_REQUEST_TEMPLATE.md
05:18 sri the issue template is better
05:18 sri https://github.com/kraih/mojo/blob/master/.github/ISSUE_TEMPLATE.md
05:20 sri somehow need to work the tests and docs requirement into the pull request template
05:21 sri seen some projects put a checklist at the top, but that doesn't seem so useful really
05:43 Guest-quest salute, excuse me, my push # 961
05:44 Guest-quest I want to discuss a little issue
05:47 McA joined #mojo
05:47 Guest-quest sort: mojo/templates like "debug.html.ep" wraps to layout, defined as $app->defaults(layout=>...)
05:47 Guest-quest *short
05:50 Guest-quest so that, i think needs to add code "% layout undef;" to mojo/templates debug.htpl.ep, exception.html.ep, not_found.html.ep
06:13 dod joined #mojo
06:18 dod joined #mojo
06:36 Vandal joined #mojo
07:02 AndrewIsh joined #mojo
07:22 trone joined #mojo
07:28 work joined #mojo
07:28 work s
07:29 work left #mojo
07:30 allnighter joined #mojo
07:31 allnighter Hey on Mojo/Base.pm in the function tap
07:31 allnighter I dont undestand what this line is doing
07:31 allnighter sub tap {
07:31 allnighter my ($self, $cb) = (shift, shift);
07:31 allnighter $_->$cb(@_) for $self;
07:31 allnighter return $self;
07:31 allnighter }
07:31 allnighter oops thats the whole function this is the line that is confusing me
07:32 allnighter $_->$cb(@_) for $self;
08:05 orev joined #mojo
08:28 punter joined #mojo
08:29 nic Guest-quest: yes, that's what I do with my templates
08:30 nic If you set a default layout, then templates that mustn't use a layout can have "layout undef"
08:30 nic There must be other ways to do it, but that's the simplest imo
08:37 Guest-quest nic: but why still can`t be placed "layout undef" in the distribution mentioned mojo/templates?
08:48 nic I'm not saying it can't
08:50 Guest-quest a rhetorical question )
08:50 nic Guest-quest: are you using the latest Mojolicious?
08:51 Guest-quest yep
08:51 nic I _thought_ the problem had gone away, which is why I didn't pursue it, but it seems I was wrong
09:22 meshl joined #mojo
09:28 mdom allnighter: "for $self" is implicitly localizing $self to $_, so that you can access $self as $_ in the callback
09:29 dotan joined #mojo
09:30 McA2 joined #mojo
09:52 rjh29 joined #mojo
10:00 bpmedley allnighter: Are you still there?  Did you figure the code out?
10:05 McA joined #mojo
10:06 dustinm joined #mojo
10:22 icjs joined #mojo
10:52 dustinm joined #mojo
10:54 dvinciguerra joined #mojo
12:22 mishanti1 Not to beat a dead horse, but if anyone else pops in here with the same question as i (symlinked app, hot restart on ancient mojo (3.x)) then please tell them hardlinking is probably the only way to go.
12:22 mishanti1 Also, feel free to tell them to talk to me if they are curious how we solved it here on our end.
12:50 zivester_ joined #mojo
12:55 kaare joined #mojo
12:57 ramortegui joined #mojo
12:58 jberger mishanti1: good to know
12:58 jberger bpmedley: mdom's answer is in response to allnighter
12:59 bpmedley That makes sense.  I was curious if allnighter understood the answer..
13:03 osfabibisi joined #mojo
13:10 Atog joined #mojo
13:27 gizmomathboy joined #mojo
13:32 dvinciguerra_ joined #mojo
13:43 marty joined #mojo
13:52 Dandre joined #mojo
13:57 mdom It's a nice trick, i actually can't remember if i ever used construct before, probably not
13:57 gryphon joined #mojo
14:01 mcsnolte joined #mojo
14:03 allnighter thanks guys! (I don’t know how to mention people on IRC) that is what I initially thought just a little confused because when I change   $_->$cb(@_) for $self; to  &$cb($self,@_); all tests fail
14:05 punter joined #mojo
14:12 jberger allnighter: now I can't tell if you understand it now :-P
14:13 jberger "for" is a "topicalizer" meaning it sets the "topic" which is $_
14:14 jberger and since $_ is a dynamic variable (otherwise know as being bound to a local scope) that means that within the current scope it is available inside deeper scopes (unless overridden there)
14:22 allnighter ah I get it now, I could change that line for this less fancy version
14:22 jabberwok "for topical use only"
14:22 allnighter $_ = $self;
14:22 allnighter $self->$cb(@_);
14:23 allnighter thanks jberger
14:26 punter joined #mojo
14:26 pink_mist allnighter: that's not quite the same. the for construct aliases $self to $_, and the scope is different as well.
14:26 pink_mist allnighter: if $_ was already aliased to something else in your statement, you may have just clobbered another variable.
14:27 pink_mist allnighter: why don't you keep the for?
14:31 allnighter I see, I will keep the construct I am just going over the mojolicious source code because I havent done much perl in a while
14:31 allnighter moving stuff around and seeing if it still works
14:34 jberger you would need to do { local $_ = $self; $self->$cb(@_) }
14:35 meshl joined #mojo
14:37 pink_mist yeah, I was about to suggest that too, but he already left =)
14:38 pink_mist that still wouldn't alias it though, but hopefully that's not needed
14:39 PopeFelix bpmedley, No, nobody answered my exception question, at least not that I saw. It may be lost in the scroll.
14:41 McA joined #mojo
14:49 allnighter joined #mojo
14:50 jberger PopeFelix: can you link it from the irclog?
14:51 PopeFelix jberger, I have no idea how to do that. :)
14:51 jberger http://irclog.perlgeek.de/mojo/2016-05-17
14:52 jberger click on the time on the left to link to a specific message
14:52 PopeFelix neat!
14:52 PopeFelix http://irclog.perlgeek.de/mojo/2016-05-16#i_12487344
14:58 sri could still use some opinions on https://github.com/kraih/minion/compare/85121ab36e8168aab587457c0d75bdfdc077b133...d183b1d3fe574bc438068059f7411055388890df
15:00 jberger PopeFelix: you can write your own exception template but no I don't think there are explicit exception handlers per-controller
15:01 PopeFelix jberger, OK, thanks.
15:01 PopeFelix Probably not worth the time to write an exception template, because all i'm going to do is return a 500.
15:02 jberger PopeFelix: that's ... what it does already?
15:02 PopeFelix jberger, don't I have to render at the end?
15:02 PopeFelix Oh, also I want to log the exception. That's a little more than just returning a 500.
15:02 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Rendering-exception-and-not_found-pages
15:03 zivester_ joined #mojo
15:03 jberger PopeFelix: perl -Mojo -E 'a("/" => sub { die "argh" })->start' get -v /
15:03 sri exceptions already get logged, your questions are weird
15:04 jberger PopeFelix: the exception is logged too
15:04 PopeFelix Logged where?
15:04 jberger to the application log
15:04 * sri wonders if maybe the parents column should have an index
15:04 PopeFelix hm
15:04 jberger oh, probably
15:12 PopeFelix I think I was operating under the assumption that we (my company has a Mojo base package that the thing i'm working on now inherits from) had defined some kind of "log" helper.
15:17 PopeFelix But that doesn't seem to be the case. :)
15:39 sri ok, my first try was "create index on minion_jobs using gin (parents);"
15:39 sri for the benchmark case it doesn't appear to make much of a difference
15:40 sri not that the benchmark uses any dependencies
15:40 jberger check the explain output?
15:41 sri no index use
15:41 Lee joined #mojo
15:41 jberger why "using gin"?
15:42 sri because that seems to be the one that's supposed to work ;p
15:42 osfabibisi and why not tonic?
15:42 McA joined #mojo
15:43 sri TIL about "SET enable_seqscan = off;"
15:44 sri apparently postgres can't use array indexes for any() queries
15:44 sri you actually have to use operators
15:44 CHYC sri: You need to use the && operator
15:46 sri you're welcome to optimize the queries
15:46 jberger http://www.humoar.com/wp-content/uploads/2015/01/jeep-wheelie-haters-gonna-hate.gif
15:50 sri and i think you're wrong
15:50 sri the correct operator is @>
15:54 CHYC For what you're trying to do, the two should be equivalent.
15:55 odc joined #mojo
15:56 jberger "In Postgres indexes are bound to operators, not data types or functions or anything else" from SO post
15:56 jberger if that's true that's something to keep in mind
15:59 gtodd jberger: I just read your blog piece on the QAH ...  so TL;DR ->  Test2 is better than Test  ?  :-D
16:00 jberger gtodd: yup
16:00 gtodd jberger:  that is good news since it means testing with perl is going to be even more amazingly amazing ...
16:01 jberger it is faster (assuming you use it directly not via the Test::Builder shim) and it is much more versatile
16:01 pink_mist "Test"? surely you'd at least use Test::Simple or Test::More?
16:01 jberger well, its better than Test also :-P
16:01 sri doesn't matter anyway, index doesn't get used
16:01 sri "SET enable_seqscan = off;" is sooo nice for testing though
16:02 jberger actually, just look at the tests that plicease submitted to Mojo::Phantom, https://github.com/plicease/Mojo-Phantom/blob/5919e8dd4c14cfcd19d2bca3cae929fd929df224/t/console.t
16:02 jberger look how nicely you can test a tester!
16:03 * gtodd is spending the day trying to figure out how to write RSpec based tests for rails ....
16:04 gtodd jberger: I will look at those tester tests later ... as my reward :)
16:05 jberger when I carve out a little more time for myself I'm going to hook Test::Mojo::Role::Phantom directly into Test2, it fixes a known failing in reporting the failure location
16:05 jberger (as I mentioned in that blog post)
16:06 pink_mist was there a link to said post? =)
16:10 jberger pink_mist: http://blogs.perl.org/users/joel_berger/2016/04/reflections-on-test2.html
16:11 pink_mist thanks =)
16:16 jberger plicease: I merged your #5 also
16:16 jberger I'm adding some change notes
16:17 jberger I now have one small concern, the template depends on a few bound function calls, but Mojo::Phantom doesn't define them, the test role does
16:17 jberger and they are specific to testing
16:18 jberger where I was hoping to keep Mojo::Phantom more generic (like maybe someone wants to render the page and get a png of it)
16:18 jberger I'll want to think about that before actually releasing this probably
16:18 jberger plus there is the other PR that I need to diagnose
16:18 jberger argh too much stuff to do
16:24 plicease jberger: I was thinking that this morning too.
16:24 plicease I think we can test for the existence of perl.note and only add the hooks if that exists?
16:25 plicease I think I actually had that in one of the PRs but I pulled it out because I didn't think it was needed.
16:29 plicease I think this is all that is needed actually: https://github.com/plicease/Mojo-Phantom/commit/9186034982cef9a3bc664b14568b75d46d2fb56d
16:53 PryMar56 joined #mojo
17:13 zivester_ joined #mojo
17:14 zivester_ joined #mojo
17:16 marty joined #mojo
17:17 Lee joined #mojo
17:29 dod joined #mojo
17:38 disputin joined #mojo
17:41 sri really frustrating when even those asking for job dependencies don't comment on the feature
17:43 bpmedley Sorry, i'm working on an app for personal use that will use minion.  I'm hoping to get to the minion piece soon; i'll have more viable conversation then.
17:45 bpmedley The parent/child setup is something that seems slick.  I wonder how that will scale, and have been devoting time for realizing the app and not testing..
17:46 Lee joined #mojo
17:58 magnux left #mojo
18:09 Lee joined #mojo
18:18 disputin joined #mojo
18:33 Lee joined #mojo
19:12 * sri releases minion with job dependencies :o
19:12 sri with so few people giving feedback, i am going to experiment more
19:13 sri so minion will be less stable for the time being
19:23 gtodd minion++
19:23 gtodd sri I, for one, welcome our new dependencies :)
19:35 lluad joined #mojo
19:52 dvinciguerra joined #mojo
20:19 bc547 joined #mojo
20:22 jberger sri++
20:39 ZoffixMobile joined #mojo
20:46 gizmomathboy joined #mojo
21:14 lluad joined #mojo
21:18 meshl joined #mojo
21:36 disputin joined #mojo
21:40 dvinciguerra joined #mojo
21:53 jberger just did a quick release of Mojo::ACME because it seems that LetsEncrypt has a new intermediate cert
21:53 jberger fyi
21:58 cfedde yay!
22:16 Vitrifur joined #mojo
22:39 Lee joined #mojo
23:20 trwww joined #mojo
23:39 Lee joined #mojo

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