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

IRC log for #mojo, 2017-11-02

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

All times shown according to UTC.

Time Nick Message
00:11 EvanCarroll joined #mojo
00:31 Grinnz https://i.imgur.com/HqHdkNT.jpg
00:31 genio haha.  I like that mug
00:58 aborazmeh joined #mojo
01:54 inokenty-w joined #mojo
02:15 batman I was trying to figure out a prettier api for the UA and promises... the _p() looks a bit awkward to me :/ I wonder if it could be worked into the $tx somehow.
02:15 batman vacations keeps me distracted though...
02:27 thowe joined #mojo
02:28 thowe OK, I was talking earlier about wanting to get a bunch of SNMP data, non-blocking.  Then make a bunch of posts to influxdb with that data, non-blocking.  But I thought of a wrinkle...
02:31 thowe If I have 100 SNMP sets I want, and they each need a POST performed once I have the data, how do I make sure the POST 1 doesn't happen until data set 1 is available, and so on?
02:31 preaction make 100 delays
02:32 EvanCarroll joined #mojo
02:33 thowe OK, cool, so it can be done.  Now I need to figure out what "make 100 delays" means.
02:34 preaction Mojo::IOLoop->delay( sub { fetch thing }, sub { post to influx } );
02:35 thowe Oh OK.  The docs I had looked at didn't use that syntax.
02:36 thowe I had in my head "$ua->put('http://influx' => {'stuff'} => sub {'do the things'}
02:36 thowe Your way is going to work so much better
02:36 preaction that's the second step. the first step is still fetching the snmp data
02:38 thowe Right.  I want to loop through my configured "to fetch" list and post at each step.
02:40 thowe for my $interface (@interface_list) { Mojo::IOLoop->delay( sub {fetch_for($interface)}; sub {post_for($interface)} ) }
02:40 thowe something along those lines?
02:40 purl i guess something along those lines is the only explanation
02:41 preaction basically, yes
02:41 thowe is each set using the same loop, or am I creating a new one each time?
02:41 preaction they are all using the same event loop
02:44 thowe OK.  Cause I imagine the event loop running and waiting for the right time to run the next set of fetch and record data, then running that for loop when that time comes.
02:56 ilbot2 joined #mojo
02:56 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
03:28 noganex_ joined #mojo
03:49 jberger sri: I asked yesterday but I think it got buried
03:50 jberger I'm a little surprised that in that patch, it looks like connection errors are treated as resolve not reject
03:51 jberger anyone else that's more familiar with promises (especially in javascript) might be able to help me with that too
03:52 jberger https://gist.github.com/anonymous/692695c43f328b7d7ee270601e4549fc#file-promises-diff-L28
03:52 jberger if the error doesn't have a code, that's a connection error, right?
04:10 Grinnz maybe an oversight, it looks like that line was for handling the success case
04:11 Grinnz i would think (similar to the ->result method) that connection errors would be a failure, and anything else would be a success
04:12 Grinnz or i guess you could go on the ->success/->error difference, too, but either way should be documented appropriately
04:12 Grinnz http error handling is fun
04:16 EvanCarroll joined #mojo
04:21 mtj joined #mojo
05:04 dboehmer joined #mojo
05:06 karjala_ joined #mojo
05:19 jamesaxl joined #mojo
06:13 EvanCarroll joined #mojo
06:41 Vandal joined #mojo
06:45 marty joined #mojo
06:51 kes joined #mojo
07:00 Lee joined #mojo
07:16 dod joined #mojo
07:35 dod joined #mojo
07:37 dod joined #mojo
07:51 karjala_ joined #mojo
08:24 trone joined #mojo
08:47 trone joined #mojo
08:57 rshadow joined #mojo
09:07 sri jberger: dunno what you mean, connection error is ->reject
09:08 sri or did i typo?
09:09 sri guess i did, connection error is the one supposed to result in reject
09:18 JDe joined #mojo
09:18 JDe https://cryptosrevolution.wixsite.com/beta
09:18 JDe joined #mojo
09:20 JDe joined #mojo
09:20 sri it's a virus isn't it?
09:58 iamb joined #mojo
10:01 kes huh... embedded apps share same $cache ( So if two embedded apps have /bye route. and we request /first/bye/ then /second/bye for second app will be returned $cached captures of first app
10:01 kes embedded apps should have same package name.
10:02 kes and apps should be Lite
10:03 kes prof: https://metacpan.org/source/SRI/Mojolicious-7.51/lib/Mojolicious/Lite.pm#L36
10:06 sri kes: please don't take this the wrong way, but you are incredibly hard to understand, perhaps it would help if you tried a little harder making more precise statement
10:10 kes I will create testcase
10:23 AndrewIsh joined #mojo
10:55 kes jberger: I extend your yesterday gist: https://gist.github.com/KES777/3d9abe03589d5d9f462f05d051ba15a4
11:02 sri yea, that looks like a bug, url_for should behave the same in both cases
11:05 sri otherwise the whole connecting of routes would be pointless
11:07 kes sri: the output is: http://paste.scsys.co.uk/565655
11:07 sri kes: i just said that it's a bug
11:07 sri what more do you want?
11:08 kes may I open issue for this?
11:09 sri if you can be precise with describing the problem
11:09 sri others have to be able to understand the problem from it
11:20 aborazmeh joined #mojo
11:25 kes hope all is clear: https://github.com/kraih/mojo/issues/1148
11:32 sri kes: i wouldn't understand the description i'm afraid
11:33 sri might make it hard to find someone to fix it
11:34 kes I almost fix that
11:40 marcus sri: I wonder if it would be possible to make Mojo::UserAgent accept a promise as in place of a callback to make UA usage prettier. like automatically making it call resolve.
11:41 sri marcus: what's the advantage?
11:41 purl the advantage is we'll get it done on time, under budget, and with 50% more blow jobs!
11:41 mdom Uhm?!
11:41 sri no promise api i'm aware of does that
11:42 CandyAngel purl: forget the advantage
11:42 purl CandyAngel: I forgot advantage
11:42 sri ->get_p is better in every regard imo
11:43 sri marcus: you didn't pay attention to my proposal, did you?
11:44 marcus sri: I guess not, where is get_p mentioned?
11:44 sri https://irclog.perlgeek.de/mojo/2017-11-01#i_15389021
11:45 marcus sri: Yes, I like that better too.
11:45 sri patch is a little borked, ->reject needs to be done for connection errors
11:47 sri trivial fix though
11:47 CandyAngel sri: My persistent cookie role for CookieJar would not end up in core Mojo, would it?
11:48 sri CandyAngel: unlikely
11:49 kes Is this OK that 'routes' command do not show routes for embedded apps?
11:52 pink_mist of course it is. how could it know what an embedded app supports
11:55 kes It could know by testing like here: https://metacpan.org/source/SRI/Mojolicious-7.51/lib/Mojolicious/Routes.pm#L151
11:56 pink_mist you do know that you can embed apps other than Mojolicious apps right?
11:58 sri we are not going to make embedded apps more complicated
11:58 sri like i said before, multiple times, they are meant to be isolated
11:58 sri and the feature is only meant for the mount plugin
11:58 sri which assumes complete apps, which all have their own routes command
12:37 bwf joined #mojo
12:56 kes another interesting issue. The place where I `use Mojolicious::Lite` is significant: Here tests did not work: https://gist.github.com/KES777/6ca7b3f43e18f1935ef7f7a6d5ab02f7 and only with this change https://gist.github.com/KES777/6ca7b3f43e18f1935ef7f7a6d5ab02f7/revisions it is worked
13:00 kes And first variant do not work only when I try to test application
13:01 kes If I just start it: app->start; all requests are recognized
13:04 sri kes: this is another one of your problems, you conflate issues and it becomes a mess nobody can follow anymore
13:05 sri get one problem resolved completely, and only then move on to the next
13:06 kes sorry for that. What can I do if I faced into another issue while resolving first?? (
13:06 marty joined #mojo
13:07 sri take notes, keep them until the first problem is resolved
13:07 sri with the language barrier you have no other choice
13:08 sri when you post everything people can't follow and just ignore it all
13:08 sri we've seen that many times now
13:08 kes ok
13:08 sri you have to focus on one issue, and make sure people understand it
13:10 sri kes: can i edit the issue to make it better understandable? https://github.com/kraih/mojo/issues/1148
13:10 kes Yes, of course
13:11 kes I will thank you
13:22 sri ok, done
13:23 gryphon joined #mojo
13:26 Pyritic joined #mojo
13:37 kes May I ask? If I have Mojolicious::Lite application in 'DeepApp' package. Then I do: $o = DeepApp->new
13:38 kes Why `ref $o eq 'Mojolicoius::Lite'` and not `eq 'DeepApp'`?
13:43 sri https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Lite.pm#L49
13:48 anparker sri: https://gist.github.com/anparker/fab9b5bf64034b4bdc56c844de44cf0e
13:48 anparker No sure, if it's what you expected.
13:50 sri anparker: it's a start, on;y connection errors should result in rejection though
13:50 sri *only
13:50 sri and good documentation is important
13:50 sri i do like the method tests though
13:51 tcohen joined #mojo
13:52 sri don't do diffs for diffs, just merge my diff
14:03 Pyritic joined #mojo
14:38 perlpilot joined #mojo
14:44 kes What do you think about the case when Lite application work in different way in compare to Full application?
14:44 kes https://gist.github.com/KES777/1f5fafe6b4c61091e18d4d4b8e90cd2b
14:44 kes Should I open new issue?
14:51 anparker If only connection errors should cause rejection, then I dont know, why you wanted someone else to fix it.
14:51 anparker That fix is about adding one character. :)
14:51 pink_mist you misunderstand
14:51 anparker I updated my gist.
14:52 pink_mist that's not the only thing he wanted fixed, but it was one of the things
14:53 pink_mist and it was less about fixing it and more about completing it
15:07 sri kes: do not open issues until you have confirmation here that something is a bug
15:08 kes yes. I remember that. So I ask what do you think about this case:
15:08 kes https://gist.github.com/KES777/1f5fafe6b4c61091e18d4d4b8e90cd2b
15:09 ChmEarl joined #mojo
15:16 Lee joined #mojo
16:25 ChmEarl joined #mojo
16:37 CandyAngel Can I get some feedback on this (my persistent cookie module): http://codepad.org/dFSEKOjc
16:40 CandyAngel It allows load/save to netscape-format cookie files
16:55 Grinnz CandyAngel: a role should not be using the class it applies to as a base
16:56 Grinnz that's a subclass not a role
16:56 Grinnz a role provides new methods, it doesn't usually override them (though it can augment them with Class::Method::Modifiers)
16:57 CandyAngel Ah okies
16:57 CandyAngel Should I make the methods more specific (like.. load_netscape, save_netscape) ?
16:57 Grinnz oh, these are all new methods, this would work as a role then
16:58 Grinnz just have it use Mojo::Base -base and then Role::Tiny
16:58 Grinnz and apply it to the cookie jar object with ->with_roles
16:59 kes because of lite apps share one instance this patch: https://github.com/kraih/mojo/compare/master...KES777:do_not_lose_captures_for_embedded_apps?expand=1 fail tests for lite apps: https://travis-ci.org/KES777/mojo/jobs/295931552#L715
16:59 Grinnz the names are probably fine, unless there's some other way the cookie jar would 'load' or 'save'
16:59 kes this patch resolves this issue: https://github.com/kraih/mojo/issues/1148
17:00 CandyAngel Well, it could save into a different format, but I don't know why you would apply with role and another one with save/load at the same time
17:00 Grinnz also true
17:00 CandyAngel Thankies ^_^
17:01 Grinnz i would also suggest (after use Role::Tiny) to add requires for any standard CookieJar methods you use within your functions, like all
17:01 Grinnz and add
17:01 Grinnz that makes sure nobody can use it the wrong way accidentally
17:03 jberger I literally just did that for Test::Mojo::Role::Chrome last night: https://github.com/jberger/Mojo-Chrome/blob/master/lib/Test/Mojo/Role/Chrome.pm#L10
17:11 Kharec joined #mojo
17:14 Grinnz CandyAngel: is the netscape format really just tab separating the fields with no quoting? ewww
17:15 Grinnz CandyAngel: maybe the default file should be a tempfile, to avoid creating random files in whatever cwd happens to be without the user setting it
17:15 Grinnz though i guess that sorta defeats the purpose, so nevermind
17:16 jamesaxl joined #mojo
17:16 Grinnz CandyAngel: also don't put shebangs in module files :P
17:19 jamesaxl Grinnz: what is your OS?
17:19 Grinnz usually linux
17:19 RLPebbles joined #mojo
17:20 rshadow joined #mojo
17:20 Grinnz encoding is also fun with cookies but i guess Mojo::Cookie assumes you give it bytes for name and value
17:20 purl okay, Grinnz.
17:20 Grinnz so theres nothing else to do there
17:22 RLPebbles Hi, I am using Bootstrap grid with mojo tag helper text_area. Setting col's does nothing to the area size, while setting rows does. Anyone know why? Bootstrap row is set to full width col-md-12 btw.
17:25 RLPebbles ... may not be a mojo issue though
17:27 sri not really
17:36 maschine You must be typing something wrong - it works for me
17:37 maschine text_area 'test' => 'foo bar baz', cols => 40, rows => 15
17:37 maschine I'm also using bootstrap
17:38 maschine I haven't messed with many of the default boostrap settings though, maybe you've changed there.
17:38 Grinnz it could be the browser rendering too
17:40 RLPebbles maschine, yeah, that's pretty much the exact way I have written it. Not working. Tried in both Firefox and Chrome, same issue.
17:41 CandyAngel Grinnz: The shebang  is only there because I copied it out of a script :P
17:41 RLPebbles It's probably some stupid typo or something, that I haven't spotted yet
17:41 Seth joined #mojo
18:08 good_news_everyon joined #mojo
18:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFGA8
18:08 good_news_everyon mojo/master 494614e Sebastian Riedel: add delete_p, get_p, head_p, options_p, patch_p, post_p, put_p and start_p methods to Mojo::UserAgent
18:08 good_news_everyon left #mojo
18:21 trone joined #mojo
18:28 dod joined #mojo
18:33 kes Grinnz: actually and vice versa (I am about yesterday url_for when I implement my own version in MyApp::Controller)
18:33 kes This is true when url_for is called from template without action
18:34 kes (in this case $c is setted up by default controller)
18:34 Grinnz if you're not using your custom controller, of course it's... not going to use your custom controller
18:34 kes so $c->url_for will call url_for method of Mojolicious::Controller
18:35 arcanez has there been any writeup of the promises in mojo?
18:37 kes This can be fixed by setting up the controller_class property of application
18:40 kes The issue of reimplementing url_for should be explicitly documented
18:40 kes maybe here: http://mojolicious.org/perldoc/Mojolicious#controller_class
18:42 bwf joined #mojo
18:51 sri and part two https://github.com/kraih/mojo-pg/commit/288faf0005910cdbad44cd4bcce7c4c2afbe9a08
18:51 sri http://mojolicious.org/perldoc/Mojo/Pg/Database#select_p
19:02 pink_mist sri++ # *_p methods
19:07 maschine that looks nice!
19:21 sri it is nice :)
19:29 sri unless there are complaints i'll release later today
19:29 sri i want people to try promises
19:36 maschine I want to try it too :p
20:16 marcus I'll rewrite some code at work to use promises tomorrow then :)
20:52 disputin joined #mojo
20:57 disputin joined #mojo
21:17 arcanez I need someone to write something up so I know what I'm doing with them :)
21:19 marty joined #mojo
21:21 Seth joined #mojo
21:22 sri don't look at me, i think i've done enough :p
21:23 sri maybe marcus will blog about the work code he changes tomorrow
21:23 sri jberger is still kinda anti promises and batman on vacation
21:23 jberger I'm not really anti-promises per-se, but I've never used them
21:24 jberger I have been pro delays because I grok them deeply at this point
21:24 jberger but that's not to say anti promises
21:24 sri while we are all here, everybody still likes the my $promise = $foo->$bar_p(...) convention for promises?
21:25 jberger non core members are of course welcome to blog too
21:25 jberger fine by me
21:25 Grinnz makes sense to me
21:25 sri we could really use a process for guest bloggers on mojolicious.org
21:25 jberger people can send me blogs in markdown, I can post them
21:25 jberger or you can post them on tumblr and we can reblog
21:26 Grinnz i would try the promises in my irc bot but... i would really miss the cancellation feature of Future
21:26 jberger but I rather hated that experience the last time personally
21:26 sri or folks can bog on their own tumblr and we reblog
21:26 Grinnz i might see if i have some other delay-using code though
21:27 marcus sri: I'll write up something during the weekend.
21:27 sri \o/
21:27 marcus others are free to do so as well of course ;)
21:28 jberger there's lots to talk about too
21:28 jberger signatures kinda went under the radar here
21:29 jberger and I'm hoping to get Mojo::Chrome out soon
21:29 marcus I tried to write a cli app in rust today, but kinda gave up when I found out their http client doesn't support cookies.
21:29 jberger nearly done with the docs and though the tests are pretty light, they'll suffice for now
21:29 marcus Got further in mojo in 10 minutes than I had in 5 hours with rust.
21:29 Grinnz marcus: d'oh
21:29 jberger (they're basically intergration tests)
21:30 jberger man an http client without cookies, ouch
21:31 Grinnz to be fair, HTTP::Tiny doesn't hold on to cookies unless you pass it a non-core cookie jar, but still
21:31 marcus this github issue just made me sad https://github.com/seanmonstar/reqwest/issues/14
21:31 jberger that's so odd, there's really nothing special to cookie jars
21:31 Grinnz jberger: there is when you start adding persistence to your feature scope
21:32 jberger see that's creep
21:32 jberger mojo++ hits that nice balance
21:32 jberger I very rarely need persistent cookies in scripts
21:32 Grinnz even without that HTTP::Cookies is a huge mess, compared to HTTP::CookieJar
21:33 jberger the joys of "being cpan friendly"
21:33 jberger #puke
21:33 Grinnz the joys of being 20 year old libwww-perl code
21:33 jberger sure, that's why new wheels can be rounder
21:34 jberger and yet people still yell at us
21:35 sri my Promises bug still hasn't even been acknowledged
21:35 sri tell me again how that module is not dead -.-
21:36 jamesaxl joined #mojo
21:37 disputin joined #mojo
21:39 jberger Stevan is in Russia for a conf
21:39 jberger giving a talk on Moxie
21:39 jberger I'm not sure if Yanick is a new maintainer or if he just had some updates
21:40 sri he did a release
21:40 Grinnz stevan hasn't done anything with that module for a year
21:40 Grinnz i guess he did a bit in may
21:41 sri the people who committed stuff after stevan actually borked stuff
21:41 jberger sri: yeah, I mean I don't know if he's taking over or not, he did a release but Stevan is still listed as the only author
21:44 sri hmm, using ->catch on promises actually has a very neat side effect
21:44 sri ->then(sub {}, sub {}) vs ->then(sub {})->catch(sub {})
21:44 sri i mean that
21:44 sri second is pretty much always better
21:45 sri since the catch is a second promise, it gets failures from the first closure
21:46 Grinnz right, i've never used the "else" sub in future either
21:46 sri while the second closure in the ->then call does not if the first closure fails
21:46 sri ->then(sub {})->then(undef, sub {}) would have kinda sucked
21:47 sri if we had to recommend that
21:48 marty joined #mojo
21:52 Seth1 joined #mojo
21:59 Seth joined #mojo
22:18 Pyritic joined #mojo
22:34 sri wonder if there are sections in the guides remaining that should be updated for promises
23:15 jberger anyone want to comment on/review https://github.com/jberger/Mojo-Chrome ?
23:22 jberger one thing I'm likely to still do is remove Mojo::Chrome::Util and make the only function it contains a class method on Mojo::Chrome
23:57 jberger and that's done

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