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

IRC log for #mojo, 2015-10-26

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

All times shown according to UTC.

Time Nick Message
00:17 sunrise joined #mojo
00:20 sunrise i have a mojolicious::lite app which makes slow db queries, and i get inactivity timeout after 20 seconds
00:21 sunrise how do i bump this timeout?  i am using morbo.
00:22 preaction sunrise: http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
00:23 sunrise i see that, but i am not directly using either of these packages
00:25 preaction you're using Mojo::Server::Daemon
00:25 preaction and note also the MOJO_INACTIVITY_TIMEOUT envvar
00:25 preaction if you're using morbo in production, please don't
00:25 sunrise no it isn't production, it's on my local machine.
00:27 sunrise oh it looks like you can set it $c->inactivity_timeout(#) inside a route handler
00:28 preaction i thought it had to be $c->tx->inactivity_timeout, but i couldn't find that documented
00:31 good_news_everyon joined #mojo
00:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWwUP
00:31 good_news_everyon mojo/master ca160cc Sebastian Riedel: mention the new inactivity_timeout helper
00:31 good_news_everyon left #mojo
00:35 preaction src++
00:35 preaction sri++ too
00:38 Grinnz sunrise, also consider async DB queries via Mojo::Pg or Mojo::mysql, or running the query in a fork_call from Mojo::IOLoop::ForkCall (the fork will need to get a new connection of course)
00:39 Grinnz (and you will want to use AutoInactiveDestroy on your DBI handles)
00:40 sri which is the default in Mojo::Pg :)
00:46 sunrise my db handle is wrapped inside a FooData package, and gets used by a lot of different programs.
00:46 sunrise so i cant rewrite that part
00:47 sunrise as for the rest, this is a lite app with a pile of route handlers which return json to jquery on a webpage
00:48 aborazmeh joined #mojo
00:48 Grinnz sunrise, IMO not being able to get a new database handle at will is a problem waiting to happen
00:48 sunrise i dont really understand sharing state between multiple different requests.  like implementing a FooData pool.
00:49 Grinnz (or using a connector which will get a new handle as needed)
00:50 Grinnz sunrise, generally you need a database for that if you plan to use a prefork server
00:50 Grinnz as in, store it in the db :)
01:05 sunrise i could rewrite this to use has/attr and use hypnotoad
01:05 sunrise i realized i just lied, i have 3 sites running morbo ;)
01:27 sunrise should i really fix that?  :(
01:36 asarch joined #mojo
01:45 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Morbo
01:47 sunrise is there provision for cleanup when the worker exits, or is that why the warning baout autoinactivedestroy
01:52 bpmedley osfameron++ # Blog posts are awesome
01:54 Grinnz sunrise, AutoInactiveDestroy prevents handles that get (often accidentally) shared with forked processes from disconnecting when the child exits, causing it to get disconnected in the parent as well
01:54 Grinnz probably not a very good attribute name, but yeah...
02:01 sunrise oh
02:02 sunrise switched to hypnotoad and the response time dropped by half to 40ms on average
02:07 osfameron sri, bpmedley: thanks
02:07 osfameron will try to clarify for Zoff<TAB> later.  suggests I didn't explain the idea very well
02:21 inokenty-w joined #mojo
02:25 sunrise thanks
02:46 cpan_mojo Mojo-PgX-Cursor-0.502000 by NNUTTER https://metacpan.org/release/NNUTTER/Mojo-PgX-Cursor-0.502000
03:15 osfameron and... as I can't sleep, some benchmarking https://github.com/osfameron/pageboy/pull/28
03:16 osfameron (of Template::Toolkit vs Mojo::DOM manipulations.  tl;dr - latter is about 20% slower, which I think isn't bad)
03:18 sri well, tt is very slow ;p
03:19 sri it is pretty much a worst case for Mojo::DOM though
03:19 osfameron heh.  yeh, perhaps I should have checked Xslate...
03:19 osfameron but TT is Good Enough
03:20 osfameron and yeah, it's not really the use case for MD
03:20 sri Mojo::Template is pretty fast too
03:21 sri basically perl string concatenation, so it makes for a good baseline
03:21 osfameron sure.  I don't want that kind of templating though, so it doesn't particularly bother me if it's faster :D
03:22 osfameron MT is basically an Erb / Embperl like thing, afaict?
03:22 sri did you try with the dclone patch?
03:23 sri not quite erb (which is bad), more like erubis
03:23 osfameron oh?  it looks very similar to the (very little) erb I did
03:23 sri oh yea, from the looks sure
03:24 sri i meant regarding the implementation :)
03:24 osfameron oh, heh
03:24 sri erubis is what rails switched to from erb (both look the same)
03:24 osfameron anyway, I dislike that kind of templating language (Mason, erb(looking ;-) etc.) personally
03:24 osfameron ok
03:25 osfameron I'm going to attempt to sleep again... I'll try the dclone patch against benchmark tomorrow or later in week
03:25 osfameron (or later, if I fail to sleep)
03:25 sri i used to like tt, but with embedded perl you can do many cool things
03:26 osfameron I don't doubt it
03:26 osfameron I just don't want to maintain it :D
03:26 sri guess i'd be using xslate now
03:28 osfameron nn
03:28 sri i don't think this is harder to maintain than tt templates https://github.com/kraih/mojo-pg/blob/master/examples/blog/templates/layouts/blog.html.ep
03:29 sri nn
03:29 kaare joined #mojo
03:47 Kogurr joined #mojo
03:53 davido_ joined #mojo
04:39 irqq joined #mojo
05:02 good_news_everyon joined #mojo
05:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWwHy
05:02 good_news_everyon mojo/master 648eaa1 Sebastian Riedel: just use a relative backreference
05:02 good_news_everyon left #mojo
05:18 sri i bet there's a really cool trick to get rid of $ATTR_RE
05:18 sri inlining it somehow into $TOKEN_RE
05:19 sri we essentially match attributes twice, that shouldn't be necessary
05:21 sri basically we'd need a replacement for $ATTR_RE that matches key=value pairs and puts them in a data structure like [[key => value], ...]
05:22 sri the json regex might have everything needed http://www.perlmonks.org/?node_id=995856
05:22 sri wish my regex-fu was stronger
05:35 good_news_everyon joined #mojo
05:35 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWwdG
05:35 good_news_everyon mojo/master eb63731 Sebastian Riedel: fix typo in regex
05:35 good_news_everyon left #mojo
06:29 davido_ joined #mojo
06:36 trone joined #mojo
06:38 meshl joined #mojo
07:20 dod joined #mojo
07:21 CIAvash joined #mojo
07:21 McA joined #mojo
07:36 osfameron sri: I find the <% <%= <%== <%% distinctions tricky, and the continuous format tweaking of the % lines annoying.  But yes, for a small template that doesn't give in to temptation to chuck loads of Perl into it, that example looks fine
07:37 osfameron I've never seen e.g. HTML::Mason templates that didn't succumb to the latter though
07:37 osfameron anyway, templating systems are a religious preference basically :D
07:40 batman osfameron: is there a question to be answered..? (not sure what the agenda is)
07:40 batman sounds like you're putting too much logic in the template and too little in your controller
07:41 osfameron batman: sorry, sleep-interrupted conversation about templating preferences :-)  I don't really like the embedded perl style of Mason, Mojo::T etc.
07:42 batman osfameron: ok. there are other third party templating systems for mojo
07:44 osfameron sri: applying https://gist.github.com/anonymous/37bdd5888b4a9a91d5d0 my Mojo::DOM benchmark is *much* faster.  2/3 times I ran it it was 5-10* faster than TT!  (Other time just slightly slower)
07:44 osfameron sri: big +1 to apply that, if it doesn't break things for other people :D
07:44 osfameron batman: thanks :-)  I'm not actually using Mojo though, just Mojo::DOM - http://osfameron.github.io/pageboy/posts/2015/10/25/accidental-templating-system.html
07:45 osfameron & back to bed (sleep patterns gone a bit crazy over weekend)
07:46 batman aha.
07:47 batman osfameron: sorry for not paying attention. (my question to you was rather stupid)
07:49 Lee joined #mojo
07:54 sugar joined #mojo
08:12 eseyman joined #mojo
08:14 Vandal joined #mojo
08:23 trone joined #mojo
08:36 odc joined #mojo
08:42 huihui joined #mojo
08:46 dp_ joined #mojo
09:21 berov joined #mojo
09:33 dod joined #mojo
09:35 irqq joined #mojo
09:47 glauber joined #mojo
10:31 Zoffix joined #mojo
10:45 fvox joined #mojo
10:54 zelda joined #mojo
10:54 zelda Hi, Can I use $delay->wait inside a Mojo controller?
10:55 zelda I'm running concurrent HTTP-requests and I want to block till they are all finished
10:58 * pink_mist is unsure if you can ->wait in a controller, but you can do this kind of thing: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#Synchronizing-events
11:02 zelda I'll need to convert all my code to async if I want to use this
11:02 pink_mist this is true
11:02 zelda this sucks
11:02 zelda I want to block
11:03 pink_mist such is life when you can't do threading yet still want concurrency :/
11:03 zelda is it safe to use a different event-loop inside Mojo?
11:03 pink_mist should be doable ... I have no idea how safe it is
11:04 nic zelda: yes, you can use additional event loops, but it is very rare that you actually need/want to
11:04 pink_mist https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#Event-loops
11:05 nic zelda: look at the docn for ->wait, http://mojolicio.us/perldoc/Mojo::IOLoop::Delay#wait
11:05 nic it's a no-op if the (main) loop is already running
11:05 zelda yeah
11:05 nic but of course you can simulate blocking behaviour with v little effort/code
11:06 pink_mist nic: you can?
11:06 zelda how?
11:06 zelda like sleep()?
11:06 pink_mist no, never sleep in an async program :/
11:06 pink_mist that will literally stop execution of everything
11:06 nic look up examples of Mojo::IOLoop->delay
11:07 nic you can create a step for the async call and a subsequent step that handles the result
11:07 pink_mist that's what I already showed
11:08 pink_mist it was not feasible
11:08 nic feasible?
11:08 pink_mist doable? usable?
11:08 nic why is it not feasible?
11:08 pink_mist http://www.thefreedictionary.com/feasible
11:08 nic that won't tell me ;)
11:08 pink_mist ask zelda
11:09 nic I'm asking zelda
11:09 zelda if I use this 'step' approach, it will break my normal flow
11:09 nic define 'break'
11:09 zelda i'll have to use convert my sphagetti code to async
11:09 nic that is not my experience
11:10 zelda ok, maybe I'm missing something...
11:10 zelda I'll have a look again
11:12 nic post some code showing (a) the async call you want to make, and (b) what you need to do with the result
11:13 neilhwatson joined #mojo
11:14 zelda http://pastebin.com/EZP2mjKy
11:14 Repaster Repasted text from zelda: http://fpaste.org/283668/44585806/
11:15 nic When mojo's ua makes a 'blocking' call, this is just simulated on top of async code
11:15 nic zelda: "Do more stuff synchronously" should be bundled into a method/routine
11:15 zelda yeah, I still haven't figured how it is simulated
11:16 nic when the second step is called, it has the results for all the prior calls, and then it invokes the method I just mentioned
11:16 nic that's almost identical to the example in the docs
11:16 zelda so, I need to convert the final part to a callback
11:17 zelda like I said I don't want to convert to async code
11:17 nic the only fiddly bit is the bit you're not focusing on, handling any errors
11:17 nic I didn't mention no callback
11:18 zelda but if I wrap it up in a method, what will change?
11:18 nic part of the beauty and purpose of ->delay is to save you from (complex chains of) callbacks
11:18 zelda those 'steps' are nothing but callbacks
11:19 zelda imo
11:19 pink_mist but they're not /chains/ of callbacks
11:19 zelda right, not 'chains' or nested callbacks
11:19 zelda yet
11:20 zelda but this tends to become so quickly
11:20 zelda ok
11:20 nic It sounds like you're imagining problems before trying the paths that are laid before you
11:21 zelda what I learned is that I can not simply block inside a controller with ->wait
11:21 zelda and I have options: convert to async, or find a way how mojo emulates sync-requests in UserAgent and the same
11:21 zelda *do the same
11:22 zelda thanks everyone!
11:33 punter joined #mojo
11:44 Lee_ joined #mojo
12:01 asarch joined #mojo
12:25 ajr_ joined #mojo
12:36 hernan605 joined #mojo
12:38 espent joined #mojo
12:56 jberger I know zelda is off but, don't do the fake blocking thing
12:57 jberger Wrapping up existing code as steps is really not hard
12:57 Jonis block all the things
12:57 jberger Jonis all the things!
12:57 Jonis :D
12:58 Jonis hi :) how are you this fine day?
12:59 jberger Not too bad. It's Monday and I have some hope that the faxes hell of last week is over
12:59 jberger If I log in to my work box and see "hey can you look at the faxes?" Though, it might change very quickly :p
13:00 Jonis ;)
13:10 aborazmeh joined #mojo
13:20 gryphon joined #mojo
13:22 dod joined #mojo
13:26 dod joined #mojo
13:29 dod joined #mojo
13:45 jb360 joined #mojo
13:45 punter joined #mojo
13:51 PryMar56 joined #mojo
14:06 jberger for all the protestations of Mojo breaking things, I think the article about Dancer2::Plugin2 makes for a hilarious counterpoint
14:06 jberger ok so they don't "break" the old ones, but module authors all get to rewrite their plugins
14:11 omega https://metacpan.org/pod/Mojolicious#HOOKS it says they are called in the listed order, but then `around_dispatch` is in the end of the list, but it claims to be called right before `before_dispatch`. Could it be possible to visualize how the hooks interact somehow?
14:11 pink_mist jberger: link? =)
14:12 omega or maybe it is just `around_dispatch` that should be moved a bit furter up in the ordering?
14:12 nic pink_mist: perlweekly
14:12 pink_mist nic: that's not a link :/
14:12 jberger pink_mist: http://techblog.babyl.ca/entry/d2p2-call-to-plugin-authors
14:12 pink_mist thanks )=
14:12 pink_mist err thanks =)
14:13 pink_mist nic: I have no idea what 'perlweekly' is
14:13 * nic searches for the URL for letmegooglethatforyou
14:15 * Grinnz_ smacks Disqus and its "1 message" icon that tries to get you to sign up
14:17 pink_mist nic: the thing is that I'm not interested in finding out what perlweekly is. the only reason I mentioned that I had no idea was so you would understand why your non-link was utterly unhelpful.
14:17 pink_mist Grinnz: and then the message in question is "Welcome to Disqus!"?
14:18 nic pink_mist: I gave you the opportunity to learn, don't complain if you're too lazy to look yourself.  If you don't have internet, a URL isn't going to do you much good
14:19 Grinnz_ pink_mist: i dont even think there is one
14:20 pink_mist Grinnz_: 0_o
14:21 pink_mist nic: what's your problem? I don't care what perlweekly is. I asked for a link in the first place.
14:22 nic pink_mist: If you can't handle a piece of information, simply step over it and the world will keep turning.  Do not turn it into the most ridiculous of arguments
14:22 PopeF joined #mojo
14:24 pink_mist nic: you answering with passive-aggressive "let me find a letmegooglethatforyou url" was what I objected to. I had already moved on before you came with that reply.
14:26 * nic checks bookshelf for Open Aggression-free Mocking
14:36 good_news_everyon joined #mojo
14:36 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWoj5
14:36 good_news_everyon mojo/master 5a32e12 Sebastian Riedel: the around_dispatch hook gets emitted a little earlier
14:36 good_news_everyon left #mojo
14:38 sri nic: be nice
14:39 sri pink_mist: you too
14:51 jberger bpmedley: https://github.com/jberger/minion_ui
14:52 jberger that's your app, but with structure
14:53 jberger and a few minor modifications, taken from my Minion::Monitor
14:56 jberger Mac: you have an update
14:56 jberger Me: ok
14:57 jberger Mac: you just had an update to itunes and therefore need to sign the new EULA
14:57 jberger Me: ok
14:57 jberger Mac: click here to continue "start shopping"
14:57 Grinnz_ wat
14:58 jberger Me: really? I'm just tying to install the update that you won't let me ignore!
14:58 genio same thing happened to me this morning :)
14:58 jberger infuriating
14:58 genio and another oddity is that on reboot after update, it brings up a user prompt for "Setup User" that doesn't appear to exist.  I had to hard reboot for it to allow me back in after the update (well, everytime I update on this mac it does that)
14:59 bpmedley jberger : That's awesome!! It will take some time for me to look over.
15:03 sri my os x updates have been totally smooth recently
15:03 * sri shrugs
15:03 sri i don't actually use itunes though
15:05 bpmedley jberger : Oh wow, it works as a plugin.. :-0
15:06 jberger sri: neither do I, at least not intentionally
15:07 sri btw. i would still like to get rid of the second regex in Mojo::DOM::HTML https://github.com/kraih/mojo/blob/master/lib/Mojo/DOM/HTML.pm#L10-L21
15:07 sri we use it twice currently
15:07 sri once in the basic tokenizer, and then again to actually extract key=value pairs
15:08 sri attributes are parsed twice, there should be quite some room for optimizations
15:09 sri i need a version of $ATTR_RE that results in something like [[key => value], ...] in the match variable :)
15:10 sri and i imagine that embedding some perl in the regex would do the trick, like http://www.perlmonks.org/?node_id=995856
15:13 CIAvash joined #mojo
15:35 sri bummer
15:35 sri now i understand the json regex, and it's not as easy as i thought ;p
15:36 Grinnz_ regexes never are :P
15:37 sri it just abuses the fact that $^R is writable, to maintain a single data structure across all matches, and then assigns it to $_ so it can be accessed fro the outside
15:38 Ptolemarch joined #mojo
15:41 jberger yeah, we had a Chicago.pm talk about that one once
15:42 jberger doesn't seem like an extensible plan for general parsing
15:42 jberger at least not while maintaining one's own sanity
15:44 good_news_everyon joined #mojo
15:44 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWKg8
15:44 good_news_everyon mojo/master 350ee5b Sebastian Riedel: slightly more consistent formatting
15:44 good_news_everyon left #mojo
15:45 sri there has to be a way to not parse attributes twice, this really bugs me ;p
15:46 Grinnz_ i didn't know about this \g escape, that was in 5.10?
15:47 sri think so
15:47 Grinnz_ travis tests still pass anywya :P
15:57 jberger sri: the captures for the attribute are done either way
15:58 jberger so why not just unpack the matches at the top (with the other $N) and if you end up in the attributes section then you already have them
15:59 sri jberger: show me how :)
16:00 sri not much you can break btw. "prove -l t/mojo/dom.t" should have 100% coverage
16:06 jberger oh, I see a problem with that
16:06 jberger the attr regex is *+ and then you loop over it again later
16:08 jberger I wonder if that's better than simply calling a set of attr pairs as one token and removing the inner loop
16:08 jberger which would then allow what I was saying
16:09 sri if you want to benchmark multiple versions, i recommend the html5 spec as a test case :)
16:09 sri mojo get https://html.spec.whatwg.org > html5.html
16:09 sri perl -Mojo -E 'my $html = b("html5.html")->slurp->to_string; n { x($html) }'
16:10 sri 8.1mb of deeply nested html
16:10 sri takes 5s to parse here
16:12 sri these are the nytprof results btw. :) http://mojolicio.us/nytprof/index.html
16:16 Ptolemarch joined #mojo
16:42 HtbaaPi question: I'd like to use a different host for serving images. I can change that with url_for()->host('example.com')
16:43 HtbaaPi is it possible to define in my config file to use the current host?
16:43 HtbaaPi in dev environment I need it to be the default host, but in production I need to configure it
16:52 HtbaaPi hmm, it seems not defining it helps :)
17:24 kaare_ joined #mojo
17:26 meshl joined #mojo
17:28 good_news_everyon joined #mojo
17:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vW6mK
17:28 good_news_everyon mojo/master 8ea4618 Sebastian Riedel: fix a few typos
17:28 good_news_everyon left #mojo
17:40 sri not sure how to handle pull requests like this https://github.com/kraih/mojo/pull/858
17:41 sri it fixed a typo in one place, but ignored three others
17:41 sri guess me just voting -1 and fixing the typos myself could be considered rude
17:42 jberger you could merge it and fix the others
17:42 sri the punctuation changes are still up for discussion though
17:42 jberger perhaps not a great precedent, however it encourages contribution
17:42 * jberger looks
17:42 Grinnz i agree with the punctuation changes
17:43 sri i can see why many projects don't accept typo fixes as pull requests
17:43 sri this is frustrating
17:43 jberger http://english.stackexchange.com/questions/132359/any-exception-with-commas-before-and-after-for-example
17:44 odc quick question: how do you usually launch a minion worker in the background? with nohup?
17:44 jberger I wouldn't add the "to"
17:45 Grinnz the "to" isn't added, it's moved
17:46 jberger hmmm, I'm now thinking I don't like the example as an inset clause
17:47 jberger The example probably does best as its own sentence, and either merge the "sledgehammer" into the first sentence (not to be used lightly) or made its own third sentence.
17:48 Grinnz i think it's fine
17:48 ZoffixW joined #mojo
17:48 genio The grammar seems correct in the PR
17:48 Grinnz although that would work too
17:49 Grinnz This is a very powerful hook and should not be used lightly, consider it the sledgehammer in your toolbox. It allows you to, for example, customize application-wide exception handling.
17:49 genio comma to semicolon
17:50 Grinnz indeed
17:50 genio This is a very powerful hook and should not be used lightly; consider it the sledgehammer in your toolbox.
17:50 jberger but then with the reordering, you don't need the inset:
17:50 sri i guess when you're combining multiple changes in one pull request you should expect problems
17:50 ZoffixW The frustration comes from  there are many stylistic choices, all of which are valid :) And when someone proposes a PR, bikeshedding ensues. Maybe put a blurb in Contributing that word typos would be fixed, but corrections to punctuation nuances might be rejected without much explanation.
17:51 ZoffixW I mean.. it's just docs, not a book worthy of a Nobel.
17:51 jberger This is a very powerful hook and should not be used lightly; consider it the sledgehammer in your toolbox. For example, it allows you to customize application-wide exception handling.
17:51 Grinnz ehh
17:51 genio This is a very powerful hook and should not be used lightly; it's the sledgehammer in your toolbox.
17:51 bpmedley odc : I use upstart; however, that's just side-stepping your question.. :)
17:51 sri well, this is something for the native english speakers to settle
17:51 ZoffixW :)
17:51 bpmedley odc : Would you like an example upstart conf file?
17:51 Grinnz it's an example of what it allows specifically
17:52 jberger ZoffixW: this is actually rather common for us, which is also why we get a little touchy when people start yelling that the docs suck, we put this much care into it
17:52 sri it was easier in catalyst, where we had the editor of the oxford english dictionary fixing the docs ;p
17:52 jberger :o
17:52 odc bpmedley, heh thanks, but this is for Debian :)
17:52 jberger sri: who was that?!
17:52 sri jester where are you?!
17:53 bpmedley odc : I'd first try nohup.
17:53 ZoffixW :O
17:53 * jberger nominates that guy
17:53 sri http://www.jessesword.com/about.html
17:54 jberger maybe I'm being over-pedantic, the PR is fine
17:56 genio I agree that the PR is fine.  We can analyze it to death, but overall it's fine.
17:56 jberger I always argue with myself. I often write with complex structure, lots of inset clauses etc, and yet I value authors like Hemmingway who never need that stuff
17:57 ZoffixW How often do you guys use Mojo::Collection in your code? Like, why would you use it in place of plain Perl arrays with an occasional List::Util* thrown in?
17:57 Grinnz i generally don't unless generated by a Mojo module
17:57 sri ZoffixW: Mojo::DOM/Mojo::Pg
17:57 Grinnz like those
17:57 Grinnz :)
17:57 genio jberger: You have no idea how many circles I spun around in while trying to edit the IO::Socket::SSL docs. :)  I only made it half-way through before I had to just quit and submit the PR
17:57 ZoffixW Hm.
17:58 jberger ZoffixW: it makes for nice fluid chaining for interfaces that already use that
17:58 ZoffixW Alright. Thanks.
17:58 jberger if you aren't writing an otherwise fluid interface then you don't need it
17:58 sri jberger: haha, you said fluid too
17:58 jberger isn't that the name?
17:58 sri it's fluent interface
17:59 jberger argh!
17:59 ZoffixW :D
17:59 jberger its, ya know, flow -y
17:59 sri i keep saying it too
17:59 * jberger officially renames
18:00 jberger fluent doesn't mean anything anyway
18:00 Grinnz lol
18:00 Grinnz actually fluent has a different meaning
18:01 Grinnz fluent in a language
18:01 Grinnz meaning your proficiency at it
18:02 ZoffixW "spoken or written with ease"; I think that applies well to code with fluent interfaces being easy to write/read
18:02 sri i imagine fluid interface is some scifi-y bowl of water thingy you put your hands in to interact with a computer
18:02 ZoffixW :o
18:02 Grinnz hahah
18:03 dave it's actually from minecraft, it's a mod to applied energistics ;)
18:03 dave http://ftbwiki.org/ME_Fluid_Interface
18:04 dave in case you thought I wasn't being accurate :D
18:48 disputin joined #mojo
18:54 ajr_ joined #mojo
18:56 dod joined #mojo
19:08 trone joined #mojo
19:21 Ptolemarch joined #mojo
19:24 cstamas joined #mojo
19:42 dod joined #mojo
19:42 tchaves joined #mojo
19:43 meredith torque converters are a common fluid interface ;)
19:45 dod joined #mojo
19:47 hernan605 1
19:49 neilhwatson joined #mojo
19:52 asm35 joined #mojo
19:52 asm35 left #mojo
20:00 meshl joined #mojo
20:12 stephen joined #mojo
20:13 sri since there have been no more comments/pull requests https://github.com/kraih/mojo/pull/858#issuecomment-151266232
20:13 sri i just don't know what to do
20:15 genio sri: His suggested change on that sentence should likely be accepted; it reads more clearly.  If you want to look further into it later and clean it up more, this won't hinder that process.
20:25 lluad joined #mojo
20:36 bobkare joined #mojo
20:45 mishantil joined #mojo
20:50 irqq joined #mojo
20:52 punter joined #mojo
20:54 mishanti1 Lets say you have an action in a controller that needs to do a non-blocking call to another webservice, what is the best way to mock that during tests?
20:54 mishanti1 I want the test runs to _not_ call the external service, but rather simulate Mojo::UserAgent succeeding with dummy data, failing etc.
20:56 mishanti1 Have been using Test::MockModule for mocking other things, but if I mock Mojo::UserAgent->get() that messes up the tests, as Test::Mojo also uses the useragent.
20:56 espent joined #mojo
20:57 nic perhaps Mojo::UserAgent::Mockable  [I haven't tried it, but the author is around a lot]
20:58 nic PopeF: Does it sound like it matches?
20:58 PopeF hold on, let me read the scroll.
20:59 ilbot2 joined #mojo
20:59 Topic for #mojo is now 🍻 cheers | http://mojolicio.us | http://irclog.mojolicio.us | http://code-of-conduct.mojolicio.us
21:00 HtbaaPi aside from regular retry, does Minion have a retry all failed jobs as well?
21:02 nic I think that's just a one-liner
21:03 sri HtbaaPi: nope, i asked about it a few weeks back, but there was not much interest
21:04 mishanti1 PopeF: I see. So I would need to record various failure and success scenarios (eg. pulling the plug mid-tx), store those and then replay. Guess it is doable. :)
21:04 HtbaaPi sri: guess I wasn't in the chatroom then :p
21:05 mishanti1 Though I had hoped there was some way to trivially manipulate just the Mojo::UserAgent->get() that the controllers see.
21:05 PopeF mishanti1, That's what you'd need to do to use MUA::Mockable.
21:05 sri HtbaaPi: i would have liked automatic retry most at the time, with automatically increasing delays
21:05 PopeF But if you just want to manipulate get(), create a Mojolicious::Lite app and attach the UA.
21:06 PopeF $ua->server->app(MyTestApp::app). I think.
21:06 HtbaaPi sri: yeah that would be nice. But not applicable for every kind of background job
21:07 sri think my proposal was $minion->enqueue(foo => {retry => 5})
21:08 sri for 5 automatic retries with increasing intervals
21:08 bobkare mishanti1: We have an example at $work that does that (vinje mocks twilio)
21:08 mishanti1 bobkare: Thanks. Will have a looksee.
21:09 mishanti1 PopeF: Thank you for your suggestions. I think I'll have a good hard look at MUA::Mockable. It seems to be doing clever things that might be useful.
21:10 PopeF Thanks! And even if MUA::Mockable does'
21:10 PopeF doesn't do what you need, the tests might prove enlightening.
21:29 mib_m1unx7 joined #mojo
21:50 buu Why would I get a error => {                               'message' => 'Inactivity timeout' } ; from a Mojo::UserAgent post call?
21:52 buu Because I can't remember method params apparently
21:54 Zoffix buu, https://metacpan.org/pod/Mojo::UserAgent#inactivity_timeout
21:54 Zoffix :)
21:56 sri also http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#What-does-Inactivity-timeout-mean
21:58 buu In this case it means I need to type more random things as params
22:04 mishanti1 When writing a module with close ties to mojo is it preferred that those are put in MojoX::?
22:04 mishanti1 s/those/that/
22:04 mishanti1 And the grammar just broke. :)
22:05 Ptolemarch joined #mojo
22:05 mishanti1 But the question still stands. Is there some kind of convention documented somewhere? Have been looking but my google-fu did not give me any worthwhile pointers.
22:07 Grinnz_ mishanti1: usually just Mojo:: is fine. it depends on the module and how it relates
22:08 Grinnz_ mishanti1: the only reason to use MojoX:: is to avoid using the Mojo namespace for something that might be wanted in core Mojo someday
22:08 Grinnz_ otherwise, it looks better to use Mojo:: or Mojolicious::
22:10 mishanti1 Grinnz_: Thank you. If this module ends up as something to put on cpan I will consult you guys to see if the name needs changing.
22:47 Ptolemarch joined #mojo
23:06 disputin joined #mojo
23:41 Ptolemarch joined #mojo
23:49 mishanti1 Must be something I am missing from reading about the IOLoop, but how can I inside a script start a Mojo::Server::Daemon, perform some Mojo::UserAgent requests towards it, and have it stop after the requests are done?
23:50 mishanti1 I have confirmed that the daemon is listening and responding by doing a simple $daemon->run and pointing my browser at it.
23:50 mishanti1 What I am struggling with is returning control to the script so I can fire off some requests at it.
23:51 ajr_ joined #mojo
23:57 jb360 joined #mojo

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