Camelia, the Perl 6 bug

IRC log for #mojo, 2012-07-24

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

All times shown according to UTC.

Time Nick Message
00:44 asarch joined #mojo
00:54 laouji joined #mojo
00:54 GabrielVieira joined #mojo
01:08 scott joined #mojo
01:57 rem_lex| joined #mojo
02:01 d4rkie joined #mojo
02:01 GabrielVieira joined #mojo
02:36 Psyche^ joined #mojo
02:57 noganex_ joined #mojo
04:18 xaka joined #mojo
04:21 xaka1 joined #mojo
04:31 sri tempire++ # closing a ticket! \o/
05:11 AmeliePoulain joined #mojo
05:11 AmeliePoulain joined #mojo
05:27 GitHub116 joined #mojo
05:27 GitHub116 [mojo] kraih pushed 1 new commit to master: http://git.io/lOmbrw
05:27 GitHub116 [mojo/master] reduced memory usage of dom method in Mojo::Message - Sebastian Riedel
05:27 GitHub116 left #mojo
05:27 sri tempire: i think inconsistent is better than use more memory for everything
05:29 spleenjack joined #mojo
05:33 Britzel joined #mojo
06:05 GitHub101 joined #mojo
06:05 GitHub101 [mojo] kraih pushed 1 new commit to master: http://git.io/lNyStA
06:05 GitHub101 [mojo/master] better response tests - Sebastian Riedel
06:05 GitHub101 left #mojo
06:18 AmeliePoulain joined #mojo
06:23 sri tempire: we could also just cache all ->dom and ->json data, that would speed up tests for example
06:23 sri hmm
06:26 sri would also be in line with the param methods that also cache parsed data
06:27 sri more consistency
06:28 sri i think that makes both ->dom and ->json even more versatile
06:31 ovnimancer joined #mojo
06:32 GitHub140 joined #mojo
06:32 GitHub140 [mojo] kraih pushed 1 new commit to master: http://git.io/-oYJBw
06:32 GitHub140 [mojo/master] improved dom and json methods to cache data consistently - Sebastian Riedel
06:32 GitHub140 left #mojo
06:54 pau4o joined #mojo
07:02 Foxcool joined #mojo
07:09 Vandal joined #mojo
07:12 cosmincx joined #mojo
07:16 Foxcool joined #mojo
07:19 cosmincx joined #mojo
07:20 taryk joined #mojo
07:30 tempire mojolicious no longer shows up in my first page google results for "perl web"
07:30 tempire ah, but still perl web framework
07:31 omega shows up on mine
07:31 omega but I have perzonalized I guess
07:31 tempire I'm doing an incognito window
07:31 tempire from what I understand, it's still somewhat personalized by ip and other factors.
07:31 tempire thought not directly by login
07:31 tempire WHAT
07:32 tempire new alphas episode!
07:42 Htbaa joined #mojo
07:43 Htbaa with the select_field helper, how do you specify which option should be selected? Only thing I see in the source is that it takes it from from the controller's param() method
07:44 batman joined #mojo
07:45 Htbaa which is not something you'd always want, atleast not me :)
07:50 tempire Htbaa: use case in which that's not what you want?
07:52 Htbaa rendering a select list with some options for which the selected option comes from another data source besides a post?
07:52 Htbaa e.g. a stored preference
07:52 Htbaa such as a selected country for a profile
07:55 Htbaa but I guess I'll just not use that helper then
07:56 Htbaa it's a bit strange you can't properly select a default option without meddling with the input parameters
08:03 sri Htbaa: you're welcome to make better tag helpers
08:12 Htbaa when I get the time I will. Basically all that's required is to pass a selected parameter to the select_field helper, which would be used instead of the value from param()
08:14 pau4o joined #mojo
08:15 fhelmber_ joined #mojo
08:31 tm joined #mojo
08:33 pau4o joined #mojo
08:41 sri tempire: any thoughts on making dom/json cache data?
08:42 tempire still increases the memory usage, right?
08:42 tempire or is that just for ->find
08:42 sri for all
08:42 tempire what sort of memory increase are we talking about?
08:43 sri but it at least trades memory usage for performance
08:43 sri there is no real memory usage increase
08:43 tempire well it sounds peachy then
08:43 sri the MojO::DOM object just stays around till the transaction is destroyed
08:43 tempire performance is what everyone complains about anyway
08:44 sri and if you want more control you can always instantiate Mojo::DOM/Mojo::JSON yourself of course
08:45 sri it could be a rather substantial performance gain for tests, since ->text_is() json_is() and friends only parse once now and share the data
08:46 sri you can also use $req->json('/foo') like ->param() now, without worrying about reparse costs
08:48 sri now if you do $req->json->{foo} = 'bar'; it changes what $req->json('/foo') returns as well
08:49 sri same if you rewrite $req->dom
08:49 tempire it's pretty neat.  dangerous.  but neat.
08:51 sri i like how convenient it can be, but of course i might be missing some dangers
08:54 sri like my $foo = $req->json; $model->insert($foo); $model2->insert($foo);
08:54 sri what if $model1 changes $foo
08:55 sri hmm... i guess that doesn't change at all ;p
08:55 sri more like $model->insert($req->json); $model2->insert($req->json);
08:57 ovnimancer joined #mojo
08:58 sri tempire, marcus, crab: these are important design decisions, i would very much appreciate your participation
08:58 nic joined #mojo
08:58 marcus hay
08:58 marcus I like trading memory for performance.
08:59 tempire agreed
08:59 tempire but
08:59 tempire I don't like the idea of ->json being so maleable
08:59 tempire malleable
08:59 tm sri: I'm not in the loop really but is there any risk that if json is malformed/malicious it will affect what happens next?
08:59 * marcus hammers it
08:59 sri well, it's not unlike $req->cookie('foo')->value('bar')
09:00 sri there are other cached things that can be changed as well
09:00 sri tm: no
09:00 sri that's completely irrelevant here
09:00 tm sri: tnx, I was just thinking security for a sec here :)
09:00 marcus I've read backlog completely now
09:01 marcus and I really like the idea
09:01 tempire tm: you're in the loop by participation
09:01 sri what tempire said
09:03 sri it's easier for $req->dom, i can't really think of much to go wrong there
09:03 tempire essentially everything is fine except people could shoot themselves in the foot.
09:03 sri yea
09:04 tempire I'm ok with it.
09:05 * sri tries to think of a common case to go wrong
09:05 crab i don't understand the problem
09:05 crab (sorry)
09:06 crab this: "the MojO::DOM object just stays around till the transaction is destroyed" makes perfect sense to me.
09:07 sri $req->dom is not really a problem
09:07 sri $req->json is the tricky one
09:08 sri my $foo = $req->json; $foo->{bar} = 'baz';.... now $req->json->{bar} is 'baz' too
09:08 sri so if you pass around the hash generated from json verbatim between models changes to it might have side effects
09:09 tempire I think that's acceptable.  That's just Perl.
09:09 sri only case where it could go wrong i can think of would be two models using the same input hash
09:10 sri but yea, i guess that's perl
09:10 tempire how many beginners use two models?
09:10 tm tempire: none? me included :)
09:11 nic The people beginning to use two models; which camp are they in?
09:11 sri that's 100% of all beginners that asnwered... i think it's fine :)
09:11 tempire there you go.  statistical proof according to the maximum likelihood estimator.
09:12 tempire trust me.  I read the wikipedia page on statistics.
09:12 sri i wonder how $req->json is actually used out there in the real world
09:12 sri a positive side effect could of course be more common use of $req->json('/foo/23/bar')
09:12 nic In my incognito tab, "? perl web" has mojolicio.us in position #10
09:13 sri same here, #10
09:13 bc547 sri: I use it to get a hash
09:13 tm on the first glance my logic would say changes in $foo->{bar} shouldn't affect $req->json->{bar}, but I see why it may be interesting issue - race condition if someone messes up their code using two models
09:13 bc547 sri: and all further processing is done using the hash reference
09:14 bc547 sri: i didn't know $req->json('/foo/23/bar') was possible
09:15 sri bc547: you extract data from the hash, or modify it and pass it along further?
09:16 bc547 sri: just extracting
09:16 sri i see
09:16 nic We could mitigate the risk by documentationing a small note saying that if a copy is wanted, a deep copy should be made first
09:16 tm sri: at the same time to what i said above, it's in coder's hands to make sure he doesn't modify variables accidentally - they can always be copied in local scope and work off copy if needed, but maybe it's just me
09:17 bc547 sri: I would not expect changes to the hash to be visible with ->json... but i'm no perl guru :-)
09:17 sri tm: deep copies are hard
09:18 bc547 sri: but I prefer performance more than beginner-proof design :-)
09:18 nic just a case of using one of the many CPAN options
09:18 nic eg freeze + thaw
09:19 sri but like i said before, it's not unlike $req->cookie('foo')->value('bar'), which also changes the cookie value globally
09:19 nic or more simply, Clone
09:20 sri only case i worry a little about is my $foo = $req->json; my $bar = $req->json; $model1->insert($foo); $model2->insert($bar);
09:21 sri where changes to $foo affecting $bar too might cause trouble
09:21 omega deep clone is more or less expensive than re-parse?
09:21 sri less i bet
09:22 nic hm, interesting point
09:22 nic There's only one way to find out
09:22 nic Death Match!!
09:22 tm sri: it will and it's not very intuitive imho, so either big warning or more expensive workaround - as long as people know what to expect it should be good
09:22 sri tm: all methods that cache in Mojo::Message already have warnings :)
09:23 sri which is actually quite a few
09:23 sri param() and friends cache too
09:24 sri query params, post params, uploads, cookies, dom and json... all cached now
09:24 sri that's what i meant with it being more consistent
09:25 tm fine by me, I'd go for speed then :)
09:26 tm I just see how much I have to learn to write proper code in Mojolicious... slowly, getting, there :)
09:26 tm if I could throw in side topic for a second... following http://blog.kraih.com/mojolicious-101-tls-goodness I try to run daemon with SSL cert (self-signed for now) but when I start it, it munches on the cert for a while and says Can't create listen socket: Invalit argument in .../IOLoop.pm line 154 which is $server->listen(@_); <-- perl 5.10.1, Mojolicious 3.12
09:27 tm any idea what do I do wrong?
09:28 sri that error comes from IO::Socket::SSL i'd assume
09:28 tm hmmm let me check
09:28 sri wait, you did not really follow that blog post did you?
09:28 sri that's from 1.01!!!!1
09:29 tm didn't find any newer one :D
09:29 sri see docs
09:30 sri http://mojolicio.us/perldoc​/Mojo/Server/Daemon#listen
09:30 tm *facepalm*
09:30 * tm crawls back to his dark corner
09:30 tm ;)
09:30 nic left #mojo
09:31 nic joined #mojo
09:54 GitHub148 joined #mojo
09:54 GitHub148 [mojo] kraih pushed 1 new commit to master: http://git.io/g1DiGA
09:54 GitHub148 [mojo/master] small optimizations - Sebastian Riedel
09:54 GitHub148 left #mojo
10:21 daxim joined #mojo
10:28 sri hmm, and while we're talking about performance improvements...
10:28 sri ... removing http 0.9 support could help quite a bit
10:28 daxim encoding problem with mojolicious:  http://stackoverflow.com/questions/116279​96/utf8-strings-partially-not-recognized
10:33 sri tempire, marcus, crab: thoughts?
10:33 tempire I don't know anything about http 0.9, I cannot comment at the moment.
10:34 sri i believe it's actually already broken
10:34 tempire well in that case I support removal :)
10:34 sri but i'm having trouble verifying since no 0.9 clients exist anymore ;p
10:34 tm to be fair, all browsers use 1.1, bots and scripts sometimes go back 1.0, haven't seen 0.9 for years and I do read my logs :D
10:35 sri the 1.0 spec is from 1996
10:35 sri 0.9 never had a real spec
10:36 sri in my tests the difference can be up to 100 rps :o
10:36 tm remove it then pls - it's 100 rps that could be used for real stuff
10:37 * nic goes round the interwebs collecting all the spare 100 rps for himself
10:38 tm <smeagol>...my precious...</smeagol>
10:38 * tempire always keeps 2 or 3 rps for a rainy day
10:38 sri http://www.w3.org/Protocols/HTTP/HTTP2.html # the "spec" btw.
10:39 sri responses are so horrible
10:40 sri haha, sooo many bugs
10:41 sri there is no way anyone could ever have used 0.9 support :)
10:42 * tempire dissipates
10:43 tm I have another stupid question.. .how do I tell TagHelper in from_for to point to action in a controller? I want tag helper to derive action URI from router
10:48 tm the idea behind is that if I change routes it will change URIs in forms as well
11:07 mire joined #mojo
11:44 GitHub16 joined #mojo
11:44 GitHub16 [mojo] kraih pushed 3 new commits to master: http://git.io/5ANuxQ
11:44 GitHub16 [mojo/master] improved performance by removing partial legacy HTTP 0.9 support - Sebastian Riedel
11:44 GitHub16 [mojo/master] better message examples - Sebastian Riedel
11:44 GitHub16 [mojo/master] show which objects can be stringified - Sebastian Riedel
11:44 GitHub16 left #mojo
11:48 sri i think there may be a few more small optimizations that can be made now
11:49 sri and boooo! for the ab shipping with mountain lion... it's once again broken
11:51 sri oh, and please test master!
11:51 sri i've almost certainly created new bugs :)
11:55 diegok tm: just name your routes and pass that name to form_for()
11:55 diegok HTTP pre 1.0 is so 90's, thanks for this removal! :-p
11:59 Britzel joined #mojo
12:01 sri HTTP 1.0 is 90s too ;p
12:02 sri in fact even HTTP 1.1 is from the 90s :o
12:02 sri 1999 to be specific
12:02 diegok sri: sure, but pre 1.0 is more 90's :-p
12:02 diegok http is so 90's :p
12:02 stephanj https://github.com/kraih/mojo/blob/​08e74f0c036e036b0fddfe8a61b6d68035c​f2d9d/lib/Mojo/ByteStream.pm#L299 @ sri
12:03 stephanj is that intended? the double assignment & declaration of $string?
12:04 sri of course, that's just the calling convention
12:05 stephanj and nvm its inside of pod
12:05 stephanj https://github.com/kraih/mojo/bl​ob/master/lib/Mojo/Cookie.pm#L95 i missed that its inside pod and just showing both possible variants
12:06 stephanj just ignore me
12:13 sri https://github.com/kraih/mojo/issues/363 # maybe i'm missing something
12:14 marcus hay
12:15 marcus sri: it does seem like it's a bug report?
12:15 marcus sri: bad test case example tho.
12:15 sri marcus: does it?
12:16 marcus sri: ask for a broken unit test.
12:16 marcus sri: the report is that ! followed by a wide character is broken?
12:16 marcus in query params.
12:16 sri sorry, but i don't have the patience
12:17 marcus I'll reply
12:17 * sri just assumes all shrug reports are really support requests
12:25 sri hmm
12:26 sri wonder if there should be a method to get multiple values in Mojo::Parameters
12:27 sri my ($foo, $bar, $baz) = $req->params->slice(qw(foo bar baz))
12:38 jnap joined #mojo
12:44 tm diegok: thanks, will try this way :)
13:18 sri my ($foo, $bar, $baz) = $self->param([qw(foo bar baz)]);
13:18 sri maybe
13:19 sri $self->param(['foo']) could also force scalar context
13:34 crab sri: certainly remove 0.9 support
13:35 crab heh, shrug reports.
13:35 sri :)
13:43 CromeDome joined #mojo
13:44 vel joined #mojo
13:48 bc547 sri: a method to get multiple values at once in Mojo::Parameters would be nice :-)
13:49 sri Mojo::Parameters might not be convenient enough
13:49 sri the array thingy was for Mojolicious::Controller->param
13:51 bc547 sri: i just repeated what you said :-)
13:55 xaka1 joined #mojo
14:08 inokenty joined #mojo
14:17 sri hmm
14:18 sri $self->param(['foo']) works pretty well in my tests
14:18 sri it's just one additional line of code to make it work
14:20 tm diegok: thanks, it worked :)
14:21 sri but how do i explain the difference to $self->param('foo')? :S
14:23 tm you don't, there's non... it is special case of $self->param(['foo']) ;-)
14:24 sri but the difference is important
14:25 sri $self->param(['foo']) is *a lot* more secure
14:26 tm more secure? because it requests exactly one element array? pls explain
14:26 sri the fact that i have to explain it scares me :(
14:26 * tm is newbie
14:27 sri http://mojolicio.us/perldoc/​Mojolicious/Controller#param
14:27 tm tnx :)
14:28 mire joined #mojo
14:28 tm you mean the scalar context?
14:28 sri yes
14:29 tm yup, now I get it, no ambiguity
14:36 ryozi joined #mojo
14:38 nic sri: Are you thinking of forcing scalar context for the single case or whenever passed an arrayref?
14:39 nic Doing it always would be safe and consistent and easy to remember/understand
14:39 nic but I'm guessing the implementation would be less efficient
14:40 sri i would do it in a heartbeat, but can't break backwards compatibility
14:40 sri so i'm doing the next best thing and add something even more useful
14:40 sri (multi name support)
14:41 sri which just so happens to solve the context problems as well
14:41 sri :)
14:43 nic asking a different way, will passing an arrayref ensure safety, even when its size is >1?
14:43 nic (wasn't clear if you were talking about only the =1 case)
14:44 sri the number of values is always equivalent to the number of names
14:45 nic indeed
14:45 * nic looks to the judge and notes the witness avoids answering the question
14:45 Foxcool joined #mojo
14:45 GitHub138 joined #mojo
14:45 GitHub138 [mojo] kraih pushed 1 new commit to master: http://git.io/0H3yTg
14:45 GitHub138 [mojo/master] added multi name support to param method in Mojolicious::Controller - Sebastian Riedel
14:45 GitHub138 left #mojo
14:46 nic Will ($a, $b) = $self->param(['moo', 'foo']) be safe?
14:46 sri the example originally said my @values = $c->param(['foo', 'bar']);, but your question made me change it to my ($foo, $bar) = $c->param(['foo', 'bar']); :)
14:48 * nic assumes that's a 'yes' and writes it into the contract
14:49 nic That's going to be handy
14:49 GitHub57 joined #mojo
14:49 GitHub57 [mojo] kraih pushed 1 new commit to master: http://git.io/PZBytQ
14:49 GitHub57 [mojo/master] better multi name tests - Sebastian Riedel
14:49 GitHub57 left #mojo
14:49 sri and now it's tested
14:51 sri http://mojolicio.us/perldoc/​Mojolicious/Controller#param
14:52 sri hope the new examples don't make it look too heavy and bring the point across
14:52 sri just showing the multi name form as an alternative might help with that
14:54 sri marcus, tempire, crab: more to review for you!
14:54 Grauwolf how do i get the userinfo data with mojolicious::lite?
14:56 inokenty Grauwolf: $self->req->headers->user_agent
14:56 gryphon joined #mojo
14:58 Grauwolf inokenty, no not the useragent. i want the userinfo (basic auth) stuff
15:00 Grauwolf i thought it would be something like $self->req->url->userinfo; but it isn't
15:00 sri add a ->to_abs
15:01 Grauwolf ah got it $self->req->url->base->userinfo;
15:01 Grauwolf sri, huh?
15:01 sri $self->req->url->to_abs->userinfo
15:02 Grauwolf sri, ah thanks. works to :)
15:02 Grauwolf *too
15:02 sri it may be in the base part or it may not, you can't know that
15:02 sri only way to make sure is to_abs
15:04 Grauwolf ok. [F!thanks
15:08 d4rkie joined #mojo
15:20 GitHub173 joined #mojo
15:20 GitHub173 [mojo] kraih pushed 1 new commit to master: http://git.io/No2VlQ
15:20 GitHub173 [mojo/master] added multi name example - Sebastian Riedel
15:20 GitHub173 left #mojo
15:21 tm is there any ready made plugin for making hostname cannonical? for example I want make it always redirect from www.domain.tld to domain.tld w/o www at front, so I can write plugin/hook, at least that's what comes to my mind now :D any better ways to do it?
15:23 sri if it's a plugin a hook shouldn't be necessary
15:23 tm could do as before_dispatch hook and work on $self->req->url->base, if needed rewrite and redirect
15:24 sri plugin CanonicalHost => {host => 'foo.tld', mode => 'production'};
15:24 sri (no it does not exist ;p)
15:24 tm argh :) ok
15:25 tm as an exercise I may write it :)
15:25 sri and release it i hope
15:25 tm will ping your way if that's ok :)
15:27 crab i just do it in nginx
15:27 tm I want to deploy without any webserver up front, unless I see clear advantage of doing so which is not the case for the moment
15:28 tm hypnotoad is the idea for now and static content on other servers, behind nginx/lighttpd so I don't serve static from application
15:36 asarch joined #mojo
15:37 crab hm. i wonder how many people run hypnotoad as a frontend server like that.
15:38 tm I have no clue, I'm not sure if it's worth it to be fair but I just don't see the reason why I would like to run nginx/other... I'd prefer to run haproxy in front of cluster :)
15:39 sri i would always recommend a reverse proxy
15:40 tm what is the benefit? proxy cache or masking eventual technical issues?
15:41 sri nginx is just so much better when you're being attacked or encounter awkward user agents
15:41 sri hypnotoad is not bad, but at the end of the day it is optimized to be an app server
15:42 tm that's exactly why all static content will reside on other, static-content only hosts
15:42 tm ok, not in beta, but in production yes, definitely
15:43 D4RK-PH0ENiX joined #mojo
15:50 Mad_Dud hi tm
15:54 tm hi Dud :)
16:26 pau4o left #mojo
16:30 migo joined #mojo
16:45 GabrielVieira joined #mojo
17:06 * sri releases 3.13
17:10 * njlg cheers
17:15 sri \o/
17:17 dbr joined #mojo
17:21 asarch joined #mojo
17:25 mire joined #mojo
17:27 marcus DONALD release
17:27 marcus next one will be PI
17:29 tempire damn.  2.71 release could have been the e release
17:29 tempire missed it :(
17:30 tempire http://media.comicvine.com/upl​oads/0/77/516517-313_large.gif
17:31 njlg =)
17:31 sri :D
18:05 jwang joined #mojo
18:09 rem_lex|pivo joined #mojo
18:10 tempire oh oh oh oh!
18:10 tempire mojolicious makes you pi!
18:10 tempire it's irrationally fun
18:11 tempire the rainbow goes on forever
18:16 Britzel joined #mojo
18:23 netfeed joined #mojo
18:24 netfeed is there any best practices to setup a mojo env for both dev and live?
18:32 vel joined #mojo
19:06 marty joined #mojo
19:14 jm4 joined #mojo
19:42 andrefs joined #mojo
20:25 xaka1 joined #mojo
21:06 chansen joined #mojo
21:24 dwierenga joined #mojo
21:28 andrefs joined #mojo
21:49 lukep joined #mojo
22:58 andrefs joined #mojo
23:04 andrefs joined #mojo
23:20 andrefs joined #mojo

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