Camelia, the Perl 6 bug

IRC log for #mojo, 2010-09-04

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

All times shown according to UTC.

Time Nick Message
01:06 stephen left #mojo
01:11 jawnsy left #mojo
01:20 jawnsy joined #mojo
01:22 ltriant joined #mojo
01:54 [1]awnstudio joined #mojo
02:13 [1]awnstudio is now known as awnstudio_
02:35 janus left #mojo
03:00 janus joined #mojo
03:19 Kulag joined #mojo
03:22 Kulag Is it possible to get Mojolicious to detect my controllers if they're under AppName::Controller:: instead of AppName::?
03:24 crab $r->namespace('AppName::Controller::');
03:25 crab er, just AppName::Controller, not with the trailing ::
03:28 Kulag Great, thanks.
03:28 Kulag I wonder where that's defined, though. I couldn't find that anywhere in the documentation.
03:30 crab read Guides/Routing.pod
04:01 sri use the guides luke
04:02 ltriant left #mojo
04:04 tholen42 joined #mojo
04:04 Kulag Heh, I did read the rendering guide and the MojoX::Routes pod, guess I missed the routing one.
04:05 tl left #mojo
06:28 Alias left #mojo
07:32 Kulag left #mojo
07:33 Kulag joined #mojo
08:23 perlite left #mojo
08:23 perlite joined #mojo
08:28 Kulag left #mojo
08:36 Kulag joined #mojo
08:42 Drossel joined #mojo
08:42 Kulag left #mojo
08:47 Kulag joined #mojo
08:48 Drossel left #mojo
08:53 Kulag left #mojo
08:58 Kulag joined #mojo
09:04 Kulag left #mojo
09:10 Kulag joined #mojo
09:21 Kulag left #mojo
09:23 Kulag joined #mojo
09:29 Kulag left #mojo
09:30 Kulag joined #mojo
09:37 spleenjack joined #mojo
09:47 Kulag left #mojo
09:47 Kulag joined #mojo
10:07 spleenjack left #mojo
10:08 spleenjack joined #mojo
10:08 janus sri: Routing.pod =~ s:backets:brackets: # http://nopaste.info/b71b8320ef.html
10:20 sri janus: no need to send patches for typos ;p
10:28 janus just a habit :)
10:28 sri a good one :)
10:30 ltriant joined #mojo
11:13 janus mhm, somehow the encoding of my data got lost between dbi and the browser
11:13 janus never had that with pg before
11:27 sri that sounds weird, the usual error is double encoding
11:34 janus looks like it but i fail to see where it happens
11:34 janus plain dbi query pushing results into the renderer
11:39 janus dump before render shows it correctly
11:42 janus app->renderer->encoding(undef);
11:42 janus does the trick
12:00 chansen_ left #mojo
12:00 chansen__ joined #mojo
12:02 janus is that expected behaviour? i obviously did not expect it :)
12:03 janus now added a check to bytestreams encode method but that breaks two json tests
12:03 janus return $self if $encoding =~ m/^UTF-?8$/i && utf8::is_utf8 $self->{bytestream}; # doesn't fly with json
12:04 DaTa encoding hell
12:04 janus shouldn't be with correctly encoded utf8 and in fact rarely is for me
12:05 DaTa i have encoding problems with my yamlconfig module too, currently it only works with yaml::tiny and yaml::xs
12:06 janus imho that hardest thing encoding-wise are webmailers ;)
12:06 janus they need to grok every broken bullshit out there... and perl does an exceptional good job at it
12:08 janus but i totally agree it's no fun when dealing with foreign data or wild conversions
12:10 DaTa janus: well, not foreign data is my problem, foreign apis is, the ony yaml module seems to expect encoded data as input and the other one seems to expect decoded data as input :)
12:11 janus i'm not that into yaml... but doesn't the spec has to say something about it too?
12:15 janus looks pretty much like decoded data wrt/ yaml 1.2 section 5.2. as the first four bytes are used to detect an encoding, imho doesn't make that much sense with encoded data
12:16 janus but then i could be reading the spec wrong, wouldn't have been the first time ;)
12:21 janus DaTa: they force the one or the other and don't let you choose?
12:56 ltriant left #mojo
12:56 ltriant joined #mojo
13:14 sri janus: don't ever use encoded data in templates
13:15 sri ->encoding(undef) is a very ugly hack
13:15 sri templates are perl characters, so you are supposed to pass it perl characters too
13:16 sri from the point of the template engine, what you are inserting is raw binary data without meaning
13:17 sri it's really annoying when people blame the renderer, while in fact they just don't understand perl unicode
13:18 sri (i've got this reported as a renderer bug way too many times...)
13:20 sri practically nothing in mojolicious wants bytes, just characters
13:23 janus hm
13:26 sri the whole topic is very complicated
13:26 janus the more its told to be so, sure
13:27 chansen__ left #mojo
13:28 janus not that i say it's easy... but it works in other places without a thought and is still correct
13:28 sri like?
13:29 sri and how?
13:30 janus the xslt test i did worked, now on to check tt
13:30 DaTa sri: the $encoded in Mojolicious::Plugin::JsonConfig::_read_config is actually $decoded or not?
13:31 chansen joined #mojo
13:32 sri DaTa: encoded in json i guess
13:32 DaTa yes that's true :)
13:32 sri and if it's json then it has to be utf-8/16/32 encoded too
13:32 sri otherwise it couldn't be json
13:33 sri so it is actually double encoded :)
13:33 sri janus: try a koi-8 template and insert utf-8 data
13:34 sri *boom*
13:34 janus i prefer the boom very much over mixed encodings
13:35 janus or i'm getting it all wrong now... still testing to be sure about the details
13:35 sri or try passing utf8 messages to your template
13:35 sri (perl characters)
13:36 sri concatenating those to bytes is fun too
13:36 sri ->render(message => '♥')
13:37 sri and DATA templates, which have the same encoding as the perl source file
13:37 sri this goes on and on
13:37 sri you just have to unify the data
13:38 sri for which perl charaters are the obvious choice
13:38 sri *+c
13:38 sri especially with legacy databases you often don't have a choice about mixed encoding
13:38 janus well, it's waaaaay easier to use the ->encoding(undef) hack than to decode _all_ data
13:39 sri maybe it works in your specific case, but it will bite at some point
13:39 sri some time you will pass a query/post param to the template and all explodes
13:39 janus it never has in quite a few years, but i'll continue to watch out anyways
13:40 sri perl often does the right thing by default, but it is unpredictable
13:42 sri template tags need to be bytes instead of characters
13:43 sri as long as your app is utf-8/ascii top to bottom you might be fine
13:45 janus interally definitely, outgoing/incoming encodings are therefor very important... as i don't want any encoding issues later on
13:46 sri we have lots of users with koi-8 and shift_jis, they would be screwed
13:47 sri also, perls internal charset is not guaranteed to stay utf-8
13:48 sri your code depends on it though, since you mix chars and bytes
13:49 sri i'm not sure why you insist on passing bytes to the template and not just enable automatic decoding in DBI
13:49 sri obviously the clean solution
14:08 spleenjack left #mojo
14:40 ltriant left #mojo
15:09 janus i don't even know DBI can do it... the only thing i do is to choose a dbi client encoding if i don't want utf8
15:09 janus (almost never)
15:16 spleenjack joined #mojo
15:23 janus well, as long as its only a question of the template engine there's enough choice :)
15:24 janus otherwise said, i haven't met another point in mojo yet where my practice doesn't work
15:26 sri bad practice that is ;p
15:27 janus and proud of it... established pretty well over more than ten years...
15:28 janus somehow i think its a misunderstanding... everyone will do it that way... just query dbi and pass it to the template
15:28 sri it only works for utf-8/ascii, exploiting perls internal character encoding
15:28 sri of course it is, people don't get the difference between bytes and characters
15:29 sri perl only knows what encoded utf-8 means by accident
15:30 janus in c i would completely agree and shut the hell up, because wide chars there aren't fun imho
15:30 sri length checks for multi byte characters will blow up though
15:30 sri and other character based operations that might happen inside the template
15:30 sri template helpers are entirely unpredictable
15:31 sri it really only works by accident
15:35 sri perldoc perlunicode has a list of stuff that works differently for bytes
15:35 sri well, you've been warned :)
15:57 janus i can read manuals like mad and yet don't see what you mean
16:02 janus i would expect i have to encode filehandle data for example unless already opened utf8
16:05 janus dbi is kind enough to do it by default in many cases, as are many other modules
16:08 janus for one thing i don't have to care about the encoding when working with string functions... character semantics and so on
16:12 janus i don't get it... what i think i see is that you're effectively enforcing byte semantics, right?
16:12 janus *in templates
16:14 janus to me the output encoding is what the internal chracter encoding should look like to the outside
16:16 janus implying character semantics seems like a natural thing to me as well as it seems to be for perl
16:16 janus at least on this level of abstraction where it
16:17 janus 's directly interfering with the user
16:18 sri janus: haha, thats exactly what we do, you are enforcing byte semantics
16:18 sri thats what i was saying the whole time
16:18 janus huh?
16:19 sri Mojo::Template is entirely character based
16:19 sri it wants perl characters, character semantics all the way
16:19 janus what you're saying, or at least what i understand is that using utf8 forces byte semantics...
16:19 sri encoded utf-8 does
16:19 sri decoded utf-8 *is* perl characters
16:20 sri encoded utf-8 *is* bytes
16:21 janus hm
16:22 DaTa well i've managed to understand that recently :) you read data from somewhere that is utf-8 encoded, so you have to decode it to get perl characters
16:22 sri exactly
16:23 DaTa if you want to write that to somewhere you have to encode them
16:23 sri unify all data to perl characters
16:23 sri the fact that perl characters are utf-8 internally is merely an implementation detail that should generally be ignored
16:24 sri janus: like i said before, it's rather complicated :)
16:25 janus ok, then i see being strict was a good thing
16:25 janus also i see the lucky comment :)
16:27 sri there is also no character flag, so you don't know for sure if a value is chars or bytes
16:28 janus except by inspection
16:28 janus (yeah, ugly)
16:29 sri nope
16:29 sri lets say some bytes can be interpreted as ascii but are in fact some exotic charset
16:34 sri most of the time this is rather harmless, but you don't know for sure if you are dealing with bytes or characters
16:34 janus argh, yes
16:34 sri ascii data doesn't get the utf8 flag internally
16:35 janus either the dbi manpage doesn't mention it or everthing outside the utf8 range is a pita
16:35 janus mhm
16:35 janus i see, i see
16:37 janus not sure to call it lucky then... not seeing issues because they just don't show up is annoying
16:38 janus like padding and alignment issues, just that different arches are different encodings... either you know it or hit it one day, most of the times pretty hard
16:39 sri we exploit utf8::is_utf8 in mojolicious a bit to prevent common char vs byte issues
16:40 sri maybe some day we'll just get a character flag
16:40 janus seen it, even exploited it myself as you've seen ;)
16:40 janus ah DBIx::Encoding to the rescue
16:41 sri i think DBI has an option
16:41 janus i don't see any
16:42 sri ah, seems to be DBD specific
16:42 sri my $dbh = DBI->connect($dsn, "root", "", { mysql_enable_utf8 => 1 });
16:43 sri pg_enable_utf8
16:43 sri for postgres
16:44 janus argh, searched everything but utf8 :>
16:44 sri it just turns on the utf8 flag, which is a very cheap operation
16:46 esskar_ joined #mojo
16:46 janus i thought the utf8 flag is on for valid character data... duh
16:47 janus oh my... thanks, saves me at least from trouble in the future (soft hit then ;))
16:47 sri :)
16:49 sri http://www.slideshare.net/Penfold/perl-and-unicode # these slides sum it up quite well
16:53 janus the option should be named *_decode_utf8_output imho
16:54 janus that would at make it clear(er) i think
16:55 janus (at least to me ;))
17:09 janus i still don't think it's complicated... only complex enough to warrant explicit mention of a few things
17:12 sri complicated enough that pretty much everybody gets it wrong at first :)
17:12 janus or second, or third, ....
17:12 janus :)
17:13 janus misleading terms and/or wording is to blame i say!
17:15 janus and unfortunately it's not even wrong
17:35 janus btw, Encode::HEBCI is a nice idea
17:51 awnstudio_ left #mojo
18:47 chansen left #mojo
19:02 sri hmm, the new safari auto completion is just as awful as itunes, wonder if apple is losing it
19:12 MojoGuest486 joined #mojo
19:12 MojoGuest486 From: http://news.ycombinator.com/item?id=1277067 (50 hits)
19:12 MojoGuest486 left #mojo
19:13 MojoGuest148 joined #mojo
19:13 MojoGuest148 From: http://twitter.com/justinvi​ncent/statuses/12550383961 (9 hits)
19:19 MojoGuest148 left #mojo
19:36 y0j joined #mojo
20:05 perlite left #mojo
20:07 perlite joined #mojo
20:54 GabrielVieira left #mojo
21:22 stephan48 times events in mojo? possible?
21:22 stephan48 like execute a function all 10secs?
21:23 stephan48 i plan to do a webinterface for a playlist deamon and want to make the loading of the metadata(playlists, titles) in the background
22:14 GabrielVieira joined #mojo
22:15 Outlaw joined #mojo
22:38 Outlaw left #mojo
22:39 stephan48 Sun Sep  5 00:39:25 2010 error Mojolicious:227 [16449]: Processing request failed: Unmatched ( in regex; marked by <-- HERE in m/^icons(test)(\Qtest\E)( <-- HERE /welcome.html\.(\w+)$/ at /usr/local/share/perl/5.10.0/MojoX/Renderer.pm line 243.
22:39 stephan48 is this "normal"?
22:40 stephan48 the "(test)(\Qtest\E)(" part is coming from the uri....
23:08 spleenjack left #mojo

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