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

IRC log for #mojo, 2016-04-14

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

All times shown according to UTC.

Time Nick Message
00:48 Adura joined #mojo
01:05 woz joined #mojo
02:42 noganex_ joined #mojo
02:55 * sri wonders if he should try kerbal space program
03:05 iamb i'd say absolutely yes...i haven't played since before 1.0 but it's ridiculously fun to get into, and great mods if you get bored of the vanilla game
03:06 * iamb was last doing some crazy mission programming with all the realism mods and kaos
03:06 iamb kos? whatever it is :D
03:07 woz joined #mojo
04:27 melo joined #mojo
04:41 Kripton joined #mojo
04:51 jacoby joined #mojo
04:53 absolut_todd joined #mojo
05:09 Guest-guest joined #mojo
05:09 woz joined #mojo
05:19 inokenty-w joined #mojo
06:02 woz joined #mojo
06:13 McA joined #mojo
06:41 Atog joined #mojo
06:42 salva joined #mojo
06:58 bjakubski joined #mojo
07:04 AndrewIsh joined #mojo
07:08 firnsy joined #mojo
07:12 marcus I found it really hard. Guess I'm not a rocket engineer. :)
07:17 memowe joined #mojo
07:24 berov joined #mojo
07:29 trone joined #mojo
07:30 jasanj batman: https://metacpan.org/pod/Mojo::IOLoop::ReadWriteFork#close
07:30 batman jasanj: you don't have to tell me. i made the module :P
07:30 jasanj is this $self->on(close => sub { my($self, $exit_value, $signal) = @_; }); ?
07:31 batman indeed it is. will fix the typo
07:31 jasanj did this mean we can emit from child, and action on parent ?
07:32 batman no. the RWF will emit that event for you. the way you emit it from the child is by exiting the child process
07:33 batman you can't do $self->emit() from the child and see that in the parent.
07:36 Adura joined #mojo
07:36 Vandal joined #mojo
07:36 jasanj i want emit signal from child, which like https://metacpan.org/pod/AnyEvent::Fork::RPC#Example-2:-Asynchronous-Backend do, look at the __DATA__ section, there's AnyEvent::Fork::RPC::event "count $n of $count\n"; which emit a event from child to parent
07:37 jasanj can RWF do this ?
07:38 batman can't you just do print "count $n of $count\n" in the child and read that from on(read => ...) ?
07:40 jasanj this print will be capture and not print to screen ?
07:40 batman jasanj: https://metacpan.org/pod/Mojo::IOLoop::ReadWriteFork#read
07:47 woz joined #mojo
07:51 osfabibisi joined #mojo
07:54 annaken morning all... I'm new to mojolicious and currently grappling with timers and events
07:54 annaken is it possible to do renders within timers?
07:55 annaken I have to start a long-running process (takes minutes) and I want to check on it every 10s and render a new page to the user showing progress
07:55 batman annaken: i think this is what you want: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#Timers
07:56 cpan_mojo Mojo-IOLoop-ReadWriteFork-0.18 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.18
07:56 batman jasanj: maybe the new documentation makes more sense: https://metacpan.org/pod/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.18/lib/Mojo/IOLoop/ReadWriteFork.pm#SYNOPSIS
07:57 batman jberger: 0.18 ^^^ also has a "SEE ALSO Mojo::IOLoop::ForkCall :)
07:58 annaken batman: those examples seem to still only output at the very end of the timer
07:58 annaken rather than at regular intervals while it is running
07:59 batman did you see the recurring() timer? maybe i don't understand what you want.
07:59 annaken yeah I just tried it out
07:59 batman anyway, i have a meeting to attend. hope you figured it out
07:59 annaken it writes out once, at the end
07:59 annaken rather than once per loop
08:00 jasanj batman: thanks, and still one problem for me, RWF fork and exec external executable, my situation is fork to run a perl function, like native fork in perl, like M:I:ForkCall
08:00 batman yeah, that also works.
08:01 batman jasanj: just do $fork->run(sub { .... });
08:02 batman i see that it's not documented :(
08:03 jasanj batman: woo, that's cool !
08:04 jasanj and i think this shoud be document, better
08:10 Kripton joined #mojo
08:12 woz joined #mojo
08:26 woz joined #mojo
08:50 jasanj joined #mojo
09:09 meshl joined #mojo
09:15 jasanj batman: https://gist.github.com/tadegenban/9029ab8ffcb47079ead5df4630749956
09:16 jasanj the fork watcher will gone if the $fork variable out of scope ?
09:16 trone joined #mojo
09:16 jasanj this gist will not work
09:20 ribasushi joined #mojo
09:20 batman jasanj: yes. you need to keep the $fork around
09:20 woz joined #mojo
09:21 jasanj batman: got it
09:31 bjakubski joined #mojo
09:44 da5id joined #mojo
09:50 melo joined #mojo
09:52 cpan_mojo Mojolicious-Plugin-RoutesAuthDBI-0.400 by MCHE https://metacpan.org/release/MCHE/Mojolicious-Plugin-RoutesAuthDBI-0.400
09:52 Bender HATPIPE!
09:56 cpan_mojo Mojo-IOLoop-ReadWriteFork-0.19 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.19
09:57 batman jasanj: care to review the new doc? https://metacpan.org/pod/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.19/lib/Mojo/IOLoop/ReadWriteFork.pm
10:14 daxim left #mojo
10:48 kaare joined #mojo
10:59 kaare joined #mojo
11:08 tchaves joined #mojo
11:17 woz joined #mojo
11:25 woz joined #mojo
11:29 woz joined #mojo
11:31 punter joined #mojo
12:00 woz joined #mojo
12:20 bpmedley joined #mojo
12:20 jberger Is it time to kick Bender?
12:21 jberger We have chanserv now
12:22 jberger batman: thanks for the link, i probably should link back to yours
12:22 jberger Maybe I'll 1.0 it too
12:22 jberger I suspect it's my most used module at this point
12:26 woz joined #mojo
12:31 dod joined #mojo
12:33 woz joined #mojo
12:48 woz joined #mojo
12:48 dod joined #mojo
12:56 kes joined #mojo
12:56 kes Hi. that is broken module?
12:56 kes Error:  Undefined subroutine &Mojo::Transaction::WebSocket::DEBUG called at
12:56 kes MojoX/Transaction/WebSocket76.pm
12:57 kes line 11
12:57 kes what to use instead of Mojo::Transaction::WebSocket::DEBUG now?
12:59 memowe joined #mojo
13:00 memowe_ joined #mojo
13:01 memowe joined #mojo
13:02 memowe_ joined #mojo
13:03 batman kes: I don't think we've ever documented constants, so i'm not sure if that's safe to use
13:03 memowe joined #mojo
13:03 batman but you could look at Mojo::WebSocket
13:03 kes found patch: https://github.com/dionys/mojox-transaction-websocket76/pull/12
13:03 kes will test now
13:04 kes and related: https://github.com/dionys/mojox-transaction-websocket76/issues/3
13:04 memowe joined #mojo
13:05 memowe_ joined #mojo
13:06 memowe joined #mojo
13:07 memowe_ joined #mojo
13:08 memowe joined #mojo
13:08 memowe_ joined #mojo
13:09 woz joined #mojo
13:09 memowe joined #mojo
13:10 memowe_ joined #mojo
13:11 memowe joined #mojo
13:12 memowe_ joined #mojo
13:13 memowe joined #mojo
13:13 geheimnis` joined #mojo
13:14 memowe joined #mojo
13:15 memowe_ joined #mojo
13:16 memowe joined #mojo
13:16 memowe_ joined #mojo
13:17 memowe joined #mojo
13:18 memowe_ joined #mojo
13:19 memowe joined #mojo
13:19 ramortegui joined #mojo
13:20 kes that patch work fine
13:20 kes that patch works fine
13:20 memowe joined #mojo
13:21 memowe_ joined #mojo
13:22 memowe joined #mojo
13:23 memowe_ joined #mojo
13:24 memowe joined #mojo
13:24 memowe_ joined #mojo
13:25 memowe joined #mojo
13:26 memowe_ joined #mojo
13:27 memowe joined #mojo
13:29 kes (( Can't locate object method "load" via package "Mojo::Loader"
13:29 memowe joined #mojo
13:29 kes seems belongs to: Removed deprecated object-oriented Mojo::Loader API.
13:30 memowe_ joined #mojo
13:31 memowe joined #mojo
13:32 memowe_ joined #mojo
13:33 memowe joined #mojo
13:33 memowe_ joined #mojo
13:34 memowe joined #mojo
13:35 memowe joined #mojo
13:36 memowe_ joined #mojo
13:37 cpan_mojo Mojolicious-Plugin-RoutesAuthDBI-0.401 by MCHE https://metacpan.org/release/MCHE/Mojolicious-Plugin-RoutesAuthDBI-0.401
13:37 Bender Yo kids!
13:37 memowe joined #mojo
13:38 memowe_ joined #mojo
13:39 memowe joined #mojo
13:39 batman jberger: yeah, that would be nice with a link. i think most of the times your module fixes what my module doesn't and the other way around.
13:39 batman depends on the problem
13:39 woz joined #mojo
13:39 batman and... i don't mind silencing Bender. not sure how much use the outbursts are
13:40 memowe joined #mojo
13:41 memowe_ joined #mojo
13:41 memowe joined #mojo
13:42 memowe_ joined #mojo
13:43 memowe joined #mojo
13:43 punter joined #mojo
13:44 memowe_ joined #mojo
13:45 memowe joined #mojo
13:46 memowe_ joined #mojo
13:47 memowe joined #mojo
13:48 memowe_ joined #mojo
13:49 memowe joined #mojo
13:50 memowe_ joined #mojo
13:50 memowe joined #mojo
13:51 memowe_ joined #mojo
13:52 memowe joined #mojo
13:53 memowe_ joined #mojo
13:54 memowe joined #mojo
13:55 memowe_ joined #mojo
13:56 memowe joined #mojo
13:56 jberger Hunh i didn't know that someone was maintaining a hixie76 ws class
13:56 jberger I wonder why?
13:57 jberger batman: i agree they are good compliments for each other
13:57 memowe joined #mojo
13:57 pink_mist gah, memowe reconnecting 3 times each minute is driving me bonkers =(
13:57 batman <3
13:57 genio kick him/her until they're less bouncy, please
13:58 memowe joined #mojo
13:58 jberger memowe: your client is broken
13:58 memowe_ joined #mojo
13:59 memowe joined #mojo
14:00 jberger http://www.nntp.perl.org/group/perl.perl5.porters/2016/04/msg235825.html
14:00 memowe joined #mojo
14:01 memowe_ joined #mojo
14:02 memowe joined #mojo
14:02 memowe joined #mojo
14:03 memowe No, it's my connection. Sorry.
14:09 irqq joined #mojo
14:14 woz joined #mojo
14:17 mcsnolte joined #mojo
14:23 Lee not sure why anyone would want to store routes in the db?
14:23 Lee brittle, obsfucated, hard to test? no thanks
14:25 kaare_ joined #mojo
14:33 woz joined #mojo
14:49 woz joined #mojo
14:49 batman Lee: sounds like an idea @work: provide authorisation by storing the path part in a database and see if it matches the incoming request...
14:49 jberger sounds to me like an attempt at a CMS
14:50 jberger but really then you don't have routes in the common sense of the word
14:50 batman sounds awful.
14:55 Lee don't think it's a CMS, as the module just seems to create the routes at startup
14:56 meshl joined #mojo
14:56 gryphon joined #mojo
14:56 jberger Lee: oh I didn't know you were talking about a concrete example
14:56 jberger oh you mean Ado?
14:57 batman OMG! it looks like what my coworkers want to do.
14:57 jberger I haven't looked at it much
14:57 batman i'm _not_ telling them about it :(
14:57 Lee jberger: no, https://metacpan.org/pod/Mojolicious::Plugin::RoutesAuthDBI
14:57 * Bender topples down the mountain
14:57 jberger ah
14:58 jberger does bender just say odd stuff when someone links to metacpan?
14:58 Lee Bender: boo
14:58 Lee Bender: boo?
14:58 gryphon Test https://metacpan.org/pod/Mojolicious::Plugin::RoutesAuthDBI01
14:58 Bender AT HUD!
14:58 jberger https://metacpan.org/pod/Tie::Array::CSV
14:58 batman jberger: Bender sometimes also say weird stuff when the channels has been idle for a while
14:59 Bender was kicked by jberger: Bender
14:59 jnbek lol
14:59 dod joined #mojo
14:59 jberger I don't know how to kick somone in convos :s
15:00 batman jberger: tried /kick ...?
15:00 pink_mist jberger: fwiw I think it's specifically when someone links to M::P::RoutesAuthDBI ... most other links he doesn't say anything
15:00 jberger did it work?
15:00 Lee yes
15:01 jberger cool
15:01 Lee darn, can't test what in "RoutesAuthDBI" was causing the response :p
15:01 PryMar56 joined #mojo
15:01 jberger Bender used to be necesary for op keeping
15:01 jberger but the channel is registered now
15:22 asarch joined #mojo
15:25 woz joined #mojo
15:36 woz joined #mojo
15:51 dod joined #mojo
15:52 dod joined #mojo
16:36 Kripton joined #mojo
16:38 woz joined #mojo
16:56 McA2 joined #mojo
17:20 woz joined #mojo
17:55 batman jasanj: did you look over the new RWF doc?
17:55 irqq joined #mojo
17:57 dantti_laptop jberger: took a read on you blogs, very informative, on part2 I think, I was why can't ->wait just check the even itself, then part 3 fixed that :P shame the Brazil event was 3 years ago, or I could try to go :P
17:58 jberger dantti_laptop: yeah, those posts are starting to show their age too
17:58 jberger brazil was a lot of fun, but it might have been better now
17:59 dantti_laptop that's the problem posts vs wiki
17:59 jberger I wasn't a big enough draw as a scientist, maybe now as Mojo core team ...
18:01 jberger that was also the first year that YAPC::Brazil wasn't in Rio or Sao Paulo
18:01 dantti_laptop sure, but I'm impressed that a relative new project has some many people hanging around in irc, #cutelyst on freenode is completely dead :(
18:01 jberger they needed a name to get people to come to Curitiba
18:01 dantti_laptop ah ok, then that would be more complicated, things are too distant here
18:02 dantti_laptop I wish our country was like eu that has trains all over :)
18:02 jberger the US isn't much better
18:02 dantti_laptop yup, but at least in US flights are much cheaper
18:02 jberger apart from the east coast things are increadibly far apart
18:02 jberger hmmm perhaps
18:03 jberger I'd love to come back
18:03 dantti_laptop the air trafic here compared to EU or US looks like some one is playing with RCs
18:03 jberger my visa was good for 10 years I think :-P
18:05 dantti_laptop Still some quite some years I don't attend to an OS event, the big ones are in Curitiba, and atm I can't leave the Country
18:05 dantti_laptop I live in Sao Paulo for the record
18:06 jberger I thought the biggest things were in Sao Paulo and Rio?
18:06 jberger has it moved south?
18:06 jberger I thought just that one YAPC::Brasil was there
18:06 dantti_laptop well FISL which is the biggest is there
18:06 dantti_laptop some of Pg cons are in Campinas which is 100km from Sao Paulo
18:06 jberger Curitiba was very nice, I changed planes in Sao Paulo but I didn't get out to see the town
18:07 dvinciguerra joined #mojo
18:09 dantti_laptop Sao Paulo is quite big, but it's good to have someone to go with you unless you know where you are going or speak portuguese
18:10 dantti_laptop as most people barely speak portugues themselfs :P
18:13 sri jberger: i was so looking forward to seeing you complain about the Mojo::Pg expand code ;p
18:13 jberger sri ?
18:14 sri when you start with the boolean feature
18:14 jberger hehe
18:14 jberger I actually might have time to look at it today
18:14 jberger Chicago.pm social meeting
18:14 sri it's really weird code
18:14 * jberger takes a peek
18:14 sri but efficient
18:15 sri super hard to extend without making it a lot slower
18:16 jberger yeah, that's gonna take some mental deparsing
18:16 sri hahaha
18:17 jberger where does $self->{idx} come from?
18:17 jberger oh is that caching for repeated calls?
18:18 sri yes
18:18 sri most annoying part is how it needs to handle hashes and arrays
18:19 jberger but it only kinda caches
18:19 sri $results->hash; $results->array; $results->hash; is totally valid
18:19 jberger ah
18:19 jberger yeah
18:26 dantti_laptop oh, btw why do you call ->begin? shouldn't it be called continue or finish? to say the current event finished?
18:27 jberger dantti_laptop: this is very predictable, you are at the "why is it called begin" stage :-P
18:28 jberger I don't know how many people have tried to come up with a better name for it
18:28 jberger I personally am pretty sure that begin is the right name
18:30 dantti_laptop hehe
18:30 Kripton joined #mojo
18:30 dantti_laptop like begin next event
18:31 dantti_laptop but imo sounds like that's the begin, imho continue would probably cause less confusion
18:35 Grinnz_ I am pretty sure begin is the wrong name, but haven't come up with a better one
18:36 Grinnz_ I think the trouble is ->begin does two distinct things
18:36 Grinnz_ it indicates there's an additional event to wait for, and returns the callback for that event to indicate completion
18:38 Grinnz_ it's sort of the logical equivalent of creating a Future and simultaneously having a parent Future wait on it (akin to the delay object)
18:50 dantti_laptop well naming things is hard...
19:07 meshl joined #mojo
19:45 tchaves joined #mojo
19:54 jacoby joined #mojo
20:05 trone joined #mojo
20:18 Kripton joined #mojo
20:42 hrupp joined #mojo
20:43 hrupp hi o/
20:43 hrupp batman: hi
20:44 hrupp batman: https://github.com/jhthorsen/mojo-server-tcp/pulls
20:44 hrupp please have a look
20:44 batman hrupp: you actually use that code?
20:44 hrupp yes
20:45 hrupp in production
20:45 batman even if it's not on cpan?
20:45 hrupp yes
20:45 hrupp works well for me
20:45 batman wow
20:46 batman hrupp: i've added you as collaborator now, so you can push directly if you like.
20:47 hrupp hui
20:47 hrupp thanks
20:47 batman thank you :)
20:48 hrupp i use it in devops environment
20:48 hrupp for remote object execution
20:49 hrupp in a huge cloud
20:49 batman pretty cool. do you want it on cpan again?
20:49 batman i can't remember why i removed it...
20:50 meshl joined #mojo
20:51 hrupp yes, cpan would be great
20:52 batman hrupp: can you open an issue? i need to have look to see if can remember why i removed it :/
20:53 hrupp I'am going to do so
20:55 batman thank you. i will try to look at it sometime this weekend.
20:56 hrupp batman: https://github.com/jhthorsen/mojo-server-tcp/issues/3
20:58 batman right. i get email notifications :-)
21:04 sri oh noes, i totally missed that rjbs is stepping down as pumpking
21:05 sri any word on who takes over?
21:07 jberger not so far
21:08 genio Where was that announced?
21:08 jberger genio: I linked to the mailinglist earlier
21:08 genio oh
21:08 jberger http://www.nntp.perl.org/group/perl.perl5.porters/2016/04/msg235825.html
21:09 jberger I would volunteer if it meant I could actually make a case for strictperl
21:10 jberger but then again, I don't even read the mojolicious mailing list, how would I ever keep up with p5p
21:10 jberger I pop onto the google groups for mojolicious and read it every now and again
21:11 sri i often disagreed with rjbs, but a lot of good things happened during his reign
21:11 jberger and civility was a priority
21:11 jberger as hard as that is
21:11 sri wonder if the next pumpking will be technical
21:12 jberger was rjbs pumkping for the feature pragma or was that jesse?
21:12 jberger rjbs helped to firm up the meaning of experimental
21:12 jberger that might be his legacy
21:12 sri jesse i think
21:12 sri i liked when rjbs wrote the signature spec
21:12 sri that's what i was always hoping a non-technical pumpking would do
21:13 jberger feature and experimental are what keep perl progress possible in the world of "ultimate backwards compatiblity" that most of p5p craves
21:13 sri collect information, write up specs
21:23 PryMar56 joined #mojo
21:30 melo joined #mojo
21:32 dvinciguerra joined #mojo
21:47 sri hmm, everybody seems to recommend the game factorio
22:03 dvinciguerra_ joined #mojo
22:16 woz joined #mojo
22:22 new_student joined #mojo
22:22 new_student So, I have a rather silly question
22:23 new_student Does Mojo::Lite use any event loop by default
22:23 new_student s/default/on it's own
22:24 sri it's the server that uses the event loop, not the framework itself
22:24 new_student so, if I use Mojo::IOLoop
22:24 new_student along with Mojo::Lite
22:24 new_student I'll have two event loops?
22:25 sri no, the web server you deploy your app with will run the event loop
22:25 pink_mist also, no such thing as Mojo::Lite
22:25 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#DEPLOYMENT
22:27 new_student So, umm... here is where my confusion lies. If I have a app which does: use Mojolicious::Lite; and also does use Mojo::IOLoop; Then why is Mojo::IOLoop->is_running; before and after app->start always empty/
22:29 sri you mean false, not empty?
22:29 new_student yes, false
22:29 new_student like, Dumper will always give me $VAR1 = '';
22:29 sri because the event loop is not yet running, or already done
22:30 sri app->start can start the web server/event loop and run forever
22:31 sri or just return the app, and some outside code runs the web server/event loop afterwards
22:32 * new_student bangs his head on the wall. ofc the loop is not running and already finished.
22:32 * new_student feels so stupid
22:32 sri :)
22:48 dvinciguerra joined #mojo
23:03 Grinnz_ it helps to visualize that the event loop is only ever running inside a ->start or ->one_tick call, somewhere
23:06 new_student Alright, I have another stupid query. Whats wrong with this small sioppet: http://paste.fedoraproject.org/355715/67515814
23:06 new_student s/sioppet/snippet
23:07 bpmedley new_student: What are the goals for your script?
23:08 new_student I just want to call some service running on port :3000 and return. Since I want it to be non blocking, I want to use Mojo::IOLoop
23:08 new_student but umm... how do I make it return?
23:09 mattp_ make it return? what do you mean?
23:11 new_student Maybe I put it wrong words. Starting from beginning. I want to write a small script, which does a lot of stuff, and in between calls a service on :3000, read some data off it, and get me that data. Now, since I want to make this non-blocking, I want to use Mojo::IOLoop. How would I use it?
23:11 bpmedley new_student: What do you wanna do after the client call?
23:13 mattp_ new_student: Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
23:13 mattp_ or AE::CV->recv; are common event loop idioms to enter the loop and never return
23:13 mattp_ for when youre running a server and stuff like that
23:14 new_student okay, adding more info. I have a Mojolicious::Lite app, which has a route: /dostuff This route does this: A(), B(), ... , N() . Now, a few of these calls are blocking, since they contact some service and then return. The problem arises because this keeps the worker stuck here. And now I want to make it non blocking, so that the worker is not stuck here.
23:15 bpmedley new_student: Possibly use Delay?
23:15 new_student how does delay help me
23:15 mattp_ to answer your question, since mojo does not use condvars, you would want to call Mojo::IOLoop->stop
23:16 bpmedley new_student: Depends on how they block.. is a system() call, or some perl code, or ?.  I would really need code for clarity..
23:16 mattp_ new_student: call ->stop from the callback when you have fully read the data you are looking for from the service. that said, there is Mojo::UserAgent with this stuff built in if its just a web request you are trying to do
23:16 new_student bpmedley: I use IO::Socket::INET See. https://github.com/ltrc/ilparser-api/blob/master/lib/common/parser.pm#L43
23:17 bpmedley new_student: Cool, would you consider a smallish Lite app for debugging?
23:18 bpmedley debugging --> understanding
23:18 new_student No, I meant to ask you to look at only that call_daemon sub
23:18 new_student or maybe I didn't understand your question
23:19 new_student Or were you asking me to come up with a small Lite app to simulate the same thing?
23:21 mattp_ new_student: IOLoop->stop from your callback is the answer to your question
23:21 new_student mattp_: but won't that stop the Lite app itself? :-o
23:22 mattp_ new_student: youre doing the request from within a mojo::lite app? yes, it will. what are you trying to achieve?
23:22 pink_mist probably. what did yo uexpect?
23:22 new_student I already mentioned what I want when I said "okay, adding more info. I have a Mo..."
23:23 bpmedley new_student: A smallish Lite app that shows the details.
23:23 new_student okay, let me come up with it
23:23 mattp_ you "want it to return". calling IOLoop->stop will make your ->start on line 20 return
23:24 new_student mattp_: ignore the words that I used in the question which I asked before.
23:24 pink_mist maybe you should restate your problem accurately and concisely
23:24 new_student I already did :(
23:25 pink_mist then why is mattp_ confused?
23:25 new_student I don't know.
23:25 new_student My problem is stated completely where I say "I have a Mojolicious::Lite ...  which has a route: /dostuff ..."
23:26 pink_mist oh, that question
23:26 pink_mist I thought I answered that yesterday in #perl
23:26 new_student I just want to know how to achieve that.
23:26 pink_mist Mojo::IOLoop::Client
23:26 new_student Exactly.
23:27 new_student Now I am more confused
23:27 new_student Since there is no way to return from the Client, without stopping the loop
23:27 pink_mist wat
23:27 mattp_ new_student: when you return from a callback the worker/loop will keep running
23:27 mattp_ what you need to do is in your Nth callback, write and close your transaction/response
23:28 new_student I didn't understand
23:29 bpmedley new_student: Do you want a smallish Lite app that initiates a TCP connection via a route and does not block?
23:29 new_student yeah, in some sense
23:29 new_student s/a/many
23:29 bpmedley One sec
23:29 new_student s/a TCP connection/many TCP connections
23:29 mattp_ new_student: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#REAL-TIME-WEB take a look through these examples
23:30 mattp_ "Synchronizing non-blocking operations
23:30 mattp_ in particular
23:30 new_student if you are asking me to use ua, then I can't use that
23:31 mattp_ UserAgent is built ontop of reactor. its the same thing underneath
23:32 new_student What's the point of using $c->delay in that example?
23:33 pink_mist the point is that $c->delay() sets up some things so it works properly under a route
23:33 mattp_ new_student: it is somewhat oddly named. it is used for chaining asynchronous things sequentially
23:33 sri delays are just syntax sugar
23:34 sri for the record, i do not understand the problem stated by new_student either
23:34 new_student I think bpmedley understood it
23:35 bpmedley Only somewhat.  I don't know what you want to send over the wire, what you want back; and what do when you get the data.
23:35 jberger new_student: you can't return from nonblocking code
23:35 mattp_ sri: i think hes just doing multiple TCP requests asynchronously from a route, possibly concurrently
23:36 jberger You pass in a subroutine reference which gets called on completing
23:36 sri this might help http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-is-the-difference-between-blocking-and-non-blocking-operations
23:37 sri you don't start/stop the event loop
23:37 sri it's just there, doing it's thing, ready to use
23:41 sri you know, i wouldn't mind adding a Mojo::IOLoop->client example to the cookbook, but i can't really think of a good use case
23:41 sri what arbitrary tcp services are there on the web that you might want to pipe raw through to the browser?
23:42 sri (and that are not to complicated for a small example)
23:42 pink_mist finger?
23:42 new_student okay, let me restate my problem again. /dosomestuff does this: A()->B()->C()->D()->E() , which means, the return value from A() goes to B() which goes to C() and so on. The sequence is pre-defined using an array of subs/name of subs.  The problem is, C() and E(), send some stuff over the wire, receive the stuff and return it. So, what happens is, the worker performing /dostuff doesn't do anything while C
23:42 new_student () or E() are waiting, whereas it could either serve some different route /dosomeotherstuff , or serve some another request to /dostuff and process upto A()->B()
23:43 sri simple, you can't return
23:43 new_student I can't return?
23:43 sri you can't
23:43 sri that's the nature of async
23:43 new_student umm.. from where
23:44 new_student so there is no solution, is that what you are saying?
23:44 sri no, i'm saying your mindset is wrong
23:45 sri you want to block and wait for a return value, but that's just not how it works
23:45 sri once you get continuation-passing style it will make sense
23:46 new_student okay, agreed. How do I redesign my app to achieve what I want
23:47 new_student Earlier, I had this: /A was a route for A(), /B was a route for B() and so on. And there was another client which would call each of these routes and aggregate the result.
23:47 new_student That scaled nicely.
23:48 bpmedley new_student: After E(), what do you desire as a goal?
23:49 new_student Whatever be the output of E(), it should go to the next sub in the pre-defined sequence. If it is the last, then the output from E() should go be rendered
23:49 new_student s/go be/be
23:49 mattp_ new_student: take a look at https://metacpan.org/pod/Mojo::IOLoop::Delay
23:49 bpmedley Sounds like you need an understanding of delays..
23:50 new_student Now, I want to remove the aggregator, and have the entire thing in perl
23:50 sri mattp_: i don't see how delays make understanding the concept easier
23:50 sri if anything, they add more complexity at this point
23:52 new_student sri: I sort of understood the concept which you were trying to tell me when you said "you can't return"
23:52 bpmedley new_student: Do you want the output of the Client connection to the browser?
23:52 new_student umm.. there is no browser so far
23:53 new_student I am using it as an API server
23:53 pink_mist if it's talking HTTP it's a browser.
23:54 Grinnz_ well, more generically, HTTP client
23:54 bpmedley So, do you want to return any information the the UserAgent?
23:54 pink_mist no need to split hairs about that.
23:54 Grinnz_ just to avoid the confusion :P
23:54 new_student Yes, the output from the last module in the suequence goes back to the HTTP Client
23:59 new_student bpmedley: why did you ask that?
23:59 bpmedley new_student: Moment

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