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

IRC log for #mojo, 2014-09-17

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

All times shown according to UTC.

Time Nick Message
00:04 woz joined #mojo
00:18 sri it's rather hard to make an example that looks nice and shows a lot of features at the same time
00:35 woz joined #mojo
00:38 hesperaux joined #mojo
00:50 Averna joined #mojo
01:13 woz joined #mojo
01:27 disputin joined #mojo
01:31 dexteruk_ joined #mojo
01:43 jberger It is cool, but i would still like a traditional app example with template
01:47 jberger It doesn't have to be huge
01:47 tempire for the first page?
01:47 jberger Sure, have both (or really all three)
01:47 * tempire sets jberger on fire
01:47 tempire I think I'm going to incorporate "tempire"
01:49 tempire http://38.media.tumblr.com/394a68ed5c0e92acaa8ce90ecec8aba8/tumblr_n949hvWaks1rmfml5o4_250.gif
01:49 preaction joined #mojo
02:13 woz joined #mojo
02:26 firnsy joined #mojo
02:46 noganex_ joined #mojo
02:57 * jberger hums "everything is awesome" as he burns
02:57 preaction everything is cool when you're part of a team!
02:58 * jberger his preaction, setting him on fire in the process
02:58 preaction yay!
02:58 jberger Damn! Hugs! Not his. Stupid phone
02:59 preaction i thought it was hits, so even more yay!
02:59 preaction a hunka-hunka burning hugs!
03:00 jberger Ah thank ya verra much
03:13 woz joined #mojo
03:29 doublelel joined #mojo
03:37 doublelel joined #mojo
04:05 doublelel joined #mojo
04:13 woz joined #mojo
04:18 irq joined #mojo
04:36 doublelel joined #mojo
04:58 jamesaxl joined #mojo
05:06 axlrose joined #mojo
05:10 doublelel joined #mojo
05:13 woz joined #mojo
05:16 tianon sri: still loving the tree at http://mojolicio.us/perldoc#REFERENCE <3
05:38 mr-foobar joined #mojo
05:41 mr-fooba_ joined #mojo
05:44 marcus sri++
05:49 ver joined #mojo
05:49 doublelel joined #mojo
06:05 doublelel joined #mojo
06:07 d4rkie joined #mojo
06:13 woz joined #mojo
06:13 dod joined #mojo
06:23 doublelel joined #mojo
06:42 KCL joined #mojo
06:52 dp_ joined #mojo
06:58 basiliscos joined #mojo
07:08 rawler joined #mojo
07:09 Vandal joined #mojo
07:10 trone joined #mojo
07:13 woz joined #mojo
07:18 BinGOs joined #mojo
07:22 woz joined #mojo
07:59 dotan joined #mojo
08:11 irq joined #mojo
08:15 trone joined #mojo
08:16 kedare left #mojo
08:32 edestler joined #mojo
08:51 doublelel joined #mojo
08:54 aleksey joined #mojo
08:54 denis_boyun joined #mojo
08:57 trone joined #mojo
09:05 d4rkie joined #mojo
09:11 mr-foobar joined #mojo
09:11 doublelel joined #mojo
09:11 dod1 joined #mojo
09:13 fhelmber_ joined #mojo
09:19 dod joined #mojo
09:38 denis_boyun joined #mojo
10:23 doublelel joined #mojo
10:59 sri yay
11:06 sri jberger: i don't think the example should be much bigger
11:06 sri and the template part is already covered
11:07 basiliscos joined #mojo
11:08 sri i think the only features previously shown that are no longer present are a) an http method other than get, and b) $c->param(...)
11:08 sri and a is problematic, since it usually means the app doesn't "just work"
11:16 mgrimes In an ep template, is there a way to import a block definition from another file? I want to share it b/w templates.
11:27 neilhwatson joined #mojo
11:36 jberger mgrimes: are you ready to level up? Template blocks are just anonymous subs which return Mojo::ByteStream objects
11:36 jberger ... And so are many of the helpers, especially the tag helpers
11:38 jberger Plugins can even have their own templates that they render_to_string
11:41 jberger mgrimes: see my Humane plugin for example, https://github.com/jberger/Mojolicious-Plugin-Humane/blob/master/lib/Mojolicious/Plugin/Humane.pm#L73
11:41 doublelel joined #mojo
11:59 d4rkie joined #mojo
11:59 cpan_mojo Mojo-IOLoop-ForkCall 0.15 by Joel Berger - http://metacpan.org/release/JBERGER/Mojo-IOLoop-ForkCall-0.15
11:59 mgrimes jberger: thanks for the example. I guess I want to create a helper that is basically `include` but accepts arguements.
12:00 jberger mgrimes: yes indeed
12:00 good_news_everyon joined #mojo
12:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/cnlAPA
12:00 good_news_everyon mojo/master 3b5c433 Sebastian Riedel: use a more standard route name in README example
12:00 good_news_everyon left #mojo
12:01 jberger although, include is just another name for render_to_string if you are already requiring Mojolicious 5.0, but since my plugin does not, I just have that note there
12:02 jberger once something else requires that I go over the 5.0 barrier I will change that usage
12:04 trone joined #mojo
12:18 mgrimes jberger: right. Of course what I really need to do is really embrace tag helpers and write my on for all the site's components.
12:21 lipizzan joined #mojo
12:28 good_news_everyon joined #mojo
12:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/H4Va-w
12:28 good_news_everyon mojo/master d510283 Sebastian Riedel: index sounds better than root
12:28 good_news_everyon left #mojo
12:40 markov joined #mojo
12:40 markov greetz
12:41 sri o/
12:42 markov I have a question.  This works (without check for authorization)    $r->route('/user')->to('user#update');
12:42 markov But this does not: my $a = $r->bridge->to('auth#check'); $a->route('/user')->to('user#update')
12:43 markov where ::Auth::check() returns 1
12:44 markov The log now says: "Nothing has been rendered, expecting delayed response."
12:45 mgrimes jberger: well that was easy... turns out `include 'tmplt', value => $value` already passes the value on the stash. nice.
12:45 sri markov: that sounds like the exact scenario the growing guide deals with http://mojolicio.us/perldoc/Mojolicious/Guides/Growing
12:47 markov sri: That's exact the scenario I have attempted to follow.  And seen in many examples.  But it just does not work for me.
12:47 sri there is clearly information missing here
12:48 sri that log message alone tells me that more stuff is working than you might expect, and it might just be a render call you forgot
12:48 sri like, you're not mentioning the log messages showing where it is routing to
12:49 markov I do trace the calls to ::User::update()  : it does not get called at all.
12:49 marty o/
12:49 sri or other routes that might have a higher precedence
12:49 markov Without bridge, it gets called.  With it, it does not.
12:49 sri anyway, information is missing
12:50 marty markov: I see no route to your bridge.   Maybe this.... $a = $r->bridge('/user')->to('auth#check'); $a->route('/')->to('user#update')
12:50 sri marty: a '/' is always implied
12:51 * marty learned something new today.
12:51 sri of course i agree that a bare ->bridge-> is ugly, but not necessary
12:51 markov ... and I already tried that as well.
12:51 sri make a nopaste with more information
12:52 markov The bridge is beging called.  So there goes the preference idea, I think.
12:52 sri then it's clear, your bridge returns undef and you're not rendering anything
12:53 sri s/undef/false/
12:53 markov My bridge return 1
12:53 sri obviously not :)
12:54 sri if you make a nopaste with the log i could tell you definitively
12:58 markov The bridge function ::Auth::check() is now:    sub check() { shift->log('checking'); return 1 }    I think it return 1
12:58 markov (running latest versions of everything)
13:00 markov probably some very stupid mistake of me, but I am our of ideas
13:04 markov marty: bridge('/user')    route('/')  doesn't change the behavior.      bridge('/user')   route('/user')   brings the browser to  /user/user
13:05 markov Maybe it helps to know that I get into /user via a redirect_to from /logon
13:07 marty markov: without a nopaste of your log there is no way to help
13:07 marty but I can guarantee you that bridges work flawlessly.  I use at least 20 in my app
13:08 markov marty: was planning to produce a nopaste, but have no idea what to include in it.
13:10 dexteruk joined #mojo
13:17 markov http://nopaste.linux-dev.org/?253636
13:18 markov (showing the full routing table)
13:19 dotan_ joined #mojo
13:33 TitanOfOld joined #mojo
13:43 noganex_ mh... damnit. if i change $0 to something nonexistent Mojo::Home causes the whole app to die, because it uses FindBin and FindBin dies in BEGIN unless -f $0 :(
13:45 peco joined #mojo
13:45 ignacio_ joined #mojo
13:47 peco_ joined #mojo
13:55 steven joined #mojo
14:09 mst joined #mojo
14:13 ignacio_ joined #mojo
14:19 lb joined #mojo
14:25 markov marty: saw nopaste?
14:26 nicomen noganex_: don't do that then?
14:26 markov sri: where in ::Match is the to() destination evaluated into a bool?
14:26 noganex_ nicomen: i'm not changing it in my code. it's something in a lib i have to use... :(
14:27 nicomen oh
14:27 nicomen re-add it in your BEGIN?
14:27 lipizzan joined #mojo
14:28 sh4 joined #mojo
14:28 noganex_ looking at FindBin i wonder if it really makes sense to die in a BEGIN block... :/
14:40 mst joined #mojo
14:54 mr-foobar joined #mojo
15:02 marty markov:  sorry, I had to take care of an emergency.  let me look at your paste
15:05 thomasoniii joined #mojo
15:07 marty markkov:  hard to tell from your paste.   My guess would be a namespace issue.   but that is just a guess.
15:09 marty whatever it is, your sub is not returning 1 or not being called correctly.
15:10 thomasoniii It looks like if I use $route->render('', {format => 'html'}) on a route that has children, I'll end up with a / before the .html. Ideally, I'd like to omit it, since it looks a little clunky.
15:10 thomasoniii i.e., have it generate /schools.html instead of /schools/.html
15:10 thomasoniii Is this by design? Or indicative of me misconfiguring something?
15:12 thomasoniii Wait, I'm not quite clear - it's actually generating on a child route that matches '/'.
15:12 thomasoniii my $parent = $r->route('/schools');
15:12 thomasoniii my $child = $parent->get('/');
15:12 thomasoniii $child->render('', {format => 'html'}); # gives me /schools/.html
15:12 thomasoniii I've tried various '/', '', etc params on the child route, but haven't hit on a magic permutation that'd work. :-/
15:16 marty thomasoniii: that syntax looks strange.  Did you find that in the documentation?
15:17 thomasoniii http://mojolicio.us/perldoc/Mojolicious/Routes/Route#render
15:17 disputin joined #mojo
15:17 thomasoniii not appending a suffix to the route, so a '', then the args that are handed into the processor. Or that's how I'm reading it, at least.
15:20 sri thomasoniii: patches welcome
15:20 purl patches welcome is always true or even for metacpan.org or swahili for "Put up or shut up."
15:22 _eugen joined #mojo
15:25 sri marty: the api is not commonly used, but it's correct
15:26 sri i suspect he tracked it down through url_for and path_for
15:26 thomasoniii Is there a better alternative? I'm just trying to generate links to other format representations of the same URI.
15:26 thomasoniii So I come into /schools.html for a pretty html page, and want to build links for /schools.json, /schools.txt, etc.
15:26 sri thomasoniii: if you look through the related tests you'll see that it can be tracked down to special cases like /.html
15:27 sri it's a complicated topic, but a well thought out proposal with a better solution would be very welcome
15:28 thomasoniii My solutions all feel half-baked atm, but if I come up with a better looking alternative I'll pass it along.
15:28 sri if $route->render() was really the first thing you tried.... then you would indeed be wrong
15:29 sri there is literally no real documentation referring to it
15:29 sri i just assumed you did some research
15:30 thomasoniii I did, but I will also admit that I can also sometimes be too clever for my own good and bend snippets of code to my will when there are better solutions.
15:32 sri as usual, no direct answer from me, since i want to find out if the documentation is at fault ;)
15:32 sri if you can't find it out i'll post a one-liner in a few hours
15:33 thowe joined #mojo
15:34 marty thomasoniii:  I'm not sure what your big picture goal is but I usually find that i missed something along the way if I start to use venture into undocumented territory.   :)
15:35 thomasoniii Well, that's exactly why I come in here with my esoteric questions. For the most part, mojo is really quite easy to use and pretty obvious in its functionality and operation. So when I start veering into things that aren't, I tend to assume that I screwed something up as opposed to the framework missing what I need. ;-)
15:35 sri $route->render is usually hidden under 3 layers of abstraction
15:36 thomasoniii $controller->url_for(route_name, format => 'html') has the same /.html render, FWIW.
15:36 sri aha, and now we are back to "patches welcome" ;p
15:36 sri that was the one i wanted to see from you
15:37 sri because
15:37 sri perl -Mojo -E 'a("/schools" => sub { $_->render(text => $_->url_for(format => "json")) })->start' get /schools.txt
15:39 thomasoniii I still wasn't positive if this was something that needed a patch or if I should set it up differently. Since my routes are roughly this:
15:39 thomasoniii my $parent = $route->route('/schools');
15:39 thomasoniii my $child = $parent->get('/');   <— this is the one that renders as /schools/.txt
15:39 thomasoniii Some other permutation of defining that child "root" route might've worked, I'd hoped.
15:40 sri that seems patchable
15:40 thomasoniii I'll poke around and see if I can track it down. :-)
15:40 sri it should happen in Mojolicious::Routes::Route::render
15:41 sri some //= '/' thing you want to make depend on parents
15:41 thomasoniii It's actually coming out of the pattern->render, but I haven't tracked it down further than that yet.
15:41 sri i have a feeling it might be performance critical though
15:42 sri oh, the pattern will be harder to deal with
15:42 sri since it doesn't know about parents
15:42 sri and we have to handle /.html
15:42 thomasoniii very encouraging. ;-)
15:42 sri godspeed!
15:42 purl i heard godspeed was about darkuncle's favorite though. or about a punk bike messenger speedfreak in SF, at http://www.amazon.com/exec/obidos/tg/detail/-/0312286805/qid=1030569969/sr=8-1/ref=sr_8_1/102-9558966-3182555?v=glance&amp;s=books&amp;n=507846 and by (: lynn breedlove) or a track by BT (the Hybrid remix is exceptional) or short for Godspeed You! Black Emperor
15:45 thomasoniii FWIW, I'm working on things for a very generic CRUD implementation. So I've got a bunch of objects, but they all have the same list, edit, view, delete routes on them.
15:45 thomasoniii I was hoping to duplicate the names on the child routes, and only look for them inside of the parent, basically using the parent as a namespace. So I can then lookup ->{schools}->{list} in some manner, as opposed to needing to hardwire all the child routes with ugly namespaced names ala 'schools-list', 'schools-view', etc.
15:45 thomasoniii That's what lead me to wanting to render the route directly, as opposed to using url_for, since I didn't have a uniquely defined name for it.
15:45 thomasoniii I may retool it so the child route lookup just returns a universally namespaced route name ('schools-name') instead of doing the local overwritten name instead, and then I can just pass that into url_for.
15:45 sri use case doesn't matter
15:46 sri i would accept a patch if you can make it work
15:46 sri thing is, it's hard
15:46 sri perl -Mojo -E 'app->routes->under("/schools")->get("/" => sub { $_->render(text => $_->url_for(format => "json")) }); app->start' get /schools.txt
15:46 thomasoniii Well, I was just mentioning how I ended up digging out the route's render method instead of using the more sensible url_for in the controller. :-)
15:46 sri one-liner for the case
15:48 sri pretty sure your problem is this line https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Routes/Pattern.pm#L88
15:48 thomasoniii yep, that's what I was just looking into now.
15:55 thomasoniii Would it be reasonable to just add:
15:55 thomasoniii $str =~ s!/+$!! if $format;
15:55 thomasoniii right after that line?
15:55 thomasoniii It only appends .$format if it has one, so the regex there just strips out any trailing slashes that $str may have before appending it. Doing it in a secondary regex like that would also catch any cases where $str already ends in a / for some reason. (e.g., $str = 'foo/' and $format = 'html' would return 'foo.html')
15:55 thomasoniii I don't know enough of the url construction to know if that'd break other things, though.
16:02 dod joined #mojo
16:14 bobkare joined #mojo
16:18 sri thomasoniii: try it and run the tests
16:18 sri coverage is very good
16:20 sri i know two actual solutions though
16:20 sri one is 100% backwards compatible but ugly
16:21 sri the other breaks two tests, but those are rather unimportant and undocumented
16:22 thomasoniii all tests passed with my tweak.
16:23 sri then we have 3 solutions
16:24 sri https://gist.github.com/anonymous/6465366809a78730ff67
16:24 sri that one i would consider the cleanest
16:25 sri and prolly fastest
16:25 thomasoniii cleanest and fastest sounds best to me. :-D
16:38 jamesaxl joined #mojo
16:56 sri ok, i don't see any performance regressions
16:59 batman sri, marcus: i've merged the "hide join/part/quit" messages issue on demo.convos.by now https://github.com/Nordaaker/convos/pull/197 and https://github.com/Nordaaker/convos/pull/192
17:03 sri ohoh, i do have a performance regression now
17:04 disputin joined #mojo
17:05 basiliscos joined #mojo
17:07 denis_boyun joined #mojo
17:11 denis_boyun_ joined #mojo
17:12 batman is it possible to run a test with a self signed SSL cert?
17:12 kbenson joined #mojo
17:22 sri ok, and now i've turned the performance regression around and it's faster than before :)
17:31 good_news_everyon joined #mojo
17:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/mvruvw
17:31 good_news_everyon mojo/master a4eab87 Sebastian Riedel: fixed bug in Mojolicious::Routes::Pattern where an unnecessary slash could be rendered before formats
17:31 good_news_everyon left #mojo
17:31 sri thomasoniii: there you go
17:37 good_news_everyon joined #mojo
17:37 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/KUuNLA
17:37 good_news_everyon mojo/master cf4bd09 Sebastian Riedel: test rendering a slash with format
17:37 good_news_everyon left #mojo
17:48 good_news_everyon joined #mojo
17:48 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/A8uEBQ
17:48 good_news_everyon mojo/master 6d5f3be Sebastian Riedel: the pattern does not return a bare slash anymore
17:48 good_news_everyon left #mojo
17:51 marty sri++ for bug fixes at Supervillain speed
17:57 cfedde B1gBadaBoom
17:57 denny ^ smells like password
17:57 cfedde time to change that one.
17:57 denny Hunter2 ?
18:04 disputin joined #mojo
18:07 irq joined #mojo
18:08 sri i only see ***********
18:26 genio I can only think of The 5th Element
18:43 KCL_ joined #mojo
18:55 tempire multipass
18:55 purl Leeloo Dallas Mul-ti-pass
19:14 neilhwat1on joined #mojo
19:15 berov joined #mojo
19:21 good_news_everyon joined #mojo
19:21 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/tEDouw
19:21 good_news_everyon mojo/master 97e6eab Sebastian Riedel: better comments for example application
19:21 good_news_everyon left #mojo
19:27 sri batman: did something go wrong? i only see "Participants (0)" in the sidebar now
19:27 batman sri: *refresh*
19:27 batman oh
19:27 batman i see
19:27 sri same
19:31 batman fixed now
19:31 sri and back :o
19:31 sri heh :)
19:32 batman :)
19:34 batman thanks!
19:34 batman sri++
19:34 sri batman++
19:41 * sri was considering an app like this for frontpage... but it's rather hard to explain with a simple comment... and doesn't add that much awesome... https://gist.github.com/anonymous/9869edbdf244a6c69a99
19:41 sri *+the
19:43 sri jberger: having params is really hard for a small example that should also work completely when pasted
19:46 sri wow, now this is a useful atom package https://atom.io/packages/git-history
20:17 disputin joined #mojo
20:53 cpan_mojo Mojolicious-Plugin-BootstrapHelpers 0.0172 by CSSON - http://metacpan.org/release/CSSON/Mojolicious-Plugin-BootstrapHelpers-0.0172
21:11 disputin joined #mojo
21:14 cfedde joined #mojo
21:17 mr-foobar joined #mojo
21:34 jnbek joined #mojo
21:38 jnbek joined #mojo
21:50 good_news_everyon joined #mojo
21:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/4nxi9w
21:50 good_news_everyon mojo/master 73e0c4f Sebastian Riedel: the bug spans multiple classes
21:50 good_news_everyon left #mojo
21:52 woz joined #mojo
21:53 good_news_everyon joined #mojo
21:53 good_news_everyon [mojo] kraih tagged v5.42 at 661f2aa: http://git.io/CncbjQ
21:53 good_news_everyon left #mojo
21:55 good_news_everyon joined #mojo
21:55 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/LA6lYg
21:55 good_news_everyon mojo/master 8d8f411 Sebastian Riedel: bump version
21:55 good_news_everyon left #mojo
21:55 cpan_mojo Mojolicious 5.42 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojolicious-5.42
22:04 berov Now if they accept my merge request in Atom when pressing Ctrl+R the attributes will be also available
22:04 berov https://github.com/atom/symbols-view/pull/52/files
22:14 disputin joined #mojo
22:14 bodgix joined #mojo
22:22 woz joined #mojo
22:31 jnbek \ m / ~_~ \ m /
22:54 woz joined #mojo
22:58 woz joined #mojo
23:53 d4rkie joined #mojo
23:54 d4rkie joined #mojo

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