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

IRC log for #mojo, 2014-08-18

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

All times shown according to UTC.

Time Nick Message
00:15 neilhwatson If I have a route like this, is there a short cut in the called sub to get the trailing word in the url: 'kept'?  $r->get( '/trend/kept'     )->to( 'graph#trend',
00:20 d4rkie joined #mojo
00:23 woz joined #mojo
00:24 firnsy neilhwatson: you could use a placeholder for for the /trend route, ie. $r->get('/trend/:name')->to('graph#trend')
00:25 firnsy in the trend method of your graph controller you'll be able to access ":name" via param('name')
00:25 neilhwatson Thank you, will try.
00:32 hesco joined #mojo
00:41 d4rkie joined #mojo
00:57 laouji joined #mojo
01:03 GabrielVieira joined #mojo
01:04 GabrielVieira joined #mojo
01:18 sri $c->req->url->path->parts->[-1]
01:21 sri bug summary btw. https://groups.google.com/forum/#!topic/mojolicious/Nz1VZ7z1MFA
01:23 jberger I think the word "heisenbug" is the most physics+programming word in existence. it really makes me happy!
01:24 woz joined #mojo
01:25 sri :)
01:39 sujithm joined #mojo
01:41 klapperl joined #mojo
01:47 dabudabu According to wikipedia, there's also bohrbug, mandelbug, schroedinbug, and hindenbug
01:47 dabudabu Might be humbug that somebody added to be funny though
01:56 woz joined #mojo
02:48 noganex_ joined #mojo
02:50 mr-foobar joined #mojo
02:59 woz joined #mojo
03:08 basic6_ joined #mojo
03:50 compadre joined #mojo
03:50 compadre Hey guys, I was attempting to run a myapp.pl with hypnotoad to serve up a dot XHTML page but for some reason when I visit port 8080 on localhost it just serves it up as text
03:50 compadre any help would be appreciated, not sure what I am doing wrong.
03:51 firnsy g'day compadre, seeing some code would help
03:51 compadre sure thing, anywhere specific I should paste it?
03:52 compadre also the xhtml file or the pl file?
03:52 firnsy the pl specifically, to a pastebin
03:52 firnsy there's a prefered one, but i can't remember
03:53 compadre I'll just throw it up on pastebin
03:54 firnsy http://paste.scsys.co.uk/
03:54 purl somebody said http://paste.scsys.co.uk/ was my friend
03:54 firnsy just found it
03:54 firnsy thanks purl
03:54 compadre http://pastebin.com/h34Ys1Vj
03:55 compadre I just coppied a template for serving up static pages from somewhere, it said that I have to put the actual files into a subfolder called public, I did that and essentially it does serve up the file, except that it doesn't attempt to render it and just shows the text content of the xhtml file.
03:56 firnsy won't an xhtml file just look like text in the browser?
03:57 compadre well when I open it locally without a server in the middle
03:57 compadre it does display an actuall rendering, calling out the css file and a bunch of other stuff, pulling fonts from google fonts and whatnot
03:57 compadre I can paste the xhtml file if you want
03:58 firnsy that's fine, i just googled what xhtml was
03:59 firnsy i haven't had this use case before, so i'll have a quick play locally first
04:00 compadre sounds good
04:00 compadre here's the paste for it just in case.
04:00 compadre http://pastebin.com/XYkS4sCk
04:00 woz joined #mojo
04:02 firnsy that pastebin html looks malformed, there's an </ol> without an <ol>
04:02 firnsy *xhtml
04:02 firnsy i'll presume you did a quick sanitisation
04:03 compadre yes indeed
04:03 compadre not because the content is super secret or anything haha
04:03 preaction joined #mojo
04:06 firnsy compadre: the response has a "text/plain" header for the content_type
04:06 compadre oh hmm
04:06 compadre what should it be changed to?
04:07 firnsy i'm guessing application/xhtml+xml
04:07 firnsy i'll quickly check
04:07 compadre and also where approximately what line is that at on the pastebin?
04:08 firnsy it's being done has part of the render_static call i presume
04:08 * firnsy hasn't looked into mojo internals yet
04:08 compadre oh in the pl file?
04:10 compadre I think I found something that may lead me to the right place
04:10 compadre http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering
04:12 firnsy yeah rendering static files is where i'm trying to force the content_type atm
04:13 compadre yah I think there is a way to specify something other than plain text in the pl file but I can't find exactly what to stick in there.
04:13 compadre I assume if you put nothing specific it just goes ahead and goes the route of plain text or maybe recognizes only regular html files as well.
04:35 firnsy compadre: render_static is going to override any content_type changes when it calles serve in Mojolicious::Static
04:46 shadowpaste "firnsy" at 217.168.150.38 pasted "serving xhtml for compadre" (11 lines) at http://paste.scsys.co.uk/416408
04:47 firnsy compadre: not sure if that's the cleanest solution
04:54 GabrielVieira joined #mojo
04:56 compadre joined #mojo
04:57 compadre logged me out, not sure if my messages went through
04:58 firnsy compadre: http://paste.scsys.co.uk/416408
05:01 irq joined #mojo
05:03 woz joined #mojo
05:07 laouji joined #mojo
05:41 inokenty joined #mojo
05:41 GabrielVieira joined #mojo
06:01 dvinciguerra joined #mojo
06:04 woz joined #mojo
06:18 denis_boyun joined #mojo
06:32 Vandal joined #mojo
06:34 neyasov joined #mojo
06:41 KCL joined #mojo
06:53 neyasov joined #mojo
07:05 woz joined #mojo
07:28 dp_ joined #mojo
07:29 kwa joined #mojo
07:35 dvinciguerra joined #mojo
07:48 rawler joined #mojo
08:04 irq joined #mojo
08:06 woz joined #mojo
09:07 woz joined #mojo
09:49 irq_ joined #mojo
09:52 irq__ joined #mojo
09:55 D4RK-PH0ENiX joined #mojo
09:57 irq_ joined #mojo
10:01 cpan_mojo Mojolicious-Plugin-XRD 0.08 by Nils Diewald - http://metacpan.org/release/AKRON/Mojolicious-Plugin-XRD-0.08
10:10 woz joined #mojo
10:12 cpan_mojo Mojolicious-Plugin-XML-Loy 0.10 by Nils Diewald - http://metacpan.org/release/AKRON/Mojolicious-Plugin-XML-Loy-0.10
10:18 Akron joined #mojo
10:22 Akron I should have filled the whole cpanday with updating my modules to Mojolicious 5.29 and the ->helpers object ...
10:25 Akron sri++ for finding the heisenbug. I guess I've already witnessed the guy.
10:56 fhelmber_ joined #mojo
11:12 woz joined #mojo
11:13 cpan_mojo Mojolicious-Plugin-HostMeta 0.13 by Nils Diewald - http://metacpan.org/release/AKRON/Mojolicious-Plugin-HostMeta-0.13
11:19 sujithm joined #mojo
11:27 GabrielVieira joined #mojo
11:44 GabrielVieira joined #mojo
11:44 d4rkie joined #mojo
11:44 GabrielVieira joined #mojo
11:44 d4rkie joined #mojo
12:05 woz joined #mojo
12:05 GabrielVieira joined #mojo
12:09 d4rkie joined #mojo
12:11 neilhwatson joined #mojo
12:19 tadamo joined #mojo
12:35 d4rkie joined #mojo
12:35 d4rkie_ joined #mojo
12:50 sujithm joined #mojo
12:52 aramisf joined #mojo
12:53 sri Akron: i think many of us have witnessed that bug, and ignored it because it disappears again so quickly
12:56 hesco joined #mojo
13:01 sri btw. don't stop profiling marcus and jberger, those findings were great!
13:16 ryozi joined #mojo
13:27 good_news_everyon joined #mojo
13:27 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/XxzahA
13:27 good_news_everyon mojo/master 65236ec Sebastian Riedel: improved Mojolicious::Static to allow custom content types
13:27 good_news_everyon left #mojo
13:27 sri firnsy, compadre: now supported
13:31 firnsy sri++
13:38 good_news_everyon joined #mojo
13:38 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/p5cP6w
13:38 good_news_everyon mojo/master 8fdb9a9 Sebastian Riedel: custom content type should be a little faster
13:38 good_news_everyon left #mojo
13:42 good_news_everyon joined #mojo
13:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/Gzk8NQ
13:42 good_news_everyon mojo/master 3a67549 Sebastian Riedel: added render_static example
13:42 good_news_everyon left #mojo
14:25 Jonneh joined #mojo
14:27 hesco joined #mojo
14:28 gryphon joined #mojo
14:30 Guest joined #mojo
14:36 Claudio joined #mojo
14:40 Wim joined #mojo
14:43 testink joined #mojo
14:44 doby joined #mojo
14:46 testink left #mojo
15:21 fhelmber_ joined #mojo
15:37 irq joined #mojo
15:39 marcus Please stop profiling us :-/
15:55 sh4 joined #mojo
16:04 woz joined #mojo
16:07 marcus flame graphs so pretty.. and so useless...
16:09 nicomen ?
16:11 marcus nicomen: https://www.evernote.com/shard/s22/sh/c982bdd3-e4ec-4662-b67c-4b73e0ea8d06/c4643bb19391c78fed1df8e3ea3e83ae/deep/0/NYTProf-convos-and-1.-marcus@mrbook----Source-convos-(zsh).png
16:12 marcus nicomen: do you find it to be a useful representation of anything?
16:14 nicomen I can see your logic is inside the templates ;-P
16:15 davido__ joined #mojo
16:15 marcus nicomen: Really? That's profiling https://github.com/Nordaaker/convos/blob/master/templates/user/register.html.ep
16:17 nicomen I was really wondering who is profiling you
16:17 nicomen aaah
16:18 marcus <sri> btw. don't stop profiling marcus and jberger, those findings were great!
16:28 GabrielVieira joined #mojo
16:39 disputin joined #mojo
16:43 sri marcus: GOT SOMETHING TO HIDE?!
16:43 * sri detains marcus
16:43 * marcus throws molotov cocktails at sri.
16:44 * sri peppersprays the entire channel
16:46 marcus sri: Looking at path parse, wondering if it might be worth refactoring leading and trailing slash from regex to some more manual code.
16:46 woz joined #mojo
16:48 GabrielVieira joined #mojo
17:00 marcus sri: https://gist.github.com/b013d2642641c1d38de9 passes tests and brings _parse back down below url_for as most time.
17:02 dvinciguerra joined #mojo
17:02 sri interesting
17:03 sri would have thought anchored regular expressions were very fast
17:06 marcus In my NYTProf measurements leading was 250ms with regex and 150 for trailing, and both about 70 ms with substr
17:07 marcus possibly because a lot more of the leading was doing actual replacements than in the trailing
17:08 sri with the apps from the examples dir i can't measure a difference
17:10 sri with a one-liner it appears actually slower Oo
17:10 sri with perl 5.20
17:10 marcus I'm on perl 5.20 too
17:10 sri perl -Mojo -E 'my $u = Mojo::Path->new("/foo/bar"); n { $u->clone->parts } 10000'
17:11 sri perl -Mojo -E 'n { Mojo::Path->new("/foo/bar")->parts } 10000'
17:11 sri same for both
17:12 marcus wonder if it's because you keep feeding it the same string so it can optimize it?
17:13 sri perl -Mojo -E 'n { Mojo::Path->new("/foo/$_")->parts for 1 .. 10000 }'
17:13 sri less difference there, but still slower
17:13 sri oops, my bad
17:13 sri still the same i mean
17:14 marcus hrm, maybe just NYTProf skewing the results then.
17:15 sri nytprof is good for finding hotspots, but for testing optimizations i like to use one-liners
17:16 marcus https://www.evernote.com/shard/s22/sh/66ca4efb-c009-40f9-b9d6-7d5e060b2f17/17e09b9b6a69a249c112f1971a7772b4/deep/0/Profile-of-Mojo-Path.pm.png
17:16 sri that said, i'm almost certain there is still potential for optimization in Mojo::Path
17:17 marcus https://www.evernote.com/shard/s22/sh/8c381b2b-8bd8-49ff-b23f-1a1804d53cd5/b462644476bad781526f1bc7db8ee5e7/deep/0/Profile-of-Mojo-Path.pm.png
17:17 marcus I agree the onliner results seem more likely.
17:17 jberger_ sri: a Chicago.pm collaboration might have come up with a solution to the dup problem
17:18 marcus oneliner
17:18 purl oneliner is a problem for all your answers!
17:18 jberger_ I'm on my phone now,  but i will right it up tonight
17:18 sri maybe you can still optimize it using stuff like chop() :)
17:19 marcus ya, was considering that too
17:19 sri and that was the last time we ever heard from jberger... dun dun dun
17:20 marcus sri: I retested against clean master again now, still seeing the same diff :-/
17:20 marcus Guess it's damn hard to test something without affecting it
17:20 woz joined #mojo
17:24 Kripton joined #mojo
17:27 sri well, if it's so easy to skew the results, at least we know it's not a huge optimization
17:30 marcus agree. Btw, the biggest chunk of time in _parse according to nytprof is   return $self->{$name} unless @_; - because it gets called so many times.
17:38 woz joined #mojo
17:39 marcus sri: I'm consistently seeing 1.6 seconds on master vs 1.5 seconds with my patch for 100k iterations when doing  time perl -I lib -Mojo -E 'n { $p= Mojo::Path->new("/foo/$_/")->parts for 1 .. 100000 }'
17:40 sri can't confirm your results
17:41 sri i do wonder if perl can optimize those regular expressions though
17:41 sri that would actually be really cool
17:42 marcus fwiw, https://gist.github.com/marcusramberg/6414e4366f2b5940448a
17:42 marcus but even if it's real, I'm not sure it's worth it
17:43 sri too much variance in my results, they end up pretty similar
17:45 sri think the simpler looking code wins here
17:45 sri but i still really want to know if perl can optimize matching equal strings
17:46 disputin joined #mojo
17:48 sri perl -Mojo -E 'my @x; push @x, "/foo/$_" for 1 .. 100000; n { Mojo::URL->new($_) for @x }'
17:48 sri no measurable difference for this one
17:50 sri and neither for this one
17:50 sri perl -Mojo -E 'my @x; push @x, "/foo/bar" for 1 .. 100000; n { Mojo::URL->new($_) for @x }'
17:51 marcus Fair enough. I'm actually quite pleased by the result.
17:52 marcus Glad that perl is smart enough to do the right thing.
18:41 Kripton joined #mojo
18:41 KCL_ joined #mojo
18:54 sri hmm, java 9 is getting an http/2 client http://openjdk.java.net/jeps/110
18:57 Guest_ joined #mojo
19:53 basiliscos joined #mojo
19:54 woz joined #mojo
20:23 Adurah joined #mojo
20:23 KCL joined #mojo
20:23 Lee_ joined #mojo
20:23 marty_ joined #mojo
20:24 dotan1 joined #mojo
20:24 irq_ joined #mojo
20:24 tomboh_ joined #mojo
20:25 ceej_ joined #mojo
20:25 suy_ joined #mojo
20:25 firnsy_ joined #mojo
20:25 dexteruk joined #mojo
20:25 augensalat joined #mojo
20:26 ralesk_ joined #mojo
20:26 allison_ joined #mojo
20:26 Guest joined #mojo
20:26 cfedde_ joined #mojo
20:26 mr-fooba_ joined #mojo
20:27 woz joined #mojo
20:27 nicomen_ joined #mojo
20:27 sawtooth_ joined #mojo
20:27 rwp_ joined #mojo
20:27 jmmills_ joined #mojo
20:27 b^_^d joined #mojo
20:27 zanity_ joined #mojo
20:27 btyler_ joined #mojo
20:27 rakshasa joined #mojo
20:27 da5id_ joined #mojo
20:27 caeles_ joined #mojo
20:27 Andreas2 joined #mojo
20:27 cstamas_ joined #mojo
20:27 andrefs_ joined #mojo
20:27 moritz_ joined #mojo
20:27 AdmWiggin joined #mojo
20:27 HtbaaPi_ joined #mojo
20:27 mfontani_ joined #mojo
20:27 sweet_kid joined #mojo
20:27 sivoais_ joined #mojo
20:28 nicomen_ speaking of profiling, for some reason, a specific quite big json result, ends up spending 15 seconds parsing (when using req->json), once in a full moon, I still haven't found out how to reproduce it, but I have logs (logging before and after a req->json statement)
20:29 diego_k joined #mojo
20:29 nicomen_ very seldom and using fcgi, so shouldn't be fork-related AFAIK
20:30 zz_[0xAF] joined #mojo
20:30 mtj| joined #mojo
20:30 Rallias joined #mojo
20:30 tardisx joined #mojo
20:30 yusukebe joined #mojo
20:31 DaTa joined #mojo
20:32 Kovensky joined #mojo
20:32 n00dle joined #mojo
20:35 jnthn joined #mojo
20:36 espen joined #mojo
20:37 voegelas joined #mojo
20:37 xtetsuji joined #mojo
20:37 mudler joined #mojo
20:38 charsbar joined #mojo
20:38 lestrrat joined #mojo
20:38 priodev joined #mojo
20:38 noganex joined #mojo
20:38 mikegrb joined #mojo
20:38 ssm joined #mojo
20:38 agorman joined #mojo
20:38 jojo joined #mojo
20:38 alnewkirk joined #mojo
20:38 jalie joined #mojo
20:39 Wim joined #mojo
20:39 kmx joined #mojo
20:39 batman joined #mojo
20:39 kwa joined #mojo
20:39 hahainternet joined #mojo
20:39 dahl joined #mojo
20:39 howitdo joined #mojo
20:39 rj11 joined #mojo
20:39 kablamo joined #mojo
20:41 mishantil joined #mojo
20:43 omega joined #mojo
20:45 sri so rack is basically dead https://groups.google.com/forum/#!topic/rack-devel/P8oOycVBaH0
20:46 mishanti1 joined #mojo
21:03 arpadszasz joined #mojo
21:10 marcus sri: I guess PSGI suffers from many of the same issues.
21:10 sri very much so
21:12 arpadszasz joined #mojo
21:13 arpadszasz joined #mojo
21:14 arpadszasz joined #mojo
21:16 hesco joined #mojo
21:32 cooper joined #mojo
21:35 woz joined #mojo
21:49 sri how odd, i keep seeing people mention hapi.js... but absolutely nothing about it looks appealing to me! http://hapijs.com/
21:49 sri it does get points for being different though
21:53 sri i actually still wonder if routes to helpers would be fun
21:54 lb routes to helpers?
21:54 sri my $auth = $r->bridge->to('@some_auth_helper'); $auth->get(...);
21:54 sri an alternative for an action
21:55 sri you can already do it more verbose
21:55 lb yeah
21:55 lb ungh, hapi, so much syntax
21:56 sri my $auth = $r->bridge->to(cb => $app->renderer->helpers->{some_auth_helper});
21:57 lb i'd feel dirty writing that
21:57 sri a cleaner implementation would reserve a helper stash value
21:57 sri my $auth = $r->under({helper => 'some_auth_helper'});
21:58 sri possibly with ->to('@...') being a shortcut for that
21:58 sri the helper name would then show up in the logs
21:59 sri [Mon Aug 18 23:59:04 2014] [debug] Routing to a helper "some_auth_helper".
21:59 sri s/ a//
22:00 sri helpers have the advantage that they are very very simple to ship to cpan as reusable components
22:05 * sri also just noticed that this line in the growing guide bothers him "my $logged_in = $r->under->to('login#logged_in');"
22:05 lb mmm
22:05 sri ->under->to() looks odd
22:06 lb yah, reads weird, and that doesn't help understanding
22:06 sri maybe ->under('/')->to(...) would be better
22:10 good_news_everyon joined #mojo
22:10 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/6ER2Lg
22:10 good_news_everyon mojo/master 4e08a92 Sebastian Riedel: use a slash in growing example
22:10 good_news_everyon left #mojo
22:17 good_news_everyon joined #mojo
22:17 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lFrL2w
22:17 good_news_everyon mojo/master 8874fc0 Sebastian Riedel: keep routes formatted the same
22:17 good_news_everyon left #mojo
22:21 sri actually, i think routes to helpers are still a bit too verbose
22:22 sri you'd most likely want to combine a few
22:23 sri my $auth = $r->with(qw(some_auth_helper prepare_some_stash_data make_coffee)); $auth->get(...);
22:26 lb i like it
22:32 disputin joined #mojo
22:32 sri of course there are problems too... there would be a new reserved stash value "helper", and this would need to fit into the lite dsl somehow
22:33 sri or actually, it could reuse the "cb" stash value
22:34 sri put a string in the cb stash value and it assumes a helper
22:34 sri yea, that would work :)
22:34 sri still leaves the lite dsl problem though
22:37 woz joined #mojo
22:39 woz joined #mojo
22:41 sri https://gist.github.com/anonymous/4e1944be44244056e89f # the whole implementation really
22:42 sri evrything else is just abstraction on top
22:42 sri but STILL... the lite dsl problem would have to be solved
22:45 sri $r->with('foo', 'bar'); would just do $r->under({cb => 'foo'})->under({cb => 'bar'})
22:45 sri not that "with" is a good name
23:05 sri and it looks like jberger actually vanished :o
23:27 d4rkie joined #mojo
23:45 d4rkie joined #mojo
23:46 dvinciguerra joined #mojo
23:46 d4rkie joined #mojo

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