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

IRC log for #mojo, 2017-09-04

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

All times shown according to UTC.

Time Nick Message
00:28 mohawk joined #mojo
00:45 skippydippy joined #mojo
01:02 rabbit joined #mojo
01:06 rabbit Yesterday (actually, less than 24 hours ago), I asked about passing arguments from package TestApp::Controller::Service to package Mod::Service as can be seen by the following code snippet from preaction
01:07 rabbit http://mibpaste.com/8Ldpjs
01:08 rabbit Since I'm fairly new to OO (really, just a total beginner), I'm not sure how to properly pass object $c from TestApp::Controller::Service to Mod::Service, so that it is accessible inside of Mod::Service. What is the best way, and what is the way not to do it?
01:50 karjala_ joined #mojo
02:22 noganex joined #mojo
03:51 sivoais joined #mojo
04:04 dboehmer_ joined #mojo
04:48 gordonfish joined #mojo
04:56 itaipu joined #mojo
06:00 mib_10jocd joined #mojo
06:07 inokenty-w joined #mojo
06:33 prg joined #mojo
06:57 Vandal joined #mojo
07:08 AndrewIsh joined #mojo
07:21 trone joined #mojo
07:44 n16gel joined #mojo
08:00 jasanj left #mojo
08:08 bianca joined #mojo
08:19 karjala_ joined #mojo
08:23 rshadow joined #mojo
08:35 Dandre joined #mojo
11:16 tchaves joined #mojo
11:31 bianca joined #mojo
12:24 marcm joined #mojo
12:56 itaipu joined #mojo
13:06 dantti_laptop joined #mojo
13:09 tcohen joined #mojo
13:32 tchaves joined #mojo
13:33 foursixnine joined #mojo
13:35 mib_righel joined #mojo
13:39 itaipu joined #mojo
14:59 bianca joined #mojo
15:29 sri <3 minion foreground jobs
15:29 sri can't count the number of times i've used those anymore
15:30 coolo <not_saying slogan='told you so'/>
15:32 sri :p
15:43 bianca joined #mojo
15:50 jberger mohawk I did write Mojolicious::Plugin::Multiplex which might help
15:51 jberger For an example of a higher level tool
15:59 sri jberger: where do you define the channel on the server side?
16:00 sri seems missing from the synopsis
16:01 sri a Test::Mojo role for testing would be good too
16:01 sri otherwise i kinda like it
16:03 sri oh, is it missing channel dispatching?
16:03 sri would have expected the api to be the same as the browser api
16:04 sri that makes it really awkward
16:06 sri well, definitely a good start
16:25 rshadow joined #mojo
16:50 ChmEarl joined #mojo
17:56 bianca joined #mojo
18:04 rickbol joined #mojo
18:12 dod joined #mojo
18:50 rshadow joined #mojo
18:52 zivester joined #mojo
18:55 bianca joined #mojo
19:57 adv_ joined #mojo
19:58 adv_ i identified a bottleneck in my code where i'm using Mojo::DOM
19:58 adv_ $ancestors = $elem->ancestors('page')->first(); $id = $ancestors->attr('id');
19:58 adv_ it's those lines that i run inside a loop many times (think 100k)
19:58 adv_ is there an alternative way to do the same thing?
19:59 adv_ i'm parsing an xml file
20:03 adv_ https://gist.github.com/anonymous/db24fb923e8076f4a369
20:03 adv_ what is -Ilib?
20:13 marcus it adds 'lib' to the include path. Probably not relevant to your problem.
20:13 marcus if performance is critical, you should probably use a C-based xml-parser.
20:27 sri marcus: how does that help with waking the dom tree?
20:29 sri adv_: some things in Mojo::DOM are still unoptimized, maybe your case in among those
20:29 sri you could try optimizing the code in Mojo::DOM
20:32 sri grep { $_->tag eq 'page' } $elem->ancestors->each
20:32 sri that's prolly faster
20:38 adv_ sri: will try, thanks
20:39 adv_ sri: that outputs 1
20:42 Grinnz you need to use grep in list context to get the tag(s) that match
20:51 adv_ Grinnz: but this has different functionality
20:52 adv_ instead of looking up each element, you run grep and apply the corresponding number from a lookup table?
20:52 adv_ is that the logic
20:53 adv_ ?
20:53 Grinnz what?
20:53 adv_ i'm confused
20:53 adv_ right now i'm doing  $ancestors = $elem->ancestors('page')->first(); $id = $ancestors->attr('id'); $id += 0;
20:54 adv_ how can i get the same thing with the grep way?
20:58 adv_ Grinnz: ?
21:14 adv_ is using grep equivalent?
22:15 adv_ anyone?
22:20 pink_mist I'd suggest List::Util's first() instead of grep()
22:23 adv_ pink_mist: can you give an example?
22:25 pink_mist literally just swap 'grep' with 'first' in sri's example
22:26 pink_mist adv_: have you not read grep's and first's documentation?
22:26 pink_mist adv_: start by doing that.
22:26 pink_mist perldoc -f grep; perldoc List::Util
22:29 adv_ pink_mist: thanks
22:29 adv_ but as fast as the old way
22:46 pink_mist the ->ancestors call is probably the one that eats most of your time
22:47 pink_mist if you used Devel::NYTProf you'd get more info about that

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