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

IRC log for #mojo, 2016-01-29

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

All times shown according to UTC.

Time Nick Message
00:13 lluad joined #mojo
00:20 asarch joined #mojo
01:34 gtodd joined #mojo
01:47 gtodd1 joined #mojo
01:49 kaare joined #mojo
03:00 gtodd joined #mojo
03:37 noganex_ joined #mojo
04:19 binlei joined #mojo
04:35 mcsnolte joined #mojo
04:49 c--__ joined #mojo
05:51 inokenty-w joined #mojo
06:39 sugar joined #mojo
07:03 dod joined #mojo
07:08 dod joined #mojo
07:22 kes joined #mojo
07:22 kes Hi. may I catch all output from action?
07:28 kes seems this action should support partial rendering
07:58 batman kes: do you mean if you can see render() have created..?
07:59 batman kes: maybe this..? https://metacpan.org/pod/Mojolicious#after_render
08:00 kes do not understand your question. One action generates '1' other '2'. I want third action to include output from first and second: 'first: 1 second: 2'
08:00 kes for example
08:02 batman ok. then it wasn't what i linked to.
08:02 batman sounds very messy. can you come up with a real example (instead of 1, 2, ...) where this makes sense?
08:04 batman kes: maybe you can use layout or include in a template..?
08:05 kes there are controllers /accounts/index.html, /orders/index.html. I want in the controller for '/customer/index.html' route show those two tables
08:06 batman you might also want to look at https://metacpan.org/pod/Mojolicious::Controller#render_to_string https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Layouts and https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Include-templates
08:06 kes Yes, I may to include templates, but I do not understand how to run some initialization code which I need before rendering /accounts/index.html and /customers/index.html
08:07 kes I am going to try: sub index { ... return $self->render( @_ ? (partial => 1) : () ) }
08:07 batman what you can do is to factor out the "fetch data from backend" (the model) and then you call $c->stash(accounts => $c->some_model->get_accounts); and $c->stash(orders => $c->some_model->get_orders);
08:07 kes and just call Controller::Accounts::index( 1 ) from customer
08:07 batman and then you you include the two partial templates in the index.html.ep template
08:08 kes oh, render to string - interesting
08:08 batman i think i've sent you down the wrong path with render_to_string()
08:10 kes YOu are right. I should think about redesign and template includes
08:13 kes is it good idea to allow template fetch data itself?
08:13 batman not really.
08:13 Vandal joined #mojo
08:13 batman makes it harder to rewrite the app to be non-blocking later.
08:13 batman (can't do non-blocking inside a template)
08:13 kes ok
08:16 batman might sound like a lot of extra work, but i would encourage you to factor out all the get-stuff-from-database-or-whatever into MyApp::Model::Stuff
08:16 batman saves a lot of work when your app starts to grow.
08:17 kes yes, I understand
08:25 trone joined #mojo
08:51 vanHoesel joined #mojo
08:53 vanHoesel1 joined #mojo
09:15 denny joined #mojo
09:22 AndrewIsh joined #mojo
09:25 CHYC joined #mojo
09:52 cpan_mojo Swagger2-0.70 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.70
10:00 berov joined #mojo
10:11 dod joined #mojo
10:28 berov joined #mojo
10:42 dod joined #mojo
10:48 punter joined #mojo
11:05 jontaylor joined #mojo
11:10 Oleg joined #mojo
11:11 Oleg Can you remind me a name of the application which can run several mojolicious applications in one process to reduce memory usage?
11:18 kaare joined #mojo
11:24 go|dfish Oleg: Toadfarm?
11:25 Oleg May be. Thanks
11:25 sri it's a native feature http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Mount-applications
11:26 Oleg Cool. Will try, thanks
12:11 kes http://paste.scsys.co.uk/504903
12:11 kes How to distinguish hooks?
12:16 kes this is before_render hook and not before_include ((
12:27 batman kes: maybe you want $app->defaults(rows => []); ?
12:30 kes but in that case we first query DB for defaults than at action do second query
12:31 kes before_render is fit good, if there will no calls for 'include'
12:31 kes does the 'include'  like subrendering??
12:35 kes I may think wrong, but only one page is rendered so there should be one 'before_render' event, (except that cases I do multiple $self->render calls by hand)
12:56 asarch joined #mojo
13:11 batman kes: i wonder why you can't be more explicit and just make sure your action (controller method) adds $c->stash(rows => ...)
13:17 kes oh, sorry, I thought you mean: defaults( rows => scalar $c->_query_rows() ). In the app $rows are not required, only in template. So I check it  at before_render hook. If action does not require specific rows I do default query to DB through _query_rows.
13:18 kes so '$app->defaults(rows => [])' in my case will be useless. In any case thanks for suggestion
13:19 stuart joined #mojo
13:35 dod joined #mojo
13:53 neilhwatson joined #mojo
14:30 cpan_mojo Bootylicious-1.11 by OLEG https://metacpan.org/release/OLEG/Bootylicious-1.11
14:39 denny ... did I just read 'Now you can blog in POD format!'?
14:40 denny loldevs.
14:43 mcsnolte joined #mojo
14:45 * sri thinks about making a limited edition metacpan shirt https://i.imgur.com/0B87WMx.png
14:51 nic nice
15:18 sri and up :) https://shop.spreadshirt.com/kraih/
15:26 sri i still love that logo, no idea why it was so unpopular back then
15:31 berov left #mojo
15:46 vicash Hello. When using Minion as a plugin in Mojo, does the minion backend database use its own schema or does it pollute the public schema ?
15:47 vicash also, when setting explicit search_path([qw/myschema public/]) do I need to set the schema, if any, for the Minion backend in that call ?
15:50 Grinnz_ vicash: it creates tables starting with minion_ usually (it's up to the driver of course)
15:50 Grinnz_ some databases don't have "schemas"
15:53 vicash Grinnz_: ok that's cool then.
16:25 sri i don't think it should use a special schema hardcoded
16:26 sri it's much nicer when you can have a schema per test for concurrency https://github.com/kraih/minion/blob/master/t/pg.t#L16-L20
16:32 vicash sri: if i buy something on the spreadshirt site, does that money go towards mojo development ?
16:42 sri yes
16:44 sri actually towards hosting/domains first, then hours for me
16:48 sri every now and then someone also requests that i buy beer from the money, then i do that too :)
16:49 vicash cool !
17:14 cpan_mojo Bootylicious-1.12 by OLEG https://metacpan.org/release/OLEG/Bootylicious-1.12
17:38 punter joined #mojo
17:57 bwf Free shipping coupon:  https://www.spreadshirt.com/spreadshirt-coupons-C3627
17:59 sri for the next few days, neat
18:22 bowtie joined #mojo
18:26 pink_mist is that usable for the eu shop too?
18:27 sri yes
18:27 pink_mist seems like it should be, excellent =)
18:28 * sri just looked it up because he wants to get some of the updated shirts too :)
18:33 sri hmm, that metacpan logo would look badass on a knit cap
18:33 sri too bad winter is over
18:42 Kogurr joined #mojo
18:52 Trelane It's only January.
18:52 Trelane Also: Think global.  Sell to Oz.
19:06 ajr_ joined #mojo
19:19 PryMar56 joined #mojo
19:37 pink_mist Trelane: I think he meant for himself :P
19:44 sri yea :)
19:45 Trelane Go to Oz?
19:57 vicash i think underwear with mojolicious written on it would be a great sell
19:58 gtodd joined #mojo
20:20 gtodd1 joined #mojo
21:13 vicash when multiple jobs are sent to the same Minion::Worker, does the worker process those jobs  in the order it receives them such that each following job is executed only when the preceding job has completed ? Or does the worker start each job in parallel ? I am trying to figure out that if I have a 16-core machine to run jobs, do I run 16 workers with 1 job each or 1 worker with 16 jobs ?
21:26 sri parallel
21:27 sri http://mojolicious.org/perldoc/Minion/Command/minion/worker#SYNOPSIS
21:28 sri the topic actually came up earlier, when i mentioned that it's a commercial only feature in sidekiq
21:29 jberger funny that we added it mostly because it made init script easier ;-P
21:42 * sri thinks minion is underrated
22:13 cpan_mojo Task-BeLike-CSSON-0.0004 by CSSON https://metacpan.org/release/CSSON/Task-BeLike-CSSON-0.0004
22:18 marty joined #mojo
22:21 bpmedley joined #mojo
22:29 asarch joined #mojo
22:30 marty_ joined #mojo
22:32 trone joined #mojo
22:38 vicash sri: thanks. so 1 worker per system ! nice.
22:51 sugar_ joined #mojo
22:55 sugar__ joined #mojo

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