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

IRC log for #mojo, 2014-12-14

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

All times shown according to UTC.

Time Nick Message
00:09 Grinnz_ joined #mojo
00:13 woz joined #mojo
00:34 sri hahahahaha... this is horrible... i like it! http://alltheminutes.com/
00:35 chansen LOL
00:38 preaction the tick and the spinner don't sync up
00:38 preaction oh, ghostery blocked everything
00:41 chansen sri: it's hard to be a nerd with a vision ;o)
00:49 DaTa joined #mojo
00:51 preaction if i'm building a wrapper around Mac::FSEvents (and potentially the other kqueue/libnotify implementations) for Mojo::Reactor, what should I call it? Mojo::FSEvents? MojoX::FSEvents?
00:57 chansen preaction: are you sure you could provide such adapter with consistent behavior?
00:57 preaction there already is one for AnyEvent
00:58 preaction and it depends on what behavior they can all agree on
00:58 preaction already, using just the Mac one, there are annoyances and things i have to think about that I don't want to (if you give it a relative path, it segfaults, for example)
01:00 preaction there's also File::ChangeNotify, but that doesn't look embeddable into async event loops
01:02 chansen Exactly, and now you wan't to hide this by providing a "broken" adapter using the Mojo or MojoZ napspace
01:03 * chansen oops s/MojoZ/MojoX/, s/napspace/namespace/
01:04 preaction define broken
01:05 preaction and yes, i'd rather have something DWIM and deal with the differences between platforms, encapsulating into a single place rather than having everyone have to do this themselves
01:06 preaction or, i could just keep that code in my project, and let people copy/paste from me
01:14 franzkafka Hi sri, any specific reason for this from merge in Mojo::Path: pop @{$self->parts} unless $self->trailing_slash;
01:15 franzkafka I.e., if I do $url->path('/foo'); and I want to add, and I do $url->path('/bar')... In other words, mind if I submit an append subroutine to append to the path?
01:17 sri preaction: Mojo::IOLoop::FSEvents?
01:17 sri like Mojo::IOLoop::ForkCall
01:18 preaction okay, thanks
01:18 jberger preaction: its not a reactor in its own right is it?
01:18 preaction even if it needs the Reactor?
01:19 preaction I call $ioloop->reactor->io( $fsevents_handle, sub { ... } );
01:19 preaction maybe i should figure out how the others work before I decide on what level of the IOLoop i need to hook into... I'll let this incubate in my project for a bit before i spin it off
01:21 franzkafka Is there any method to append the trailing slash, something like: $self->secret_url->clone->path($name)->trailing_slash;
01:21 jberger preaction: an IOLoop always has a reactor, I think that given that example Mojo::IOLoop:: is the right namespace
01:21 preaction alright, thanks
01:22 jberger franzkafka: ...
01:22 franzkafka I could do $name.'/' :D
01:23 franzkafka blah
01:23 sri literally http://mojolicio.us/perldoc/Mojo/Path#trailing_slash
01:25 franzkafka yes, but that doesn't work on $url->path($foo)->trailing_slash
01:25 franzkafka no no, it's not even a big deal
01:25 franzkafka my mind is stuck on something, ignore
01:29 jberger franzkafka: perl -MMojo::URL -E 'say Mojo::URL->new("http://mojolicio.us")->path("perldoc")->tap(sub{$_->path->trailing_slash(1)})->to_string'
01:30 franzkafka jberger, :)
01:30 franzkafka thank you jberger
01:30 good_news_everyon joined #mojo
01:30 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/eYCBxQ
01:30 good_news_everyon mojo/master 3b90f8d Sebastian Riedel: a few more path examples
01:30 good_news_everyon left #mojo
01:37 DaTa joined #mojo
01:52 akhasanov joined #mojo
02:01 sri benchmark results for a non-configurable Mojo::Template are rather disappointing... just another 5-10%
02:02 woz joined #mojo
02:11 klapperl joined #mojo
02:38 sri hmm... looks like Mojo::Template with blead perl is a lot slower than with 5.20.1 Oo
02:38 sri as in, my one-liner jumping from 3.1s to 8.1s
02:41 jberger yikes!
02:46 franzkafka hi sri
02:46 franzkafka just curious, any reason headers has an if_none_match method but not an if_match?
02:46 franzkafka it's not a big deal considering I can just do an add, but just curious
02:47 good_news_everyon joined #mojo
02:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/WN9_vw
02:47 good_news_everyon mojo/master c91bf6e Sebastian Riedel: use less interpolation
02:47 good_news_everyon left #mojo
03:07 noganex_ joined #mojo
03:19 akhasanov joined #mojo
03:23 Eke- joined #mojo
03:51 woz joined #mojo
04:31 jberger so, here's some insanity
04:31 jberger http://pastie.org/9779378
04:32 jberger anonymous "classes" which can construct "instances"
04:33 jberger they aren't really classes in that they cannot inherit from anything (yet?)
04:33 * sri still wonders if reini is right about turning inf and nan into null for json encoding
04:33 jberger but, all methods are per-instance, so composing roles into an instance wouldn't be hard
04:35 jberger instances have a callback (essentially BUILD) in which they can create their own methods
04:35 jberger and within that scope, any lexicals are basically private data
04:40 jberger oh, forgot to add initialization data: http://pastie.org/9779385
04:40 * sri builds a new Joel
04:41 * jberger probably deserves it
05:40 woz joined #mojo
06:58 preaction looks like prototype-based objects, i think alnewkirk made one of these things recently too
07:00 preaction here we go: https://github.com/alnewkirk/MooX-Prototype
07:00 preaction i like it for the magic methods from any hash i give it. i wish perl had a core way of doing that
07:03 preaction mainly because of https://github.com/alnewkirk/MooX-Prototype/blob/master/lib/MooX/Prototype.pm#L67
07:03 preaction true anonymous packages.... hmmm....
07:11 PotatoGim^Home joined #mojo
07:27 rem_lex joined #mojo
07:28 woz joined #mojo
07:31 damaya joined #mojo
08:09 amon joined #mojo
08:16 Vandal joined #mojo
08:17 disco joined #mojo
08:24 irq joined #mojo
08:29 irq how to best recognize within a controller that myapp is run in a test mode with `./myapp get /foo`, not as a daemon, or with morbo or with hypnotoad. I need to skip authentication to unprotect normally protected routes.
08:29 irq ?
08:30 crab check app->mode in your bridge
08:30 irq One way I can think of is checking $c->req->url->to_abs->host eq '127.0.0.1'. Is it enough/safe or there a better way?
08:31 crab and set $ENV{MOJO_MODE} to testing in your test script, the way the mojo tests do
08:31 irq crab: I may be running mode = ''development' also under daemon
08:32 crab so add two clauses to your if
08:32 irq the other one being the '127.0.0.1' ?
08:32 crab huh?
08:33 crab if ($mode eq 'testing' || $mode eq 'development' || $mode eq 'whateverelseyouwant') { ... }
08:33 irq what do you mean by the 'two clauses'. One is app->mode, what is the other one?
08:34 crab (though i would suggest authenticating so that you test the real thing rather than sprinkling mode-specific stuff around your code)
08:35 crab for example, you could have a testing/development/whatever-mode route that returns a "you are authenticated" cookie
08:36 irq authenticating is a must in production, but I want to ease debugging
08:37 irq OK then. I see that I can use any secret %ENV key as a switch for that.
08:54 disco joined #mojo
08:57 dod joined #mojo
08:57 Grinnz joined #mojo
09:17 woz joined #mojo
09:28 trone joined #mojo
10:19 neyasov______ joined #mojo
10:23 basiliscos joined #mojo
10:44 PotatoGim^Home joined #mojo
10:49 neyasov______ joined #mojo
11:06 woz joined #mojo
11:48 sh4 joined #mojo
12:24 woz joined #mojo
12:45 nebulous joined #mojo
12:47 mattastrophe joined #mojo
13:42 Eke- joined #mojo
14:10 good_news_everyon joined #mojo
14:10 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/Zug-bg
14:10 good_news_everyon mojo/master c37bc77 Sebastian Riedel: use only one regex
14:10 good_news_everyon left #mojo
14:25 woz joined #mojo
14:36 good_news_everyon joined #mojo
14:36 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/kGqg3w
14:36 good_news_everyon mojo/master e485a94 Sebastian Riedel: use less regular expressions
14:36 good_news_everyon left #mojo
14:36 sri this is a 20% gain :)
14:49 sri perl -Mojo -E 'n { Mojo::Template->new->parse(qq{test <% for (1 .. 3) { %>  <%= 1 + 1 %>\n  %= 2 + 2\n  <%= 3 + 3 %> <%= 4 + 4 %>\n  <% } %>123} x 1000) } 10'
14:50 sri pretty nice performance gain for that one-liner since 5.69, it went from 1.91s to 1.29s
15:13 neyasov______ joined #mojo
15:15 nebulous joined #mojo
15:20 akhasanov joined #mojo
15:25 dod joined #mojo
15:30 basiliscos sri: Hi. I see you marked "need info" on the issue https://github.com/kraih/mojo/issues/717 . Thanks for paying attention to that.
15:30 basiliscos What kind of additional info do you need? And How can I provide that?
15:36 dod joined #mojo
15:40 dod joined #mojo
15:56 sri basiliscos: don't know
15:56 purl rumour has it don't know is it proper place, but who cares? https://rt.perl.org/Public/Bug/Display.html?id=122906
16:01 akhasanov joined #mojo
16:01 zivester joined #mojo
16:02 basiliscos sri: what is the correct Mojo behaviour when message size exceeds MOJO_MAX_MESSAGE_SIZE  ?
16:03 basiliscos should it just drop the connection ?
16:05 sri that's literally in the tutorial http://mojolicio.us/perldoc/Mojolicious/Lite#File-uploads
16:06 mst which explains why it's basically impossible to find when using the docs as a reference
16:06 sri i have to admit, this does make me a little sceptical of the bug report
16:07 mst the fact the behaviour's erratic suggests there's -something- going wrong -somewhere-
16:13 neyasov______ joined #mojo
16:41 basiliscos joined #mojo
16:51 sri ah, the Mojo::Template performance regression with blead perl seems to have disappeared now
16:51 asarch joined #mojo
16:52 sri or actually, nope it hasn;t
16:52 sri s/;/'/
16:52 sri parsing and compiling the template is about as fast as it used to be
16:52 sri but rendering is *a lot* slower
16:53 sri looks like concatenating strings got slower
16:53 sri perl -Ilib -Mojo -E 'n { Mojo::Template->new->render(qq{test <% for (1 .. 3) { %>  <%= 1 + 1 %>\n  %= 2 + 2\n  <%= 3 + 3 %> <%= 4 + 4 %>\n  <% } %>123} x 1000) } 10'
16:53 sri this went from 2.8s to 7.8s
16:53 jberger if that's really true, you should bring it up to p5p
16:54 sri i don't have a minimal test case
16:56 mst an email saying "I'm not entirely sure what caused this" might work
16:56 mst alternatively, a git bisect on blead to find the commit(s) might shed light
16:56 sri i've been yelled at too often to do that :S
16:57 sri i'll write something if i find a better test case
16:59 sri although, i wouldn't be surprised if it's a known problem and related to the CoW optimizations that keep getting added and removed by sprout
17:03 mst optimization of complex systems is always a bitch
17:05 woz joined #mojo
17:08 sri it's not just concatenation of strings
17:15 neyasov______ joined #mojo
17:20 sri aha, it's not template execution at all
17:21 sri it's the eval step
17:21 sri looks like eval just got slower
17:24 mst so the question then becomes "what did we buy with that?"
17:24 mst I mean, e.g. I'd take slower eval if it was required for the deref optimisation that makes accessors faster once they're built
17:26 sri it's more complicated, i can't actually reproduce it with a minimal test case either
17:27 mst right, I was using that as an example of something that I'd've considered worthwhile, not really a proposed true reason
17:27 sri all i got so far is that the $t->compile step here triggers it perl -Ilib -Mojo -E 'n { my $t = Mojo::Template->new->parse(qq{test <% for (1 .. 3) { %>  <%= 1 + 1 %>\n  %= 2 + 2\n  <%= 3 + 3 %> <%= 4 + 4 %>\n  <% } %>123} x 1000); $t->build; $t->compile } 10'
17:28 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Template.pm#L86-L96
17:32 sri it is definitively that eval though, if i remove it's the correct time that's missing
17:35 sri ok, i do have a test case... which is 3000 lines long ;p
17:39 sri https://gist.github.com/anonymous/9a93d063a81bfed6a46b
17:42 jberger hahahahahah
17:42 purl LOLCON 5.5 reached.
17:46 nebulous sure it looks large now… but it gzips well.
17:47 sri it's funny, i can even remove the sketchy looking bits... like package and line statements
17:48 sri but i can't replicate it with a one-liner
17:50 sri OMG
17:50 sri i might have found it
17:50 jberger ZOMG
17:52 sri yep
17:52 sri it's the for loop
17:53 mst ... how
17:53 mst ... wat
17:53 mst WHAT
17:54 jberger like, declaring a for loop got slower?
17:54 mst jberger: see #p5p
17:55 sri time perl -E 'my $str = "my \$foo;"; $str .= "for (1 .. 3) { \$foo .= \"test\"; }" x 3000; eval $str for 1 .. 100'
17:55 mst or here :)
17:55 jberger oh gods
17:56 sri just for loops it seems Oo
17:56 sri blocks {} are fine
17:57 sri aha, while loops too
17:58 sri ohoh, i might be wrong there
18:00 sri only for loops oO
18:01 sri better one-liner
18:01 sri time perl -E 'my $str = "sub { my \$foo;"; $str .= "for (1..3){ \$foo .= \"test\"; }" x 3000; $str .= "}"; eval $str for 1 .. 100'
18:07 TyroneShoes joined #mojo
18:08 jegade joined #mojo
18:10 jegade hi, can Mojo::JSON handle Byte Order Marks? I use Mojo::UserAgent to fetch some JSON-Documents, but it fails because there is a BOM
18:10 * jberger blows up the channel
18:11 mst he said BOM, not BOOM
18:11 jegade hehe
18:12 mst I think, however, the answer is to strip the BOM then hand it to Mojo::JSON
18:12 sri BOM is illegal in JSON!
18:12 * sri arrests jegade
18:12 * jegade did not add the BOM!!! :)
18:13 mst SOMEONE SET US UP THE BOM
18:13 jegade ok, ty
18:14 sri http://tools.ietf.org/html/rfc7159#section-8.1
18:22 neyasov______ joined #mojo
18:26 akhasanov joined #mojo
18:26 neyasov______ joined #mojo
18:43 Grinnz_ joined #mojo
18:51 alnewkirk joined #mojo
18:54 woz joined #mojo
19:08 sri wow, interesting bug https://rt.perl.org/Public/Bug/Display.html?id=123430
19:16 mst it's the .. not the for?
19:16 mst WHAT THE
19:25 TyroneShoes_ joined #mojo
19:48 Grinnz lol
19:48 Grinnz [13:12:21] <sri> BOM is illegal in JSON!
19:48 Grinnz i've run into that problem!
19:49 jegade :)
19:50 BinGOs /win 75
19:50 * BinGOs sighs
19:51 Grinnz thats a lot of wins
19:52 mst that's a relatively small irssi config :)
19:53 * sri arrests Grinnz
19:56 irq joined #mojo
20:15 neyasov______ joined #mojo
20:31 neyasov______ joined #mojo
20:38 jberger wow, the .. did it?
20:38 * jberger suspected the butler
20:40 Grinnz in the for loop with the flip-flop
20:43 woz joined #mojo
20:49 nebulous joined #mojo
20:49 neyasov______ joined #mojo
20:51 Eke- joined #mojo
20:53 sri :D
21:03 preaction you can't flip-flop the zip-zop
21:07 rwp joined #mojo
21:10 Grinnz even with a pudding pop?
21:10 nebulous joined #mojo
21:10 preaction tick tock toobity top!
21:29 neyasov______ joined #mojo
21:38 Grinnz sri, interesting development: https://github.com/rurban/Cpanel-JSON-XS/commit/ee35dd020da0c9917cf44957c846d64ffb3c30bc
21:38 Grinnz and with that: https://github.com/Grinnz/Mojo-JSON-MaybeXS/commit/732a46e40690e4b9871fbe517d72c474c3ee5e3b
21:38 damaya joined #mojo
22:00 nebulous1 joined #mojo
22:00 sri i've been wondering what's more correct, stringify or null
22:01 Grinnz i don't think there is a right answer, heh
22:02 Grinnz either way, the javascript will probably not be able to use the result, and either way is better than making the javascript blow up from invalid json
22:02 preaction at least perl would dtrt in re stringified nan/inf
22:03 Grinnz true
22:03 Grinnz grinnz@bookdp15fv2 ~> perl -le'print "-nan"+0'
22:03 Grinnz nan
22:04 Grinnz and yet: grinnz@bookdp15fv2 ~> perl -le'print "-inf"+0'
22:04 Grinnz -inf
22:04 Grinnz lol
22:15 neyasov______ joined #mojo
22:32 sugar joined #mojo
22:32 woz joined #mojo
22:41 sri haha, latest Cpanel::JSON::XS of course doesn't install on os x
22:41 sri there appears to be no -nan on os x
23:11 akhasanov joined #mojo
23:16 Grinnz or BSD, which makes sense
23:57 zivester joined #mojo

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