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

IRC log for #mojo, 2015-03-16

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

All times shown according to UTC.

Time Nick Message
00:00 Averna joined #mojo
01:01 asarch joined #mojo
01:23 alexbyk joined #mojo
01:31 alexbyk Hi, mojo people. How about to reconsider this pull req https://github.com/kraih/mojo/pull/764 ) So be prepared for all feature releases
01:37 hshong joined #mojo
01:44 good_news_everyon joined #mojo
01:44 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/hf46
01:44 good_news_everyon mojo/master 3fa9dad Sebastian Riedel: use a more strict query string test
01:44 good_news_everyon left #mojo
01:55 sri marty: yea, seems like something nginx can handle very well
02:07 batman joined #mojo
02:15 deserted sri, quick question for you, will every_param handle a <input="file" multiple> upload with conversion to multiple Mojo::Upload objects, or is that likely to break shit?
02:16 sri have you tried it?
02:16 purl You know, the workings of perl lend themselves to empirical research.
02:16 sri botsnack
02:16 purl :)
02:17 deserted sri, fair call, i was taking the lazy route
02:17 sri so do i :)
02:17 deserted just thought you may have been able to answer off top of your head, but all good I'll finish testing :)
02:18 klapperl_ joined #mojo
02:18 sri this exists though ;) http://mojolicio.us/perldoc/Mojo/Message#every_upload
02:40 deserted sri, why yes, yes it does..... silly me lol
02:52 good_news_everyon joined #mojo
02:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/hfr4
02:52 good_news_everyon mojo/master 3f6e564 Sebastian Riedel: more diverse application tests
02:52 good_news_everyon left #mojo
03:19 d4rkie joined #mojo
03:20 tom joined #mojo
03:22 mrEriksson joined #mojo
03:22 theo_ joined #mojo
03:23 mattastrophe joined #mojo
03:24 augensalat joined #mojo
03:24 hshong joined #mojo
03:24 zivester joined #mojo
03:24 Grinnz joined #mojo
03:24 xtetsuji_ joined #mojo
03:24 jnbek joined #mojo
03:24 kmx joined #mojo
03:24 ryanc joined #mojo
03:24 Dandre joined #mojo
03:24 Ralesk joined #mojo
03:24 mst joined #mojo
03:24 bzero joined #mojo
03:24 ashimema joined #mojo
03:24 hernan604 joined #mojo
03:24 avenj joined #mojo
03:24 jamesw joined #mojo
03:24 hahainternet joined #mojo
03:24 legz joined #mojo
03:24 diegok joined #mojo
03:24 Rallias joined #mojo
03:24 elik joined #mojo
03:24 preaction joined #mojo
03:24 mattp joined #mojo
03:24 charsbar joined #mojo
03:24 sivoais joined #mojo
03:24 Snelius joined #mojo
03:24 jbob joined #mojo
03:24 tinita joined #mojo
03:24 jberger joined #mojo
03:24 Trelane joined #mojo
03:24 xdg joined #mojo
03:24 oetiker joined #mojo
03:24 stephan joined #mojo
03:24 al joined #mojo
03:24 Lee joined #mojo
03:24 Kundun joined #mojo
03:24 Bender joined #mojo
03:24 gabiruh- joined #mojo
03:25 jkramer joined #mojo
03:27 avkhozov joined #mojo
03:27 bjoernfan joined #mojo
03:27 oliver joined #mojo
03:28 batman joined #mojo
03:28 inokenty joined #mojo
03:28 bayashi joined #mojo
03:28 noganex_ joined #mojo
03:28 Averna joined #mojo
03:28 basic6 joined #mojo
03:28 Adurah joined #mojo
03:28 jb360 joined #mojo
03:28 DesertFox joined #mojo
03:28 dustinm joined #mojo
03:28 sawtooth joined #mojo
03:28 marty joined #mojo
03:28 memowe joined #mojo
03:28 bobkare joined #mojo
03:28 gtodd joined #mojo
03:28 marcusr joined #mojo
03:28 deserted joined #mojo
03:28 denny joined #mojo
03:28 janus joined #mojo
03:28 KindOne joined #mojo
03:28 yusukebe joined #mojo
03:28 ssm joined #mojo
03:28 throughnothing joined #mojo
03:28 da5id joined #mojo
03:28 mtths joined #mojo
03:28 Foxcool joined #mojo
03:28 skaji joined #mojo
03:28 bjakubski joined #mojo
03:28 lupi joined #mojo
03:28 genio joined #mojo
03:28 panzana` joined #mojo
03:28 Jonis joined #mojo
03:28 robinsmidsrod joined #mojo
03:28 howitdo joined #mojo
03:28 Grinnz_ joined #mojo
03:28 allison joined #mojo
03:28 romel joined #mojo
03:28 abracadaniel joined #mojo
03:28 shadowpaste joined #mojo
03:28 HtbaaPi joined #mojo
03:28 rwp joined #mojo
03:28 Nemix joined #mojo
03:28 tianon joined #mojo
03:28 upasana_ joined #mojo
03:28 firnsy joined #mojo
03:28 btyler joined #mojo
03:28 stokachu joined #mojo
03:28 espen joined #mojo
03:28 pink_mist joined #mojo
03:28 murre joined #mojo
03:28 michael joined #mojo
03:28 s1037989 joined #mojo
03:28 cpan_mojo joined #mojo
03:28 DaTa joined #mojo
03:28 nicomen joined #mojo
03:28 salparadise joined #mojo
03:28 nicomen1 joined #mojo
03:28 mudler joined #mojo
03:28 omega joined #mojo
03:28 lestrrat joined #mojo
03:29 foristh joined #mojo
03:29 stryx` joined #mojo
03:29 sri joined #mojo
03:30 Mikey joined #mojo
03:31 mattastrophe joined #mojo
04:04 basic6_ joined #mojo
04:11 alexbyk joined #mojo
04:26 inokenty-w joined #mojo
04:34 vmbrasseur joined #mojo
04:35 good_news_everyon joined #mojo
04:35 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/hfdq
04:35 good_news_everyon mojo/master 23f1a3e Sebastian Riedel: slightly more diverse examples
04:35 good_news_everyon left #mojo
04:41 good_news_everyon joined #mojo
04:41 good_news_everyon [mojo] kraih tagged v6.03 at 326599e: http://git.io/hfdx
04:41 good_news_everyon left #mojo
04:42 good_news_everyon joined #mojo
04:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/hfFf
04:42 good_news_everyon mojo/master f6f78a1 Sebastian Riedel: bump version
04:42 good_news_everyon left #mojo
04:43 cpan_mojo Mojolicious 6.03 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojolicious-6.03
04:54 irq joined #mojo
05:19 sri and the blog example now uses 6.03 features :) https://github.com/kraih/mojo-pg/commit/dd91934a6b8d154a07296a29798227960566f99e
05:19 alexbyk joined #mojo
05:40 kaare_ joined #mojo
05:44 Anon021 joined #mojo
05:48 jberger just as I'm off to bed ...
05:49 jberger Test::Mojo::Phantom talk accepted for YAPC::NA
05:49 jberger \o/
05:56 csson joined #mojo
06:01 melo joined #mojo
06:08 Oleg joined #mojo
06:09 Oleg mst: good news, it was fixed in 5.18 http://stackoverflow.com/a/29066366/3090865
06:13 sri lol
06:14 sri i was trying to test it earlier with a 5.20.2 one-liner, and couldn't get it to work
06:14 sri hahaha, same one-liner of course leaks with 5.10.1
06:15 sri that's really good to know!
06:16 sri perl -Mojo -MDevel::Cycle -E 'while (1) { my $e = Mojo::EventEmitter->new; (sub { my $name = shift; $e->on($name => sub { say $name }) })->("foo"); $e->emit("foo"); find_cycle $e }'
06:16 sri and for the record, Devel::Cycle was unable to detect it
06:17 sri very dangerous behavior before 5.18
06:17 Oleg yeah, I faced out with this when used Mojo::IOLoop::Delay on perl 5.14 with nested closure
06:18 sri you can very very easily get that with ->on(...)
06:19 Oleg yes, it was inside on :D https://github.com/olegwtf/p5-Mojo-SMTP-Client/blob/053313e05c9749b56f5aff4ada0a20120287b053/lib/Mojo/SMTP/Client.pm#L125
06:26 kaare__ joined #mojo
06:42 elik joined #mojo
06:52 marmez joined #mojo
07:04 batman joined #mojo
07:04 dod joined #mojo
07:09 dod joined #mojo
07:16 amon joined #mojo
07:20 inbioz joined #mojo
07:21 bramirez joined #mojo
07:25 inbioz_ joined #mojo
07:27 papa joined #mojo
07:28 Averna joined #mojo
07:30 cpan_mojo Statocles 0.042 by Doug Bell - http://metacpan.org/release/PREACTION/Statocles-0.042 (depends on Mojolicious)
07:33 alexbyk joined #mojo
07:35 alexbyk joined #mojo
07:58 AndrewIsh joined #mojo
08:00 bjakubski joined #mojo
08:20 eseyman joined #mojo
08:22 Vandal joined #mojo
08:31 cpan_mojo Mojolicious-Plugin-Mail 1.5 by Anatoly Sharifulin - http://metacpan.org/release/SHARIFULN/Mojolicious-Plugin-Mail-1.5
08:36 cpan_mojo Mojolicious-Plugin-I18N 1.5 by Anatoly Sharifulin - http://metacpan.org/release/SHARIFULN/Mojolicious-Plugin-I18N-1.5
08:38 trone joined #mojo
08:43 bramirez joined #mojo
08:58 cpan_mojo Mojolicious-Plugin-Riotjs 0.02 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-Riotjs-0.02
09:07 jkramer left #mojo
09:10 dod joined #mojo
09:13 odc joined #mojo
09:26 ispyhumanfly joined #mojo
09:31 Jonis that I18N plugin looks neat
09:33 Jonis can't seem to get hook before_dispatch in mojo lite to work
09:37 Jonis oh, typo
09:37 Jonis should hooks warn on that kind of error?
09:37 Jonis hook before_dispath => sub { warn "bla" }; fails silently because it doesn't exist
09:42 Lee is before_dispath a typo just here or also in your code?
09:42 Lee oh wait
09:42 * Lee reads context
09:51 Jonis before_dispath was a typo
09:51 Jonis I meant to use before_dispatch to alter the base path
09:52 Jonis Was scratching my head wondering where I went wrong, because I really expected it to work out of the box like I have done in a full app
09:52 crab don't dis your path
09:53 Jonis ;)
09:57 irq joined #mojo
10:06 cpan_mojo Mojolicious-Plugin-AssetPack 0.40 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.40
10:11 bramirez joined #mojo
10:17 inokenty-w joined #mojo
10:34 ispyhumanfly joined #mojo
10:37 ver joined #mojo
10:44 alnewkirk joined #mojo
10:46 batman Jonis: i don't think so, since you're able to add your own custom hooks.
10:48 batman so in theory, you could have app->plugins->on(before_dispath => sub {}); :)
10:50 batman s/able to/can/
10:51 crab since you're can!
10:51 batman hahaha
10:51 batman yeah... so...
10:52 * batman hides
10:52 batman (in the shadows of course)
10:52 * crab paints luminescent horns on batman
10:52 batman :)
11:08 Kripton joined #mojo
11:18 dod joined #mojo
11:38 alexbyk joined #mojo
11:44 bramirez joined #mojo
11:49 mishantil Heh. Scrollback of #mojo made me lol.
11:49 mishantil Or, pol.
11:50 mishantil The mood seems lighter in this channel than a lot of other places.
11:52 stl joined #mojo
11:58 jberger mishantil: that's the goal, and we usually succeed
12:05 neilhwatson joined #mojo
12:06 dod joined #mojo
12:08 Zx3 joined #mojo
12:26 inbioz joined #mojo
12:44 ashimema I is confused
12:45 ashimema using 'my $request = $self->tx->req->json;' to de-serialize a json body
12:45 ashimema just gonna pastbin the results
12:48 mattastrophe joined #mojo
12:48 cpan_mojo Mojolicious-Plugin-AssetPack 0.41 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.41
12:49 ashimema i seem to have lost our nopaste
12:49 Zoffix http://fpaste.scsys.co.uk/
12:50 ashimema mojo isn't in the channel list though?
12:51 Zoffix Just use "none". That's just for a bot announcer.
12:51 Zoffix I don't know what pastebin #mojo used to use..
12:52 ashimema k.. cheers
12:53 ashimema posted json body http://fpaste.scsys.co.uk/469558
12:54 cpan_mojo Mojolicious-Plugin-Bootstrap3 3.3006 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-Bootstrap3-3.3006
12:54 batman i don't remember who i discussed M::P::Bootstrap3 with, but it finally has support for easy customization, like i talked about. add support for "theme" and "custom": https://github.com/jhthorsen/mojolicious-plugin-bootstrap3#register
12:54 ashimema and the resulting perl output from data dumper: http://fpaste.scsys.co.uk/469559
12:55 ashimema anyone know why my first json bool is getting decoded nicely, but the second one is butchered?
12:55 Zoffix ashimema, that's just the output of Dumper
12:55 Zoffix ashimema, it's basically telling you the second values is the same as the first one
12:55 ashimema so i'm just misreading Data::Dumper then
12:56 Zoffix Yeah, I think if you do $Data::Dumper::Deepcopy = 1; before dumping it'll avoid that.
12:57 ashimema coolios.. you learn somthing new every day.. cheers :)
12:57 ashimema oh..
12:57 punter joined #mojo
12:57 ashimema I see my issue now.. I was checking for truthyness not definedness..
12:57 ashimema muppet (in the next line that is)
12:57 ashimema duper was a red herring
12:58 ashimema that's better :)
13:09 bwf joined #mojo
13:13 alexbyk Hi mojo people. Hope today nobody is angry on me) Let me share an idea how you could use automated testing of leaks in Mojolicious (framework and your apps)?
13:16 Trelane good morning #mojo.  Do we have a comparison documents of mojo compatible servers somewhere?  I'm looking for something that supports async and websockets and is PSGI compatible so we can re-use existing middleware
13:22 Lee batman: it seems that Plugin::OAuth2 no longer returns the $tx https://metacpan.org/source/JHTHORSEN/Mojolicious-Plugin-OAuth2-1.5/lib/Mojolicious/Plugin/OAuth2.pm#L199 # how do i get to this?
13:23 batman Lee: you don't with the new api.
13:23 Lee what happens when i want to get the refresh token, expires in value, etc?
13:23 batman Lee: how did you get it before?
13:24 Lee $tx->res->json ...
13:24 batman ok. let me have a look...
13:25 batman i've never cared about expires, since it makes it so much harder to code :)
13:25 batman Lee: but your app still works with the old api, right?
13:25 Lee yes
13:26 batman Lee: would it be enough if you had $tx->res->json in the callback?
13:26 Lee yep
13:26 Lee i think you'll find https://metacpan.org/source/JHTHORSEN/Mojolicious-Plugin-OAuth2-1.5/t/live.t is broken (not checked, but at a glance i can't see how it works)
13:27 batman Lee: i agree... no idea why it didn't fail when i tested it locally :(
13:28 inbioz joined #mojo
13:29 batman Lee: how do you like the new api? better/worse? (apart from what you just said)
13:29 batman is it a step forward or backward?
13:29 Lee at a glance: better. mocking is nice
13:29 batman cool
13:30 Lee previously i'd been sticking my server plugin there for mocking
13:30 Trelane what do I need from a webserver to support websockets in mojo?
13:30 batman yeah... i looked at that plugin. if i get time, i'm going to "port" it to a controller sub class.
13:32 cpan_mojo Mojolicious-Plugin-AntiSpamMailTo 1.001001 by Zoffix Znet - http://metacpan.org/release/ZOFFIX/Mojolicious-Plugin-AntiSpamMailTo-1.001001
13:34 Lee batman: cool. it should "just work" with a basic config (but obviously won't have persistence)
13:34 * Lee is glad he's not written his talk yet :D
13:35 Lee and also: patches welcome as i'm sure it could be improved
13:35 batman Lee: yeah, i just thought it was a bit too much to set up... i might just use your plugin. depends on how much time i have.
13:35 batman anyway... i'm super happy you made it. wouldn't have either opportunities if you hadn't :)
13:35 batman Lee++
13:36 cpan_mojo Mojolicious-Plugin-AntiSpamMailTo 1.001002 by Zoffix Znet - http://metacpan.org/release/ZOFFIX/Mojolicious-Plugin-AntiSpamMailTo-1.001002
13:38 bramirez joined #mojo
13:41 zivester joined #mojo
13:41 fhelmber_ joined #mojo
13:44 jberger Trelane: IIRC there was a plugin on cpan that translated middleware interactions for mojo servers
13:44 batman Lee: what do you think? https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2/pull/40/files
13:45 jberger Trelane: https://metacpan.org/pod/Mojolicious::Plugin::PlackMiddleware
13:45 batman Lee: if you like it, tell marcusr :)
13:45 Trelane jberger: interesting
13:45 jberger alexbyk: I think people are cooling down
13:45 jberger and it turned out that you had a point, but your manner of discussion and worse your response afterwards rubbed several people the wrong way
13:46 Trelane jberger: interesting.  However in the short term I'm also going to need to mount another psgi app
13:46 Trelane in the same server
13:46 Lee batman: looks good to me
13:47 jberger Trelane: tbh, I haven't used that plugin, and its possible you are in uncharted territory
13:47 alexbyk jberger, so here is an example of idea. it can be evolved https://gist.github.com/alexbyk/5df642f175c541db9234
13:48 jberger Trelane: you might want to look at how https://github.com/kraih/mojo/blob/master/lib/Mojo/Server/PSGI.pm works
13:48 alexbyk after fixing implementation bugs of some modules it could be evolved to smthng short and automated
13:49 jberger alexbyk: you are intending this as a leak testing test library?
13:50 batman Lee: I'm asking marcusr now...
13:50 Trelane Maybe I want to go the otherway
13:51 Lee batman: just commented in the PR
13:51 * Trelane looks at how you hook into web sockets in mojo
13:51 alexbyk jberger: this is not a library) this is just an idea that will garant. work in 100% cases. but have to be evolved and some modules of mojo have to be fixed
13:51 jberger alexbyk: define fixed
13:52 marcusr afaik async in the PSGI spec is not really well defined, Trelane.
13:52 jberger Trelane: mojo's websockets are handled natively
13:52 jberger I'm not sure what you mean by hook into
13:53 alexbyk jberger: at that gist all part between # deal with ... / deal
13:53 gryphon joined #mojo
13:53 jberger Trelane: might it not be easier to run whatever you have already via starman and proxy things around using nginx
13:54 Trelane jberger: yeah, maybe
13:54 purl yeah, maybe is, like, what i need for optional positionals
13:54 jberger alexbyk: it is unlikely that there will be DESTROY subs for those classes added natively to mojo
13:55 jberger and those don't fix things they just monitor that what is created has been destroyed
13:55 alexbyk jberger: no, that's no what I mean
13:55 Trelane what I'm mainly hearing here is "there's no default way to hook a psgi compatible webserver directly up to mojo's websockets because there's nothing in the spec that supports that, and you'll need to actually use your brain to work out how to get this to work"
13:56 Trelane is that a fair assumption?
13:56 jberger Trelane: I think so
13:56 alexbyk jberger: wait a minute
13:57 batman marcusr: when do you have time to look at the PR?
13:57 marcusr batman: I've looked at it, I don't really like how the deprecation is done.
13:57 jberger alexbyk: just to summarize the other day. It turned out you had a point, but you presented it in an incomplete and hard to understand manner, and then insisted that we take it the rest of the way
13:57 marcusr I understand the need tho
13:57 batman marcusr: not sure if we have any other option :(
13:58 jberger alexbyk: please, this time, come up with a complete proposal
13:58 batman marcusr: i totally agree though... i will remove it in a month or so.
13:58 alexbyk jberger: let's forget about other day)
13:58 jberger alexbyk: if for no other reason that then we will be able to understand
13:58 jberger alexbyk: I'm willing to forget, but I'm worried that it is about to be repeated
13:58 jberger because again I have no idea what you are asking about
13:59 alexbyk jberger: I'm not asking) I'm sharing an idea)
13:59 jberger alexbyk: well, then I don't understand it either
14:00 jberger can you make a complete proposal, something with a reasoned argument and complete code (with real world example)
14:00 jberger alexbyk: you should take a look at Oleg++ spectacular article that made your case the other day
14:00 batman marcusr: will you accept it with those terms? (me getting rid of the ugly deprecation warning it in a month)
14:01 alexbyk jberger: I saw it) So maybe I just can't express myself) That gist give an idea how to make an automated testing))) You can run it and see the result)
14:01 jberger if you had presented your argument in anything like that manner, no misunderstanding would have happened
14:01 ribasushi jberger: link?
14:01 jberger alexbyk: I don't want to run it and see, I'm busy, as are the rest of us
14:01 jberger make your case
14:01 alexbyk jberger: )))
14:02 marcusr batman: how about passing the complete response as a third argument instead?
14:02 marcusr or even the request object
14:03 marcusr I think the most common case is people wanting the token.
14:03 alexbyk jberger: no case ) I just wanted to share a sample) If someone is interesting he can check it out) If not he can do nothing with that) That's not a proposal, only an idea)
14:03 marcusr a/request/response/
14:03 Trelane hmm
14:03 Trelane so I found this: https://metacpan.org/pod/Plack::App::WebSocket
14:03 batman marcusr: that will break the api. (changing the number of arguments to the callback is not back compat)
14:03 jberger alexbyk: all the more case to make a blog post that interested readers can investigate
14:04 Trelane which seems to be a websocket implementation that works with compatible psgi applications
14:04 marcusr batman: what's the potential for breakage when adding extra arguments?
14:04 Trelane er, psgi servers even
14:04 batman marcusr: do you mean on a scale from 1 to 10?
14:04 batman if so, it's close to 10 :)
14:04 marcusr batman: no, I'm asking about a scenario where it breaks.
14:05 batman marcusr: sub { my $delay = shift; $self->oauth2->get_token($delay->begin); $pg->db->query("SELECT * FROM my_table", $delay->begin); }
14:06 jberger alexbyk: if you post a snippet here, it will be quickly forgotten
14:06 batman it won't be compatible with this second step: sub { my ($delay, $e1, $token, $e2, $db_res) = @_; }
14:06 marcusr batman: I see.
14:06 jberger alexbyk: if you make a blog post, and explain why leak testing is important, then demo your code (preferrably in a real world way) people will learn from it
14:07 marcusr batman: I have to think about it a bit more.
14:07 jberger plus the more chatter that people see about mojo, the better
14:07 batman marcusr: ok
14:09 alexbyk jberger: If i had talent to write poems I write block post) But looks like that's something I'm missing)
14:09 jberger practice makes perfect!
14:09 alexbyk maybe I should get a try)
14:10 jberger learning how to clarify a position is an important part of group software design
14:10 jberger you can have all the right ideas, but if people don't follow your reasoning, its not going to help the project
14:11 jberger ribasushi: I'm still looking for that link, it was only a couple days ago
14:12 Trelane oh oh oh
14:12 Trelane I think I can get this to work by using psgix.io
14:12 batman jberger++
14:13 Trelane I might have to re-write Mojo::Server::PSGI (or rather gut it and re-do it)
14:13 Trelane I should write a proof of concept replacement
14:13 jberger ribasushi: http://rec.data-flow.ru/articles/2015/3/circular-references-memory-leaks-and-mojo.html
14:13 batman Trelane: i think i would rather make a plugin to mojo which can mount a psgi app.
14:13 batman Trelane: like i did for CGI...
14:14 Trelane batman: I think we're getting ahead of ourselves, I only said I *think* it might work
14:14 Trelane let's see if I'm barking completely up the wrong tree first
14:15 batman Trelane: but ws would work if you started hypnotoad. and psgi would then work if you created an adapter to the other psgi app.
14:25 irq joined #mojo
15:14 disputin joined #mojo
15:15 cpan_mojo Mojolicious-Plugin-OAuth2-Server 0.09 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-OAuth2-Server-0.09
15:16 inbioz joined #mojo
15:18 sri so, everybody saw this yesterday? http://irclog.perlgeek.de/mojo/2015-03-16#i_10285691
15:19 sri don't use anything before perl 5.18 if you have a lot of closures!
15:20 ribasushi .oO( or you know, just write your code with the limitation in mind...? )
15:21 sri honestly, i don't think that's realistic, the old behavior was crazy
15:23 sri all it takes is an observable in a callback https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L113
15:24 sri and Devel::Cycle won't even find your cycle, that's insane
15:24 sh4 joined #mojo
15:26 ribasushi D::C does not use PadWalker, so it couldn't do that
15:27 sri it does use PadWalker actually
15:27 Lee ah nuts, i just added about 300 closures to CGI.pm ...
15:27 * Lee wrtes some tests
15:28 Lee wait, *nested* closures
15:28 * ribasushi looks...
15:28 purl looks are free today :)
15:29 marty joined #mojo
15:30 sri this is what i used to test it... http://irclog.perlgeek.de/mojo/2015-03-16#i_10285707
15:30 sri leaks like crazy on anything before 5.18
15:30 sri and no cycle detected
15:34 nicomen good thing jessie is almost out with 5.220
15:34 nicomen *5.20
15:37 sh4|2 joined #mojo
15:37 Lee hurrah! no leaks (that i can see)
15:39 Lee oh wait... leaks :(
15:40 jberger ♬ there's a hole in the bucket ... ♬
15:41 Lee TBH this was just a micro-optimisation in the first place, so i'm not bothered about reverting it
15:47 Lee oh look, it turns out CGI.pm has always leaked like crazy
15:57 jberger that's not a galloping surprise though right :-)
15:59 Lee no, not  really :D
16:01 gryphon joined #mojo
16:14 odin22 joined #mojo
16:38 fhelmber_ joined #mojo
16:41 inokenty-w joined #mojo
16:57 Oleg joined #mojo
17:00 jb360 joined #mojo
17:20 dod joined #mojo
17:25 dod joined #mojo
17:53 csson joined #mojo
18:15 marty joined #mojo
18:23 mibeaadsd joined #mojo
18:33 cpan_mojo Mojolicious-Plugin-AssetPack 0.42 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.42
18:37 marty joined #mojo
18:52 cpan_mojo MojoX-Renderer-Xslate 0.10 by gray - http://metacpan.org/release/GRAY/MojoX-Renderer-Xslate-0.10
18:56 jberger hahainternet: around?
18:56 jberger hahainternet: https://github.com/jberger/Mojo-Shipment
18:58 disputin joined #mojo
18:58 sri why is it in the Mojo namespace?
18:58 sri seems generic
18:59 hahainternet o/ jberger
18:59 hahainternet oh nice
18:59 hahainternet i'll chat in a bit, i just gotta do a bunch of other crap
19:02 asarch joined #mojo
19:02 jberger sri: funny thing is, $boss says the same thing
19:02 sri i like your boss
19:03 mst ah, the same antipattern that results in people calling things MooseX::Something just because they used Moose in it
19:03 Grinnz heh
19:03 jberger the real reason is I had a hard time finding an unused namespace
19:03 sri lol
19:04 Grinnz Net::Shipment ?
19:04 sri Shipmentilicious
19:04 jberger which seems to make you think that there should be enough modules that do this, but not the way I want
19:04 Grinnz hahaha
19:04 jberger Grinnz: haha, I like it!
19:05 jberger its damn near a ::Tiny module in my mind
19:05 sri more like Meatspace::Shipment
19:05 Grinnz heh
19:06 jberger Shipping is available :o
19:07 jberger I'm never quick to take a top-level though
19:10 berov joined #mojo
19:11 jberger here's a though, Webservice::Shipment
19:11 jberger thought
19:11 jberger I think its safe to say that these are all web services
19:12 mst Webservice::Shipping::Abstract or something
19:12 janus joined #mojo
19:14 jberger for the record, I'm going to implement a non-blocking api too
19:14 jberger the hard thing is that it's impossible to test
19:14 jberger since I have to mock out the request method
19:14 jberger clearly you can
19:14 jberger 't test against live data
19:15 jberger I guess I could make a mock service
19:15 jberger hmmmm, ponders
19:19 mst jberger: Test::LWP::UserAgent
19:19 * jberger sets mst on fire
19:22 mst jberger: I'm sorry, is porting that to Mojo too hard for you?
19:22 sri how inelegant
19:22 mst sri: I've found it a really nice balance when I've got a bunch of different endpoints
19:23 mst for testing a single app I just use LWP::Protocol::PSGI
19:23 sri we can do much better https://github.com/kraih/mojo/blob/master/t/mojo/user_agent.t
19:24 sri $ua->server->app(Mojolicious->new); and put whatever you like into that app
19:24 sri $ua->server->app->routes->get('/whatever' => sub { my $c = shift; ... });
19:24 sri full app
19:24 jberger sri: even that is more than needed
19:24 jberger almost done
19:25 sri and of course $ua->on(start => sub {...}) to rewrite requests however you like
19:27 sri it's not actually mocked, real sockets are being used, so you can even use real-time features, stream a chunked response or whatever
19:28 jberger for now this is sufficient: https://github.com/jberger/Mojo-Shipment/blob/master/t/ups.t#L1-L19
19:29 sri boring ;p
19:32 jberger yep!
19:32 jberger and I already have a non-blocking test written
19:33 sri your use of Test::Mojo is not good though
19:34 sri better use a new Mojo::UserAgent
19:34 sri and $ua->server->url/nb_url
19:34 jberger you think that's better?
19:34 jberger what's the difference?
19:34 sri app->url_for('/') seems pointless
19:35 jberger that's probably true
19:35 irq joined #mojo
19:37 jberger it's handy though because internally I use Mojo::URL objects
19:38 jberger which, if I'm trying to make it generic is maybe a no-no
19:38 jberger :/
19:44 asarch joined #mojo
19:49 trone joined #mojo
19:57 marmez joined #mojo
20:02 genio joined #mojo
20:07 odc` joined #mojo
20:09 OmarOthman joined #mojo
20:13 dod joined #mojo
20:17 Eke- joined #mojo
20:20 OmarOthman Hi All
20:20 jberger https://github.com/jberger/Webservice-Shipment
20:20 OmarOthman I have a Mojolicious application that I'm treating like a background process. It is doing monitoring.
20:20 OmarOthman So, for every metric that you are monitoring, I want to register a recurring event on Mojo's event loop. This event should fetch the data that we are monitoring, check whether it is (ab)normal, and based on that it should do some "self-healing" actions, or alert human beings if it can do nothing to solve the problem.
20:20 OmarOthman I'm hereby consulting you to leverage the framework's capabilities as best as possible for doing that.
20:20 OmarOthman Every aforementioned step can take time, obviously. Fetching the data will be via HTTP, I know about the non-blocking variations in Mojo::UserAgent for that. I also read about Minion and Mojo::IOLoop::ForkCall for computationally intensive steps.
20:20 OmarOthman What I know now is that every one of the recurring events should be executed by a Mojo::IOLoop::Delay object, so that every step can only be executed after the previous step to guarantee the ordering, even if steps contain non-blocking calls. So I think I have enough familiarity now to handle individual steps.
20:20 OmarOthman My question is actually how to "synchronize" Mojo::IOLoop::Delay objects", so that if the recurring event fires again to establish a new iteration of the monitoring cycle, it waits till the previous cycle has finished.
20:20 OmarOthman Can that be done?
20:21 batman jberger: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2/blob/master/lib/Mojolicious/Plugin/OAuth2.pm
20:22 batman Look for _mock_interface().
20:22 batman I like to do it that way, so others can benefit from the same t"estability"
20:23 jberger batman: yeah, I really kinda dislike having any testing code in the lib proper
20:23 jberger I'm thinking if I can do your t::Helper trick though
20:24 batman jberger: What about the users of your library? Do they have to go through the same loops as you to test it?
20:24 jberger OmarOthman: sounds like you want to emit events
20:25 batman jberger: even if you don't put it in the same module, you should provide some sort of way to test your API
20:25 OmarOthman jberger: That's what I do at the beginning: Mojo::IOLoop->next_tick($whole_cycle_sub);
20:25 batman ...withouth replicating your boilerplate t::Helper
20:26 OmarOthman jberger: And then, in that, Mojo::IOLoop->recurring( $interval => $cycle_sub );
20:26 batman It might not be pretty, but it sure is easy to test OAuth2 :)
20:26 * batman likes it.
20:26 jberger batman: hmmmmm, I'll have to sleep on it
20:26 batman Hehe
20:27 OmarOthman jberger: So, the event is actually firing every $interval. In each of these, I'm doing a lot of stuff, and if that takes too much time, I don't want the next event to start working except after that finishes.
20:27 jberger OmarOthman: if you emit that your cycle is complete, you can then schedule another run
20:27 jberger rather than doing so in a pure recurring
20:28 OmarOthman jberger: But how will I know the $interval then? I have to do the math myself?
20:28 nicomen or use some semaphores to check wether a cycle is in progress, and not start if is is?
20:28 OmarOthman Like, I want the check to happen every minute for example.
20:28 jberger nicomen: that was going to be my next suggestion
20:29 jberger OmarOthman: I don't think too many of us use the loop like that
20:29 nicomen probably some kind of global table with "type of cycle" if you are doing several different ones?
20:29 OmarOthman That sounds way better. Actually, this is for correctness much more than it is for "actually what will happen". In other words, it is not expected at all that a single cycle takes too much time, but just in case.
20:30 nicomen OmarOthman: I'm interested in what you are working on, I need to do something similar soon
20:30 OmarOthman What does Mojolicious have to offer on semaphores and that kind of stuff?
20:30 jberger OmarOthman: be sure you have your error conditions handled tough
20:30 jberger though
20:30 jberger OmarOthman: that's all roll your own
20:30 jberger shouldn't be hard though
20:30 nicomen OmarOthman: that's just simple hash-lookups, or any other storage
20:30 jberger just a flag
20:31 jberger OmarOthman: here's a different idea
20:31 OmarOthman OK, I wanted to know whether there is support for that, exactly like how Mojo::IOLoop::Delay supports "steps". That actually is my question.
20:31 jberger does this need to be recurring?
20:31 jberger can this be an app command that gets run by cron
20:31 jberger ?
20:31 sri fatal warnings in perl was such a stupid idea, now every time someone proposes a new sensible warnings... it's all "but that breaks backwards compatibility with fatal warnings code!"
20:32 OmarOthman Exactly. I want to schedule a delay object for every iteration in the recurring event, and to have these synchronized, as if they are "steps in a global delay".
20:32 jberger OmarOthman: I'm asking if you need a global recurring?
20:33 jberger cron is really good at "global recurring"
20:33 OmarOthman But how would that solve the problem?
20:33 sri feels odd to agree with ribasushi on something :)
20:33 jberger sri: link?
20:34 sri http://code.activestate.com/lists/perl5-porters/218844/
20:34 OmarOthman jberger: I already have a recurring event from the IOLoop, I just don't want to start the next event except after finishing processing this one...
20:35 OmarOthman (I hope I'm able to illustrate this clearly)
20:35 jberger OmarOthman: you are
20:36 OmarOthman I want a mechanism to synchronize "Mojo::IOLoop::Delay"s exactly like how every "Mojo::IOLoop::Delay" synchronizes steps...
20:36 jberger OmarOthman: you can nest them
20:36 sri oh, march 19 will be openssl upgrade day again
20:37 jberger sri: new version or new CVE?
20:37 sri "high severity issues to be disclosed"
20:37 OmarOthman jberger: I can't readily see how that will work to be honest... I'll think about that...
20:37 jberger hopes the new CVE has better graphics
20:38 OmarOthman jberger: Because basically if a Mojo::IOLoop::Delay finishes its work before the next event fires, then nothing is needed.
20:38 jberger make the recurring wait a minute then run again
20:38 OmarOthman This mechanism is only needed if a Mojo::IOLoop::Delay takes a lot of time that actually the next event fires
20:39 OmarOthman OK, so you're suggesting a "global" flag, checked by every iteration, and "sleeps" if it is set?
20:40 jberger Mojo::IOLoop->delay(sub{ Mojo::IOLoop->timer(60 => shift->begin) }, \&do_task });
20:40 jberger you can do that ^^ repeatedly
20:41 OmarOthman And do_task() calls ->end?
20:41 jberger depending on how it is architected, but abstractly, yes
20:42 sri OmarOthman: have you actually considered preforking? would that recurring timer run in every worker process?
20:42 jberger I still think that if this is a maintenance process that shouldn't overlap, it sounds like that should just be an app command and have cron invoke it
20:44 disputin joined #mojo
20:44 OmarOthman sri: What do you mean by "every worker process"? I don't have any forks, but I was going -- inside the steps of every Mojo::IOLoop::Delay which represents the handler of a single event -- to call Mojo::IOLoop::ForkCall if I expect that to be too long. Other than that, I'm just running the event loop and making non-blocking calls in the steps.
20:45 sri OmarOthman: which server are you using?
20:45 OmarOthman sri: Just the Mojolicious built-in one.
20:45 sri OmarOthman: which one?
20:46 sri morbo, hypnotoad, daemon, prefork?
20:46 sri i supsect you need to take a look at http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#DEPLOYMENT
20:46 OmarOthman Daemon in development, not sure about the production version, I think Hypnotoad.
20:47 sri hypnotoad is a preforking server
20:47 sri it maintains a pool of worker processes
20:47 OmarOthman jberger: Is "cron" something that has support in Mojolicious? Or you are referring to the abstract concept?
20:48 sivoais joined #mojo
20:51 jberger OmarOthman: does this thing serve pages?
20:51 jberger is it a server or is it just a long running background process?
20:54 marty joined #mojo
20:55 OmarOthman We can say no for the time being. Let's say it runs every minute. So, every minute, I
20:55 OmarOthman (1) Fetch the data for this minute (example: CPU temperature on the machine)
20:55 OmarOthman (2) Normal? Yes => fine. No => goto (3).
20:55 OmarOthman (3) Do this self-healing action. Successful => fine. Not => goto (4).
20:55 OmarOthman (4) Notify. SMS the sysadmin, email, whatsoever.
20:55 OmarOthman The reason why I am saying "no for the time being" is that I want to add the ability of visualizing the data fetched in (1), so yes, maybe later I want to serve back this data to be visualized on a graph. But that is not for now.
20:56 OmarOthman Everyone of these can be a long process. That is why a Mojo::IOLoop::Delay encapsulates all of them as steps.
20:56 OmarOthman And I didn't want the next step to start unless this one has finished.
20:58 * sri wonders if we've made a huge mistake deleting old mojolicious releases from cpan
20:58 sri carton/cpanm will install them from backpan, which has no signatures or https
20:59 jberger OmarOthman: so, could you encapsulate those steps as an app command http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Adding-commands-to-Mojolicious
21:00 sri so, pinning a specific version in your cpanfile can have serious security implications :S
21:00 jberger so that you could do ./myapp.pl check by hand
21:00 jberger actually, whether its a command or its own script doesn't really matter
21:00 jberger command if you already have a main app with useful helpers
21:00 jberger script if not
21:01 jberger OmarOthman: here's the real question
21:01 jberger what happens if something interrupts your loop?
21:01 jberger you are suddenly without monitoring
21:01 jberger cron is bulletproof
21:02 jberger it is meant for things like this
21:02 jberger (right tool for the job)++
21:02 OmarOthman So, you are talking about actual Linux CRON system, not a Mojolicious concept...
21:02 jberger yes
21:02 jberger your script can be all mojo
21:02 jberger but have cron run it
21:03 jberger (if anyone disagrees with me, please speak up!)
21:03 OmarOthman Well, I don't also see how that will solve the problem. Can a CRON wait for a previous run of itself?
21:03 mattastrophe joined #mojo
21:03 OmarOthman Sorry, I don't know much about its internals...
21:04 OmarOthman Like, if a CRON is scheduled every minute, will it wait for the previous run to finish?
21:04 jberger OmarOthman: http://serverfault.com/questions/82857/prevent-duplicate-cron-jobs-running
21:04 OmarOthman OK, cool, I'll read about that.
21:05 jberger OmarOthman: I'm not saying that a background script that runs forever is wrong either, this is just what I might do in your case
21:05 OmarOthman OK
21:05 OmarOthman I think nothing else for now, I've taken a lot of your time already. Thank you so much for your dedication!
21:06 jberger OmarOthman: let us know what you figure out!
21:06 OmarOthman But if that something that makes "global sense", meaning that it might benefit other people, please consider adding a feature request for that. I think you'll write it way more succinctly than how I will, but if you want me to write that, please let me know.
21:07 OmarOthman Sure, I definitely will. I think it deserves a blog post after it is done.
21:10 jberger https://twitter.com/cpan_new/status/577577653567254528
21:12 jberger OmarOthman: having a run-forever loop is already supported
21:12 jberger I just think that for monitoring, but think about this, even hypnotoad occasionally restarts its workers
21:13 jberger because you want to be sure that everything keeps running
21:13 OmarOthman Do you mean Mojo::IOLoop->recurring?
21:13 jberger one run-forever loop is fragile
21:13 jberger OmarOthman: in this case yes
21:15 OmarOthman I agree, but that (fragility) is another problem, solved by a "big brother" that monitors the whole Mojolicious application. The feature request is to have a timely run-forever loop, but that synchronizes its iterations, so that no previous iteration runs together with a current one.
21:15 sri OmarOthman: that will never be a core feature
21:15 sri it's too easy to do already
21:16 OmarOthman sri: Well, the whole discussion was about that, so I don't think it is too easy... :)
21:16 sri literally the same way it's done in the cron example
21:16 sri you've been told the rigth solution multiple times
21:17 sri just use a lock, and be done with it
21:17 OmarOthman OK, I'm already reading about it.
21:17 OmarOthman Thanks!
21:17 sri be it flock, a semaphore, a global variable...
21:19 disputin joined #mojo
21:31 DesertFox joined #mojo
21:36 kaare joined #mojo
22:14 acks joined #mojo
22:16 acks I'm having a problem with an existing Mojo app. I have added some new routes, views, controllers, and models, and am returning database results to view using Rose::DB::Object ORM. I updated the production version today with code that had been working great on Morbo. But, on apache plack psgi config the new Models are only returning the queries about 1 in 5 sometimes 1 in 10 times.
22:17 acks I've eliminated variables, like I can query the database and get my results no problem. Older Models always work.
22:17 acks It appears that only this new functionality is intermittent. I have narrowed requests to only one server and have restarted apache. But, am now at the point that I don't understand why the issue is persisting.
22:18 acks any help or ideas would be awesome.
22:25 sri we don't actually have that many psgi users
22:25 sri is it fastcgi or mod_perl?
22:26 sri (that kind of super weird problem usually hints at mod_perl)
22:26 acks Yea, this is legacy stuff.
22:27 acks I have updated to latest Mojo as part of the project, but haven't addressed the stack.
22:27 acks below that.
22:27 purl below that is an ad for the "Royal Flush."
22:27 sri that didn't answer the question
22:28 acks But, even mod_perl issues are usually cured with an nice apache restart.
22:28 carsten joined #mojo
22:28 lb except for leaks
22:29 lb also, you don't use mod_perl unless you can articulate why it's a good idea
22:30 sri legacy is a valid reason imo
22:30 sri but that doesn't help with weird shit happening :)
22:31 sri one might argue that you should use mod_perl during development too though
22:31 acks No, I don't really understand how PSGI works exactly. I expected it to be similar to fastcgi.
22:32 disputin joined #mojo
22:32 sri psgi is not relevant really
22:32 acks Yes, I think if I had my way I would not set this up the way that it is set up. Im actually using morbo in dev.
22:32 acks can you elaborate?
22:32 sri it doesn't protect you from the mod_perl insanity, just translates a few things into a common format
22:33 acks I c. ok, so under the hood I'm dealing with mod_perl is what your saying?
22:33 sri psgi doesn't control the surroundings, you're still running inside a cgi, fastcgi or mod_perl process, with all the downsides
22:33 carsten joined #mojo
22:33 acks Yea, ok. it is mod_perl then
22:34 lb nonono
22:34 lb proxy to something that speaks http
22:35 lb the cookbook has plenty of help to set that up correctly
22:35 lb having http as the interface will keep you sane
22:36 acks Ok. I would say this app has been running on this config for years without me ;) Though I don't know that anyone has updated it in years either.
22:36 lb mod_perl will run for years with the occasional restart, but it won't keep you sane
22:37 * lb has run apps on mod_perl for years too, anything is saner
22:37 lb unless you NEED what mod_perl does, and you don't, which is exposing the apache api to perl code
22:37 acks Alright I'll take a look at config and see if I can modernize that part of the stack. But, that's days away, so I'm a bit stuck at this point.
22:38 lb mod_perl is designed to solve the problem of "writing apache extensions in perl", not "make my cgi script faster" - so guess what's the typical use case
22:40 sri point is, there's very little mod_perl know how in the community anymore, pretty much everybody uses a reverse proxy setup
22:40 lb (pretty disappointed the openbsd httpd doesn't support reverse proxy)
22:41 lb can't imagine that's the hardest part of an httpd
22:41 sri you may see the occasional fastcgi, but that's going away too
22:41 acks You mean the mojo community? Cause I think the rest of the perl world, you know all 500 of us, are still running the same old code in mod_perl.
22:41 acks haha
22:41 lb wow, you're out of touch
22:42 sri mod_perl has been discouraged in the community when i was still working on catalyst ;p
22:42 acks Truth is, I'm not really a " perl guy" but everywhere I go work has perl running that way.
22:43 preaction mod_perl has been recommended against for quite some time. the answer to most mod_perl questions in the main perl channels is usually "find some way off mod_perl"
22:43 marmez left #mojo
22:44 lb acks: that does give you the advantage of telling people who are " perl guys" how they're wrong, yes
22:44 preaction or how there's only 499 others
22:44 lb 498 now, one just died :(
22:44 acks ok. I do appreciate the help. I'm sort of stuck with the environment I inherited. Upgrading is a hard sell because of the potential cost.
22:45 acks haha
22:45 sri we would be so fricking rich if there was only 499 of us
22:45 lb that's my retirement plan
22:45 preaction you're using PSGI, it's exactly developed to change deployments easily
22:45 preaction that said, psgi+mojo is not exactly the best path forward
22:46 sri for pure blocking apps it's not that bad of a choice
22:47 sri if you're min/maxing a starman setup might get you the most rps
22:47 lb rotations per second, weird
22:58 marty joined #mojo
23:04 acks1 joined #mojo
23:13 sri i guess type hints will be all the rage this year
23:14 sri after python, it's also going into php https://wiki.php.net/rfc/scalar_type_hints_v5#vote
23:15 sri function foo(string $a, bool $b): float {...}
23:16 lb stuff going into php is very low on Maslow's hierarchy of needs
23:18 tianon \Class\Namespaces
23:18 tianon enough said
23:20 sri they do get shit done though, gotta admire that
23:20 sri the number "6" got spoiled by a messed up dev effort... lets jump to php 7
23:20 preaction if only...
23:21 * preaction sighs wistfully

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