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

IRC log for #mojo, 2015-11-10

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

All times shown according to UTC.

Time Nick Message
00:00 FatalNIX most of my projects do just fine with sqlite
00:06 Grinnz_ FatalNIX: it's actually glados
00:07 FatalNIX ?
00:07 FatalNIX don't get mados? get glados?
00:08 ZoffixMobile joined #mojo
00:10 genio you IRC from your mobile device?  that's gotta be hard to follow
00:10 ZoffixMobile FatalNIX, glados is a sadistic robot from Portal 2 that eventually end up being a chip powered by a potato
00:11 FatalNIX Ah. I only ever played portal 1
00:11 sri actually glados is more famous for portal 1
00:11 FatalNIX if only potatoes were lightweight, I could try powering a low power ARM with a potato on my quadcopter
00:11 ZoffixMobile genio, it's not that bad: i.imgur.com/Vl9TVw9.png
00:12 ZoffixMobile The only thing is I have to go landscape to get the tab button on my keyboard if I need to tabcomplete a nick :)
00:13 genio haha
00:13 FatalNIX which client is that?
00:13 ZoffixMobile AndroIRC
00:13 * FatalNIX uses holoirc, its the only one  that sucks but doesn't such too much
00:13 FatalNIX yeah I couldn't stand AndroIRC
00:13 ZoffixMobile And the keyboard is "Hacker's Keyboard"
00:13 Grinnz_ glados becomes the potato in portal 2
00:13 FatalNIX heh. I use google keyboard myself
00:13 Grinnz_ in portal one she is a hanging robot thingy
00:13 FatalNIX but I have "real keyboard" or whatever for ssh
00:17 Phil21 genio: weechat has some pretty amazing stuff too, a native android client that is very usable
00:17 Phil21 better (imo) than ssh'ing to screen
00:18 jberger FatalNIX: I read your S as sybase and almost lost it
00:18 FatalNIX there's a weechat android client? but is the weechat client for android still really anoying with the worst possible epileptic nick coloring scheme enabled by default?
00:18 FatalNIX LOL
00:19 ZoffixMobile Code your own client, in Perl!
00:19 FatalNIX I wrote my own MUD client in Perl a long time ago when I had a dinky iphone
00:19 FatalNIX for it
00:19 Phil21 FatalNIX: haha, the weechat client I use for android seems to match the ncurses client for colors
00:19 FatalNIX nothin better than MUDding on your phone on the road
00:19 Phil21 like I'm looking now, and #mojo is the same in tmux and on my phone
00:20 FatalNIX I was wondering how hard it would be the other day to run mojolicious on my android phone
00:20 FatalNIX or sensible
00:20 Phil21 hmm
00:21 Phil21 root it and it'd be trivial
00:21 jberger ZoffixMobile: I believe the word you are looking for is convos
00:21 ZoffixMobile jberger, convos? Never heard of her!
00:21 ZoffixMobile ^_^
00:21 Phil21 I have a bunch of older android devices I want to root and turn into little mini servers
00:21 Phil21 for some of my various sensor gathering projects
00:21 Phil21 perl would be a big part of that :)
00:22 FatalNIX heh.
00:24 FatalNIX A friend of mine just sits in a screen with irssi via connectbot on his phone in class.
00:24 Phil21 you laugh, but they make perfect little server devices :)  battery backup of half a day built-in, keyboard/monitor built-in for console debugging, etc. :)
00:24 Phil21 same reason an old laptop at home makes an awesome home router
00:24 FatalNIX yeah my Blu studio energy has a >5000mAh battery with a quad core
00:24 Phil21 nice
00:26 * jberger has an arduino that he doesn't use enough
00:26 FatalNIX its ridiculous because my laptop battery is 5000 mah
00:26 FatalNIX ...
00:26 FatalNIX my 6 cell at least
00:28 mattastrophe joined #mojo
00:32 AndroUser2 joined #mojo
00:35 Phil21 jberger: I'm honestly not sure if a phone would have enough CPU to do what I need to do though, still haven't gotten around to hacking on it
00:35 Phil21 I decode ADS-B, pulled off the air via cheapo USB DVB-D tv tuners
00:36 Phil21 seems to more or less max a core out on a 2-3 year old atom
00:36 Phil21 and I drop frames sometimes then
00:38 Akron joined #mojo
00:58 mattastrophe joined #mojo
01:42 bobkare joined #mojo
01:55 inokenty-w joined #mojo
02:48 Zoffix :S a rogue "use Mojolicious::Lite;" snuck into my full Mojolicious bin/script.... and I recopied possibly into a dozen apps :)
02:49 Zoffix This is from Sep 29. https://github.com/XTaTIK/XTaTIK/blob/master/bin/XTaTIK#L5  and I just noticed it in an app I started writing today :P
02:49 Grinnz hahaha
02:49 sri re glados https://www.youtube.com/watch?v=Y6ljFaKRTrI
02:49 sri \o\
02:49 sri /o/
02:50 Zoffix --o--
02:50 Zoffix sri++
02:53 kaare joined #mojo
03:15 Zoffix batman, is it not possible to use Mojolicious::Plugin::Bootstrap3 and pack up your own CSS/JS into the same assets as generated byt the ::Bootstrap3 plugin, so you end up with just 1 CSS and 1 JS file?
03:19 Zoffix Maybe I'm just too OCD about having very few files :/
03:39 Zoffix I guess I could build the two assets and then fetch the files and build another asset using those :P
03:39 Zoffix Yo Dawg
04:10 mattastrophe joined #mojo
04:33 val joined #mojo
04:46 val joined #mojo
04:47 irqq joined #mojo
05:17 val joined #mojo
05:22 melo joined #mojo
05:31 CIAvash joined #mojo
05:42 val joined #mojo
06:27 Vandal joined #mojo
06:49 absolut_todd joined #mojo
07:18 batman Zoffix: of course :)
07:18 batman That's what happens in production mode.
07:20 abra joined #mojo
07:26 val joined #mojo
08:02 kes joined #mojo
08:10 eseyman joined #mojo
08:23 AndrewIsh joined #mojo
08:24 osfabibisi joined #mojo
08:28 trone joined #mojo
08:30 shadowpaste "kes" at 217.168.150.38 pasted "endless loop when $c->continue" (9 lines) at http://paste.scsys.co.uk/501254
08:31 kes is it possible to run some sub after "Routing to controller ..." for all actions but before actions? (like under does, but with controller class of routed controller.)
08:32 kes *of routed path
08:35 berov joined #mojo
08:44 melo1 joined #mojo
08:51 batman kes: hook before_action => sub { my $c = shift; };
08:52 batman sorry. that was wrong.
08:53 batman https://metacpan.org/pod/Mojolicious#before_routes
09:01 kes batman: thank you. That is I look for. around_action works for me.
09:05 CandyAngel I keep putting bits of Mojolicious in my scripts. I have Mojoitis :(
09:08 stigo :D
09:08 CHYC joined #mojo
09:15 dod joined #mojo
09:18 kes :`-( I set default layout for application. But when in template I try to extend other template the 'layout' is not applied ((
09:20 shadowpaste "kes" at 217.168.150.38 pasted "layout is not applyed..." (6 lines) at http://paste.scsys.co.uk/501256
09:27 berov left #mojo
09:30 nic batman: Just thought of a use-case for mojo goodness via unix domain socket...
09:31 pink_mist kes: that snippet does not seem to have an error, so I can only conclude that the problem is in some place you're not showing us
09:31 nic for various 'systems' apps, they _must_ run local-only, and we need to run checks to ensure nobody mistakenly (or maliciously) opens them up to external ips
09:31 nic If it was socket-only, that would become much simpler
09:32 irqq joined #mojo
09:36 melo joined #mojo
09:40 jontaylor joined #mojo
09:40 kyshtynbai joined #mojo
09:47 berov joined #mojo
09:55 kes joined #mojo
09:56 kes pink_mist: https://yadi.sk/d/ayslMjoKkMS4D
09:56 kes this is full default application with this problem
09:58 kyshtynbai joined #mojo
09:59 dod joined #mojo
10:00 kes nic: may I ask you to look also: https://yadi.sk/d/ayslMjoKkMS4D?
10:01 nic kes: You've hit a known behaviour
10:02 nic extensions and default layout are not two features designed to be used together
10:02 nic You need to persuade sri of two valid use cases
10:04 kes oh. ok. Thank you
10:04 nic I think it would make a lot of sense to be able use both features, but the day I spent trying to persuade sri, my persuasion fu went all counter-productive
10:07 kes extends and layout seems not cross together... but now I understand why those does not work.
10:07 nic essentially you need clearer use cases than I presented here: https://gist.github.com/niczero/12e8e07bc0b231324716
10:10 nic and the discussions began at http://irclog.perlgeek.de/mojo/2014-06-16#i_8877223
10:15 nic Subsequent to that day, I discovered an addition which should be in that patch...  any template which does _not_ want to use a fall-thru layout should define "layout undef"
10:16 nic That applies to the exception built-in template for example, and generally any template that has "<html>" (and so adding a populated layout would give weird results)
10:16 kes but layout undef does not belong to extends in any way.
10:17 kes actually I do not see why your branch were stopped.
10:17 kes I have done same thing that you do. I can not imagine best example than you supply
10:17 nic kes: In the current behaviour, any defined layout (eg a default) is ignored if 'extends' is encountered
10:18 kes yeah... and this is a problem (((
10:18 nic So a template that does not want a layout currently works if 'extends' was encountered, but will go crazy if patched to allow defined layouts to keep working
10:19 kyshtynbai joined #mojo
10:19 kes do not understand what you mean (
10:20 ashimema joined #mojo
10:20 nic yeah, I can see myself why 'saying it how it is' is really not a helpful way of explaining
10:20 nic which is probably related to why the pr was rejected
10:21 rwp joined #mojo
10:21 kes these features: 'extends' and 'layout' do not relate to each other... What is the cause mojo undefine default layout?
10:21 nic Anyway, as far as I know, nobody else cares about this, so if you want to do anything about it you have a massive persuasion mountain to climb
10:23 nic The company that uses the patched behaviour relies on it a lot, and are happy to pay me to manage the upgrades
10:24 nic but I'd much rather that Mojolicious did it out the box
10:25 kes Ask sri this question: What is the cause mojo undefine default layout when we use 'extends'?
10:25 nic no thanks
10:26 nic I don't think you're understanding how to build a persuasive use-case
10:26 nic I've shown you my text which I thought was pretty ok, and we know it failed the task
10:26 nic so either you produce something better or you walk away
10:26 pink_mist huh, so his original paste /did/ show the problem ... I had no idea layouts and extends couldn't work together
10:27 pink_mist is this mentioned in the  docs somewhere?
10:27 nic read the irc log
10:28 pink_mist that's not docs
10:28 nic I can't think of anything which wasn't discussed, other than the addition I mention above (templates in the role of layouts)
10:28 kes stop. You did persuasive use-case to fix this issue. Let him do also persuasive example to not fix it.
10:28 nic pink_mist: the discussion about adding it to the docs is in the logs
10:28 pink_mist kes: it doesn't work that way
10:29 nic kes: this isn't a court of law.  that's not how open source development works.  How much are you paying sri to do your bidding?
10:30 kes just persuasive
10:31 punter joined #mojo
10:31 nic I've explained the situation, the history, and what you need to do to get what you want.  I'm done
10:32 kes nic: thank you. Very descriptive!
10:45 kes Is it possible to make options selected to check the option is equal_to some value?
10:45 kes *to check = by checking
10:57 sri https://lifeintheboomerlane.files.wordpress.com/2011/06/dogs_in_court.jpg
10:59 sri after a quick look, i woud still vote -1 on the doc patch alone
10:59 sri +l
10:59 sri layout has no place in the example introducing inheritance
11:03 nic tbh I don't think there's any point investing more energy into it till the next major version is near
11:03 nic it needs a major version, but doesn't merit one by itself
11:04 pink_mist sri: John Oliver on Last Week Tonight did a long segment with dogs representing the various members of the us supreme court :P
11:08 sri nic: so, if i understand this correctly, once you define a layout it is applied to every single template in the inheritance chain, over and over
11:09 sri it is never actually "consumed", like it would be now
11:10 sri which means that to stop the layout from bein applied every time, you need to include a "layout undef"
11:11 nic no
11:11 nic The layout gets applied at the end of the chain, when you run out of templates
11:11 nic (The only change in behaviour is if you have 'layout' and 'extends' both defined)
11:12 nic So if your final template actually acts as a layout, it currently works, but with the patch you would need 'layout undef' in the invocation (stash) or the final template itself
11:13 nic (or change it to a layout)
11:14 nic The setting of 'layout undef' only matters for those apps which use a default (or inherited) layout value, and I believe a lot of people don't do that
11:15 nic But the patch still benefits anyone who wants to render with 'layout' and 'template', where the template uses 'extends'
11:17 sri i don't think it does what you say it does
11:18 sri having applied the Mojolicious::Renderer patch, and running the layout tests, i see failures that don't seem to match the description in the current tests
11:20 sri specifically the /works?blue=1 test
11:21 nic hmm, I'm sure they all passed, back in June 2014
11:22 sri i've not applied your test changes
11:22 sri trying to figure out your intention
11:22 nic and the patch is being used by 60+ users every day in a reasonably hefty app
11:22 nic ah, I see
11:22 sri why is there no "...Blue..." in the result?
11:22 nic yes, some of the tests needed to be changed; hence my belief it needs a major version bump
11:23 nic At the time, my interpretation of your position was that the tests were testing behaviour that you (and others) didn't actually care about
11:24 nic and were undocumented
11:24 sri no point discussing an old discussion
11:24 sri you have a chance to make me understand now
11:24 nic hmm, I'm hugely busy this week
11:24 nic Any chance we can discuss next week?  You could point me how to make the pr have another chance
11:25 sri very unfortunate that you brought it up then :S
11:25 nic wasn't me
11:25 * nic points at kes
11:25 sri i do care right now... in a week... well you know
11:26 nic right, I'm here.  I'll have to bluff why I'm not ready for my meeting :)
11:27 nic In the current behaviour, if the renderer sees 'layout' and 'extends', it throws away 'layout'
11:27 nic my change just stops that, and retains 'layout' till the end of the chain
11:30 nic sri: What should I focus on right now?  Re-making the patch against the current codebase, then fixing the problems with the docn parts?
11:31 kes nic: How can I be usefull?
11:32 nic If I'm brutally honest, keeping quiet and not annoying sri would be of maximum benefit ;)
11:34 CandyAngel nic: Wait, we're not supposed to annoy sri?
11:34 CandyAngel WHoooooooooooops
11:35 nic yeah, keep your polynomial-up-the-wall curves under wraps for the next hour :)
11:35 CandyAngel Thats about how long I've been waiting for this system to export a 85MB file -.-
11:36 CandyAngel I have a top tip though. Mojo::Loader is *very* useful for shader files in little OpenGL tests :)
11:37 crab why is this layout undef thing needed? only because you've set layout in defaults?
11:37 nic or in the controller
11:38 nic When the renderer is working down the chain, if it's retaining a layout value it'll apply it at the end, but your final template may be acting like a layout
11:39 nic So when I'm patching for a new deployment, I add "layout undef" at the top of each built-in template that has a "<html>" line
11:41 nic If you don't want the defined layout to be used, you have to explicitly throw it away (under the new behaviour)
11:42 nic In practice it only happens if you hit an exception or not-found and the resulting template then wants to ignore any defined layout
11:43 nic at this site, that only happens in development, because our 'production' equivalents of the built-ins all honour whichever layout is in play
11:57 kes When I select text at debug.html.ep it is counted as 'tap' and is tapped/untapped ((
12:06 sri nic: ok, i think i get it now
12:06 sri and it does seem like a bug actually
12:07 sri so, the problem is that if your app has an app wide layout like app->defaults(layout => 'foo') any use of extends in a template will make it not work
12:08 sri when you called it dynamic_layout, that really tripped me off
12:08 sri s/off/up/
12:09 nic I think it also breaks if you ->render(layout => 'foo', template => 'bar') and bar.html.ep 'extends' something
12:10 sri i'd imagine so
12:10 nic ie whenever render has extends+layout
12:11 nic that's what 'dynamic layout' refers to; not relying on a "layout 'foo'" line hard-coded in your templates
12:11 neilhwatson joined #mojo
12:12 kyshtynbai joined #mojo
12:13 sri this line is just a bug in your patch right? "if exists $stash->{layout} && $stash->{layout};"
12:14 nic I guess I wanted to check it had a real value without autovivification
12:14 nic but I believe a less cautious approach works too
12:15 sri that's not how autovivification works though, or am i musunderstanding?
12:16 sri "if $stash->{foo}" doesn't create $stash->{foo}
12:16 nic oh, ok, it's a mistake
12:16 sri ok
12:16 nic I think it used to, but maybe in v old perls
12:21 nic yep, it doesn't in v5.10.1, which is what matters here
12:24 sri it did in 5.8? Oo
12:25 nic thanks for pointing that out; it's a relic I can remove from all my code now :D
12:25 * sri literally never encountered it
12:27 Lee it won't at the top level of the struct
12:29 sri or maybe it's not a bug
12:29 sri (layouts vs extends)
12:30 nic yeah, I 'learned' it in the Twentieth Century, and now I read docs (from 2003) it looks like I was mistaken in the case where it's not an lvalue
12:31 sri looking over how we want extends to be used, mixing layout with extends makes things very very complicated to explain
12:32 batman nic: yeah. +1
12:32 sri batman: on?
12:32 batman (on the socket comment)
12:32 sri oh
12:33 batman sorry. irc messed up since i've been without internet connection for a while :/
12:34 nic I don't disagree about "complicated"... this is the third day we've been discussing this point :)
12:35 nic Do the docs actually describe the distinction between layout and template, and how 'extends' is intended to be used?
12:35 sri it's much easier to explain if layout and extends are separate concepts
12:35 crab yeah
12:35 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Template-inheritance
12:35 nic I think everyone agrees they're separate concepts, which is why people are caught out when they can't be used together
12:35 crab it took me quite some time to understand what was going on here
12:35 sri skeleton templates
12:36 nic You can only use a layout at the end of the chain
12:36 sri when i say separate concepts, i mean exclusive, as in they can't be mixed
12:36 nic a layout can't have a layout
12:37 nic so "skeleton template" doesn't really hit the mark
12:37 sri ?
12:37 ajr_ joined #mojo
12:37 nic I use it as 'outermost template', the page scaffolding
12:37 nic the layer my complicated content templates don't want to think about
12:37 sri ok, lets take a step back
12:38 sri i can see where my argument from the last time was coming from again
12:38 sri your patch makes the inheritance section of the guide completely incomprehensible
12:38 sri what i wanted to see was a patch that makes it easier to grok
12:38 sri as extends is presented right now, it is clearly an alternative to layouts
12:38 nic you're talking about documentation rather than code here?
12:39 crab nic: yes
12:39 sri yes
12:39 nic I can fix documentation if the code has a chance
12:39 nic but that's a wasted investment if it has no chance again
12:40 sri it was about the documentation the whole time
12:40 nic I want to get to step #1: do you agree with the proposed behaviour?
12:40 nic step #2 is How should that be coded?
12:40 kaare joined #mojo
12:40 nic and step #3 is How shall we present that in documentation
12:41 sri the big question here is if you can explain it in a way that's easier to grok than having extends and layout be simple alternatives
12:41 sri i'll change the docs to make my point of view more clear
12:43 good_news_everyon joined #mojo
12:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8ixL
12:43 good_news_everyon mojo/master d6f6ecd Sebastian Riedel: mention that layouts and inheritance are alternatives
12:43 good_news_everyon left #mojo
12:43 sri so
12:43 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Template-inheritance
12:43 sri this recipe is what you have to beat with your version
12:44 good_news_everyon joined #mojo
12:44 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8ixy
12:44 good_news_everyon mojo/master 86e4438 Sebastian Riedel: just use two sentences
12:44 good_news_everyon left #mojo
12:44 sri it is entirely a documentation problem
12:45 nic I'm at a disadvantage here then, cos my way only pays dividends on larger apps (which is why nobody else complains about it)
12:45 nic and large examples don't fit
12:46 sri if your way cannot explained easily, perhaps it is not the right one after all
12:46 sri +be
12:47 nic My argument is that it's a more powerful templating system if layout is orthogonal to (inherited) templates
12:47 nic Have some logic that chooses the layout, but it doesn't break if you're using fancy template inheritance for, eg, the reporting side of your app
12:48 sri and my argument is that mixing the two doesn't actually work well
12:48 nic The logic for layout can look at device, or theme, or js framework, or whether the user is logged in or just a passer-by
12:48 sri due to how "content" (the main template content) works
12:49 nic and all of that is separate from the neat templates that construct tables based on resultsets
12:49 sri you talk abstract concepts again
12:50 sri that doesn't work for me
12:50 kes http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Template-inheritance > You can just add next: You can wrap inheritance result into layout. I think it will be clear enough
12:50 kes *you may
12:50 sri kes: i don't think you should join this discussion
12:51 kes I have rise it today...
12:51 kes ok. I will keep silent
12:53 nic template A produces html based on the cols in a table/resultset
12:54 nic template B handles what should be around that content: eg date-picker
12:54 nic but template B should not define the layout
12:54 nic s/layout/outermost layer/
12:59 sri this is the best recipe i could come up with that combines the two https://gist.github.com/anonymous/8096f421fe5870864746
13:00 sri oops, there's one extra "layout..." line
13:02 nic I find myself in a Catch-22
13:03 sri with typo fixed https://gist.github.com/anonymous/a76ffbb08b6b80b99aeb
13:03 nic Several times I've thought about largish blog posts or a book chapter going through how templating makes large sites easy
13:04 nic but there's no point if the features can't be used in core
13:04 nic and small examples really don't do it
13:04 CHYC nic: Please tell me to go away again if it's not helpful, but would layout accepting a coderef as its first arg help your usecase?
13:04 nic For me, layouts become much less useful if they're only ever hardcoded in templates; you may as well just ditch layouts and use another template
13:05 nic For me, layouts only have a point (and I think it's a good point) if they can be set independently (ie dynamically)
13:09 nic But if that example had the layout set somewhere in the controller, I think the reader could extend with their imagination
13:10 nic s/controller/anywhere outside the templates/
13:12 sri we've had more complicated examples before actually, and nobody could understand inheritance at all
13:12 nic I think that example is almost there
13:13 nic but how about a second route that overrides with "layout => 'mylayout2'" ?
13:13 sri too complicated
13:14 sri yea, i'm going to throw that at basically any new logic added ;p
13:14 nic :D
13:14 sri allright
13:15 sri lets put this into some context, so you know where i'm coming from
13:15 sri https://docs.djangoproject.com/en/1.7/topics/templates/#template-inheritance
13:15 sri this is where i got the concept from
13:17 nic Do they use 'layout' anywhere?
13:17 sri no
13:19 mattastrophe joined #mojo
13:19 nic Using 'layout' is very nice and I'm guessing lots of Mojolicious users appreciate having it
13:20 nic With current behaviour, I can use your example with ->render(layout => 'mylayout', template => 'first') and it works
13:21 nic It's only when I try to change 'first' to 'second' that it breaks
13:21 nic With any largish app there'll be parts that stay simple (layout + simple template)
13:22 nic and some parts where 'extends' starts to be useful
13:22 nic at that point you have a headache
13:23 nic Go and strip out all previous uses of 'layout' (which worked fine) or try to manage some pages using layout and some breaking if you do
13:23 sri lets put it to the test
13:23 sri here's an example based on your idea https://gist.github.com/anonymous/3ef6c8ef357a587a2bd0
13:23 sri who here undertsands what's going on?
13:24 * sri pokes jberger, marcusr, tempire, crab, Grinnz and batman
13:25 crab i do now
13:25 crab i like it
13:27 Zoffix left #mojo
13:27 sri guess there could also be a comment like "# third > second > first > mylayout"
13:28 sri to illustrate the chain
13:28 sri https://gist.github.com/anonymous/a1c4d4a698f5f3648483
13:30 sri or maybe it's just distracting
13:30 nic I like the comments
13:35 nic I think they're completely in keeping with examples in the rest of the docs
13:36 nic and we know some Core devs weren't aware of how the chain worked, making this clearer (while making it more powerful) seems like a big win
13:37 nic We might want a comment hinting that template inheritance is somewhat 'advanced' as a topic and you don't need to grok it while first learning Mojolicious
13:37 nic s/comment/sentence/
13:39 nic The learning might be slightly more involved, but the use in practice actually becomes simpler
13:40 Zoffix joined #mojo
13:40 nic eg If you only need one layout, define it once as an app default and then never think about it again while developing templates, even when you start to use template inheritance
13:41 Zoffix If I define my route as { $r->any('/dist/:dist')->to('root#dist')->name('dist'); } Is it sane to later do this:  { $_->{dist_url} = $self->url_for('dist') . $_->{name}; }
13:41 Zoffix The concatenation feels iffy
13:43 nic Zoffix: don't you want "$self->url_for('dist', dist => $name)"?  or maybe I'm misunderstanding what you're trying to do
13:43 Zoffix Oh.
13:43 Zoffix I guess I should actually read the docs for url_for ^_^
13:44 nic and if you use query params, don't forget url_with
13:44 gryphon joined #mojo
13:44 nic Zoffix: in return...
13:45 nic You have been out of the discussion.  Could you please look at https://gist.github.com/anonymous/a1c4d4a698f5f3648483 and tell us whether you can see what's going on
13:46 sri perhaps Zoffix could take a look at the inheritance recipe
13:46 sri i'm sure he doesn't know the concept yet
13:46 sri Zoffix: https://gist.github.com/anonymous/a1c4d4a698f5f3648483
13:46 sri oh
13:46 sri lol
13:46 nic :)
13:46 sri didn't see nic saying the same
13:47 Zoffix So you use `extends` and then you can redefine any of the blocks declared with `content`
13:47 Zoffix That's my interpretation of it
13:47 melo joined #mojo
13:47 nic the interplay with 'layout' -- does that make sense to you?
13:48 Zoffix ¯\_(ツ)_/¯
13:48 Zoffix content without args is something used by layout? :)
13:49 nic I'm guessing that it's so clear and easy that you're puzzled by what the question is :)
13:49 Zoffix Well, I see a layout used the way I always used it.
13:49 jberger That document looks clear to me
13:49 Zoffix So I'm unsure what "interplay" you mean.
13:49 Zoffix Yeah, looks clear to me too.
13:50 nic Zoffix: one possible future is that 'extends' and 'layout' are alternatives, never to be combined, so (part of) that example wouldn't work
13:50 nic another possible future is that you can use them together, and all of that example works
13:51 nic I want the power of being able to combine them, but nobody wants to lose beginners (or intermediates)
13:52 jberger So that I'm clear, the proposed documentation good along with the new feature
13:52 jberger And the current behavior is that if you use extends then the layout is ignored?
13:53 nic The documentation for the first scenario is trivial and sri has already committed it
13:53 nic jberger: yes
13:53 sri not really new feature, if we decide that's how it should be, then it would be a bug fix
13:53 Zoffix I think in my usecases, I'd want to have a layout with stuff that could be modified from within included template. Say, I have this layout: https://gist.github.com/zoffixznet/3c74a750189841b9f747, but I'd want that footer only on the home page. On sub pages, let the the page template figure out what it should be.
13:54 jberger The proposed new behavior is that layout is always the last thing in the chain, correct? That's the behavior I'd expect
13:54 Zoffix And well.. I can see that being solved by moving footer to templates
13:54 Zoffix ¯\_(ツ)_/¯
13:55 nic Zoffix: You can have that behaviour in layout too
13:55 Zoffix I don't have a dire need for extends(), so it's hard for me to imagine how it should work.
13:55 nic I've been using the second scenario for more than a year at a large site with multiple large apps
13:55 Zoffix And if it's already implemented, I never seen or used it :)
13:56 Zoffix Yeah, I haven't made anything large yet.
13:56 Zoffix Though I do have a 100,000 line app that I need to convert to Mojo some time in 2016 :P
13:56 Zoffix Ask me then :D
13:56 * Zoffix goes back to coding
13:57 coolo joined #mojo
13:59 jberger Personally, I've always used the layout system to handle my boilerplate outer code, and since I knew there was some trouble with it and extends ice never really used extends
13:59 jberger s/ice/I've/
13:59 CHYC joined #mojo
14:00 good_news_everyon joined #mojo
14:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8PoT
14:00 good_news_everyon mojo/master 069ac5b Sebastian Riedel: fix bug in Mojolicious::Renderer where layouts could not be used with template inheritance
14:00 good_news_everyon left #mojo
14:00 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Template-inheritance
14:00 sri the recipe also got moved into the advanced section
14:03 crab nic: run, run to your meeting 8-)
14:04 nic :D
14:05 nic AAAAWWEESSOOMMEENNEESSSSSSS
14:05 jberger nic++ sri++
14:05 batman sri: i understand now that i've been living in a template cave :(
14:05 batman count me out, since i need to learn and try this out.
14:05 jberger Of course now nic doesn't get paid to maintain his fork
14:05 * jberger starts up a charity collection for nic
14:06 nic Now I can blog about real-world templating
14:06 nic Mojolicious is supposed to be fun, and maintaining forks is not :)
14:07 jberger This concern comes up every so often, from other people as well
14:08 jberger We have slowly been stamping out issues where that happens and I think this could well be another such
14:48 jb360 joined #mojo
15:17 genio jberger: Did you ever write something up on testing with mock servers?
15:31 mattastrophe1 joined #mojo
15:32 jberger genio: no I haven't
15:32 jberger That would be a good topic
15:34 Grinnz sri, looks good to me, i was confused about inheritance as well..
15:36 genio jberger: I started an attempt, but I tend to get too long winded to be good at writing these things.  https://gist.github.com/genio/50e7ac4216fa90af88bf  over-explaining is a problem for me
15:38 mattastrophe joined #mojo
15:38 sri Grinnz: see #mojo-core
15:47 oalders i'm using the select_field tag helper to create a menu with a preselected value.  the value won't be in one of the params.
15:47 oalders what i'm doing seems very verbose: https://gist.githubusercontent.com/oalders/acea2428ec7b30379cff/raw/c78325a86aebfc88f927c34622b520645244cbce/gistfile1.txt
15:47 oalders is there a more succinct way to express this?
16:00 irqq joined #mojo
16:07 sri so, the generic way doesn't work? http://mojolicio.us/perldoc/Mojolicious/Plugin/TagHelpers#DESCRIPTION
16:08 sri "% param country => 'germany' unless param 'country';"
16:11 oalders sri: thanks. i missed that in the docs
16:14 sh4 joined #mojo
16:15 sri you're not the first
16:16 sri but i have no clue where else in the docs it should be mentioned
16:23 oalders i think it makes sense where it is. in my case i knew it could use default params but i was thinking i might need the same form embedded on the page multiple times.
16:24 oalders so i didn't think that made sense for me, but i also didn't think about setting params directly from the template
16:37 genio jberger: It's more complete with actual code now: https://gist.github.com/genio/50e7ac4216fa90af88bf  If you can take that and kind of adapt it (probably completely reword it) it might make for a decent blog post
16:48 cpan_mojo Mojo-UserAgent-Mockable-1.03 by POPEFELIX https://metacpan.org/release/POPEFELIX/Mojo-UserAgent-Mockable-1.03
16:51 PryMar56 joined #mojo
16:55 kes What is the order of calling 'content blabla => begin ...' blocks or they are called in not predictable order?
16:55 kes when do include or extends in templates
17:02 batman is it possible to change a route once it's added? like $r = $app->router->get("/foo"); # can i change that to "/bar" with the $r object or does it contain internal state that can't be changed?
17:04 Trelane wouldn't that be a really bad idea if you ever had more than one webserver?
17:05 batman i want to change the /perldoc route for PODRenderer plugin :)
17:05 batman i guess i will remove the route and then add a new one with the same defaults...
17:05 * batman tries
17:06 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Rearranging-routes
17:08 batman sorry. i don't want to re-arrange. i want to rename the /path/part
17:08 batman s/sorry/sorry i don't get it/
17:20 batman didn't know you had done some changes to the PODRenderer design sri :)
17:20 batman looks good
17:21 batman $r->get('/doc/:module')->to(%{$self->plugin('PODRenderer')->to}, module => 'Convos'); # seems to work
17:22 batman oh. that doesn't help much. nevermind :)
17:28 good_news_everyon joined #mojo
17:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v81s2
17:28 good_news_everyon mojo/master af7493f Sebastian Riedel: mention how to change the route pattern
17:28 good_news_everyon left #mojo
17:29 sri batman: that should help
17:37 disputin joined #mojo
17:42 batman sri: ok. so parse() will "rebuild" the route's internal state?
17:55 trone joined #mojo
18:16 dod joined #mojo
18:34 shadowpaste "kes" at 217.168.150.38 pasted "the error messages about unknown method does not belong to place of call" (29 lines) at http://paste.scsys.co.uk/501262
18:55 mattastrophe joined #mojo
19:00 good_news_everyon joined #mojo
19:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v81h6
19:00 good_news_everyon mojo/master 2cff7b2 Sebastian Riedel: more obvious order of precedence
19:00 good_news_everyon left #mojo
19:29 hernan605 joined #mojo
19:31 Akron joined #mojo
19:42 melo joined #mojo
19:45 hernan605 joined #mojo
21:18 bpmedley_ joined #mojo
21:41 disputin joined #mojo
21:44 nicomen is there a good way to start up a minion server as part of a web app?
21:45 preaction bsd daemontools perhaps?
21:54 jberger nicomen: I usually just make a startup script
22:11 nicomen jberger: for each of them?
22:14 jberger how many minion processes do you need?
22:14 jberger the -j option is your friend (usually)
22:21 meredith i've used https://metacpan.org/release/Proclet as an entry point for similar sorta deals
22:27 ajr_ joined #mojo
22:52 disputin joined #mojo
23:05 nic joined #mojo
23:05 nicomen jberger: I wanted a job server to be started whenever I start my app, I wonder if I can fork something in MyApp.pm or if it can even run in the same event loop as a server
23:08 batman perl question: anyone got a prettier way of writing this? $foo ? unshift @list, 42 : push @list, 42;
23:08 batman oh. i guess i can use splice
23:22 disputin joined #mojo
23:37 disputin joined #mojo
23:40 nicomen batman: I know an uglier way ;D
23:40 nicomen $ perl -wle 'my ($foo, @a) = (int(rand(2)),(9,8,7)); @a = ($foo && 42 || (), @a, !$foo && 42); print "@a";'
23:40 nicomen 42 9 8 7
23:44 nicomen actually that is not even correct
23:46 disputin1 joined #mojo

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