Camelia, the Perl 6 bug

IRC log for #mojo, 2012-08-21

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

All times shown according to UTC.

Time Nick Message
00:00 xaka should be ^^^
00:00 mire joined #mojo
00:00 bluescreen xaka, should be what?
00:00 xaka you need to re-assign $self _inside_ your anonymous sub { ... }, not _outside_
00:05 bluescreen I'm correcting and trying again
00:06 good_news_everyone joined #mojo
00:06 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/WiMdxg
00:06 good_news_everyone [mojo/master] small documentation tweak - Sebastian Riedel
00:06 good_news_everyone left #mojo
00:07 sri http://mojolicio.us/perldoc/Mojolicious#HELPERS
00:07 sri in case you're looking for the explanation
00:17 bluescreen ok, made it work thanks for your help guys
00:49 jeen joined #mojo
01:05 laouji joined #mojo
01:06 bird joined #mojo
01:08 Antisoche What is the proper strategy for accessing the session in an .ep ?  Should I $self->session->{var} or should I manage that in the controller and pass the value through the stash? It doesn't seem like the .ep gets session access except through $self, which feels a bit like cheating.
01:10 Antisoche sri: ps: Thanks for mentioning %die, but my problem was trying to understand how to access data. I find %die by regularly making typos  :)
01:50 scott joined #mojo
02:01 d4rkie joined #mojo
02:12 D4RK-PH0ENiX joined #mojo
02:16 jeen joined #mojo
02:17 zivester joined #mojo
02:48 noganex_ joined #mojo
03:06 xaka joined #mojo
03:42 davido joined #mojo
03:55 d4rkie joined #mojo
04:02 jeen joined #mojo
04:07 Leandr joined #mojo
04:37 jeen_ joined #mojo
04:45 l3l1p joined #mojo
05:10 Britzel_ joined #mojo
05:19 jeen joined #mojo
05:23 o_o joined #mojo
05:31 jeen joined #mojo
05:45 jeen joined #mojo
06:33 jwang joined #mojo
06:47 Vandal joined #mojo
07:00 davido joined #mojo
07:06 batman_ joined #mojo
07:30 ladnaV joined #mojo
07:53 ladnaV joined #mojo
07:54 marcus good morning.
07:54 purl For you maybe.
07:54 marcus wonder how I can change oauth2 to pass the invocant without breaking everything that already exists...
07:55 marcus Guess I would have to rename the method and deprecate the old one.
08:13 pau4o joined #mojo
08:19 Vandal joined #mojo
08:19 fhelmber_ joined #mojo
08:26 burk joined #mojo
08:26 [R] joined #mojo
08:26 cosimo joined #mojo
08:27 bjoernfan joined #mojo
08:31 jeen joined #mojo
08:33 batman_ marcus: want me to make an draft?
08:37 [R] joined #mojo
08:50 jamesw joined #mojo
08:54 Vandal joined #mojo
08:57 sri https://github.com/kraih/mojo/issues/374 # thoughts?
08:59 stephan48 what do the specs say to this? how should/must a agent react on broken charset headers?
09:01 sri we don't really follow the spec for html parsing
09:01 stephan48 ok
09:01 stephan48 then i would say if decoding doesnt work spit a warning and keep the stuff
09:02 marcus batman_: yes
09:03 batman ok
09:10 good_news_everyone joined #mojo
09:10 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/1mgxLw
09:10 good_news_everyone [mojo/master] made Mojo::DOM::HTML a little more resilient (closes #374) - Sebastian Riedel
09:10 good_news_everyone left #mojo
09:15 batman marcus: will push the patch after lunch *bbl*
09:34 sri batman: i think you have to use the normal daemon on dotcloud, not hypnotoad
09:52 kmx sri: thanks for your quick patch for the issue I have reported this morning, I have just one more question
09:54 kmx sri: would not it be a good idea to set "$self->charset(undef);" if we cannot decode with given charset name?
09:55 sri kmx: i guess, but i won't go there without tests
09:55 kmx I guess that $parser->charset is later also used in other parts of DOM code
09:55 kmx ok
09:56 sri i guess the current change could cause new problems later on, perhaps i should just undo the change for now
09:56 sri and wait until someone (you?) writes a few good tests
09:59 batman sri: why not hypnotoad?
09:59 sri batman: dotcloud has process monitoring, it may not work correctly with hypnotoad, but i'm just guessing
10:00 kmx sri: could you give me hint what existing test has a similar nature (simulating fake server where I can define server's http headers), I can try to prepare a test for "my" scenario
10:00 batman ok. i will try
10:00 batman if it doesn't work, i will make it work :)
10:01 sri kmx: none exist afaik
10:02 kmx sri: Ok I' try to get some inspiration from response.t
10:02 sri i don't think that's the right place
10:02 sri dom.t would be more appropriate
10:03 kmx sri: ok, but dom.t is parsing html passed as text (scalar)
10:04 kmx I think I need: 1/ create a crappy response; 2/ emulate the dom parsing from response's data
10:04 batman marcus: is callback required or not in oauth2?
10:04 batman looks like it is for async, but not for sync...
10:04 batman sorry. the other way around
10:04 kmx sri: so perhaps somehow mix dom.t + response.t
10:05 marcus batman: it's required for async but not for sync.
10:05 batman i don't get why
10:06 batman i think it should be $token = $self->get_token('facebook'); for sync :/
10:08 marcus yes, it is?
10:08 purl Oh no it isn't!
10:09 batman i think i broke something
10:09 batman *looking at the original*
10:09 sri kmx: no
10:10 batman i don't see it. looks like it's "callback" is required for both sync and async...
10:10 marcus batman: You're right, I checked now.
10:10 marcus that's kinda useless.
10:11 kmx sri: I am just looking at the very end of response.t and the last group of tests seem to be of similar nature
10:11 batman will look at it...
10:11 sri kmx: but that's not where this should be tested
10:13 sri kmx: http://hastebin.com/raw/xemakalegi
10:13 batman marcus: does get_token() return anything with the current code?
10:13 batman other than semi random value
10:15 kmx sri: thanks for hint
10:15 sri that's not really a hint but a finished test ;p
10:17 sri i'm just not sure anymore if we really should make that a feature
10:19 sri http://hastebin.com/raw/rewarobotu
10:19 sri that's the full patch
10:20 kmx sri: yes, that's it
10:21 sri marcus, tempire, crab: thoughts?
10:21 kmx sri: I know that it is kind of a ugly hack but crappy servers are out there
10:22 sri that's not really our problem
10:22 sri what's the use case anyway?
10:22 sri you get broken data most likely anyway
10:23 sri what's the gain for us?
10:24 sri unicode in perl is hard enough, this kinda adds randomness to the problem
10:24 kmx sri: in my case the server has returned "Charset=1250" which should be "Charset=windows-1250" the content itself is OK
10:24 sri so you do get broken data after the patch too
10:25 sri bytes where you would expect characters
10:25 kmx sri: for any way of saying "do no decoding" would be fine as I am looking just for some numbers in HTML
10:26 sri $dom->charset(undef)... done
10:29 kmx sri: after your initial patch I got $dom object but when later calling "$dom->find('p.prod.price');" I got Unknown encoding '1250' at ..... Mojo/Util.pm line 93
10:29 sri kmx: yes, i'm reverting that change
10:30 sri the big question is if handling the wrong charset case makes sense at all
10:30 sri which i'm not convinced of anymore
10:32 kmx sri: probably the better way can be to test validity of charset presented by server at some very early point and do not pass invalid value to dom creation at all (just my guess I do not know mojo internals enough)
10:33 sri kmx: please elaborate
10:34 kmx sri: I mean to use for example "Encode::find_encoding($chars​et_from_content_type_header)" before mojo sets its value to $dom->charset
10:34 Lucas1 joined #mojo
10:35 sri that's very very limited, doesn't even cover the case where the charset is valid but wrong
10:36 kmx sri: yes but providing that you at some places simply pass charset value to encode/decode functions it is IMHO worth making sure that the charset value is acceptable by perl's Encode
10:42 marcus batman: no.
10:43 marcus batman: you could easily update it to return the token, and add a deprecated warning insside the callback.
10:47 kmx sri: what about just adding a test via Encode::find_encoding into Mojo::Content::charset()?
10:51 sri kmx: no, many more parts of the code depend on that
10:51 batman marcus: https://github.com/jhthorsen/Mojol​icious-Plugin-OAuth2/commit/447cdf​b5031811f344aa45349a61ae4cce6f2cfa
10:52 batman $self->get_token(facebook => $delay->begin); <-- pretty slick?
10:54 sri kmx: imo the options are a) parse anyway and accept some broken information b) just don't parse and return an empty Mojo::DOM object c) die with an error message
10:55 kmx sri: unfortunately b) and c) will not help me too much
10:56 sri i tend towards b atm
10:59 kmx sri: I still think that ignoring invalid charset (treating as if no charset was specified) would be better - e.g. with this patch for Mojo::Content::charset http://pastebin.com/97LxZUBG
11:00 sri very much disagree about that
11:00 sri you completely ignore the cases that don't directly affect you atm
11:02 good_news_everyone joined #mojo
11:02 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/CN40sw
11:02 good_news_everyone [mojo/master] improved Mojo::DOM::HTML to sometimes recover from bad charset information - Sebastian Riedel
11:02 good_news_everyone left #mojo
11:02 kmx sri: it is just an attempt to do an early check for value (charset) that mojo later passes to Encode's encode/decode functions without any sanity check
11:03 sri i'm only committing this for further discussion, if marcus, tempire and crab don't give feedback it will just vanish again
11:03 sri kmx: yes, and imo it's useless
11:04 sri because we need to handle wrong charsets anyway, not just non-existing ones
11:07 sri in case nobody speaks up in favor of the current solution, we'll go with returning an empty Mojo::DOM object
11:07 sri because it's the most harmless solution
11:07 sri and can be changed later on if necessary
11:12 sri hmm
11:12 kmx sri: ok, a workaround which seems to work for me is using "$dom = Mojo::DOM->new($res->body);" instead of "$dom = $res->dom;"
11:12 kmx sri: anyway thanks for your time
11:13 arthas joined #mojo
11:13 sri the Mojo::DOM description says "It will even try to interpret broken XML...", so i guess not failing if the charset doesn't match would be acceptable
11:14 sri and could even be changed later on, since we basically make no guarantees whatsoever
11:18 Netfeed might be a stupid question, but what if there's a broken charset from the header, but a valid one in, say, a xml header?
11:18 Netfeed xml declaration*
11:18 sri we don't use those
11:18 Netfeed ok
11:18 sri you can only tell Mojo::DOM directly what charset to use
11:20 sri the question here is what should we do if the charset you give Mojo::DOM is wrong or doesn't exist
11:21 sri with the patch above we would just consider the input characters and let perl do the rest
11:23 sri it would be kinda in line with what browsers do if things go wrong
11:23 sri but... the problem here is perl
11:23 sri you basically end up not knowing if what you get is characters of bytes
11:23 sri that's a perl problem
11:24 batman left #mojo
11:30 sri btw. it seems browsers *default* to the locale encoding
11:30 sri in case no charset could be detected any other way
11:30 batman_ joined #mojo
11:50 jeen joined #mojo
11:54 rem_lex joined #mojo
12:36 keedi joined #mojo
13:01 pau4o joined #mojo
13:01 l3l1p joined #mojo
13:04 marcus recent mojolicious broke parallol
13:06 taryk joined #mojo
13:06 marcus seems like PSGI autodetection changed.
13:07 sri unlikely, but please have a look at the problem above!
13:08 marcus $p=Mojo::Server::PSGI->new; # we had to change this to new(app=>app)
13:08 sri that's correct
13:09 sri i've talked about that a lot in this channel back then
13:09 sri you should know -.-
13:09 sri Perl 5.17.3 broke the trick we used for detection
13:10 sri it wasn't a perl feature
13:25 arthas joined #mojo
13:28 spleenjack joined #mojo
13:28 good_news_everyone joined #mojo
13:28 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UBxbcg
13:28 good_news_everyone [mojo/master] improved performance of some Mojo::Util functions - Sebastian Riedel
13:28 good_news_everyone left #mojo
13:29 marcus I saw the thing about 5.17.3, but wasn't aware that detection was the feature that got affected.
13:32 baton8 joined #mojo
13:37 arthas joined #mojo
13:38 bluescreen joined #mojo
13:40 memowe joined #mojo
13:57 inokenty joined #mojo
14:07 batman is there a way i can add strict+warnings automatically to the "inside" of do() ?
14:16 good_news_everyone joined #mojo
14:16 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/5Oo-xA
14:16 good_news_everyone [mojo/master] small optimizations - Sebastian Riedel
14:16 good_news_everyone left #mojo
14:18 jeen joined #mojo
14:18 d4rkie joined #mojo
14:24 Leandr joined #mojo
14:27 rem_lex joined #mojo
14:46 arthas joined #mojo
14:53 gryphon joined #mojo
14:56 ryozi joined #mojo
14:59 espent joined #mojo
15:22 good_news_everyone joined #mojo
15:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Q1hQEg
15:22 good_news_everyone [mojo/master] improved Mojo::DOM::HTML to handle bad charsets more gracefully - Sebastian Riedel
15:22 good_news_everyone left #mojo
15:23 sri since there doesn't appear to be any interest in the alternatives
15:36 crab huh, scgi. i didn't realise anyone used it.
15:36 sri nobody does ;
15:37 sri umm ;p
15:41 xaka joined #mojo
15:50 osprey_ left #mojo
16:01 alester joined #mojo
16:08 daniel_ joined #mojo
16:11 marcus I thought dotcloud did use it
16:12 daniel_ hi.  i've been developing a mojo app on dotcloud, but i get 502 errors at times.  it's probably the same problem as https://groups.google.com/forum/?fromg​roups=#!topic/mojolicious/p-oY4jJUhvE  -- but i'm no web admin so i don't know what the fix is.  MOJO_PROXY=1? or MOJO_NO_TLS=1?
16:19 daniel_ hm http://irclog.perlgeek.de/mojo/2012-03-08
16:35 daniel_ ah problem is caused by bad "use ..." statement.
16:53 Britzel_ joined #mojo
16:57 pau4o left #mojo
17:14 sri https://github.com/textmate/textmate/issues/229 # another textmate issue to +1 :)
17:17 njlg can you +1 issues on github?
17:17 sri you just answer with "+1"
17:18 njlg good to know =)
17:18 sri it's a social convention, not a feature
17:18 batman_ joined #mojo
17:21 njlg yeah, I like it.
17:25 sri oh, my issue has already been closed :o
17:28 xaka heh, textmate issues are closed as quickly as mojo ones :)
17:28 sri it's the only way to keep the number of open issues low
17:28 xaka haha, true
17:28 xaka marketing stuff, right? :-P
17:30 sri actually not sure it has much marketing value anymore, mostly just a habit
17:32 mire joined #mojo
18:00 batman_ can't i do get('/foo', format => 'css'); ?
18:00 batman_ do i need to do route('/foo', format => 'css')->via('GET') ?
18:01 inokenty maybe [format => 'css'] ?
18:03 fhelmber_ joined #mojo
18:03 batman_ ah
18:03 jeen joined #mojo
18:40 xaka just wondering if it's good idea to build some king of IPC on top of mojo + websocket or i should go for something like zmq
18:40 xaka s/king/kind/
18:42 sri all hail the king
18:43 sri http://blogs.amctv.com/breaki​ng-bad/TWD-S5-Key-Art-796.jpg
18:46 xaka http://wamp.ws/spec looks cool (The WebSocket Application Messaging Protocol)
19:22 Coff joined #mojo
20:01 vel joined #mojo
20:04 kmx sri: FYI: ad charset issue - I found out that unless I access $res->dom Mojo does not execute DOM parsing, so I have completely avoided the use of $res->dom and handled DOM parsing from $res->body on my own (which allowed me not only to use $res->headers->content_type but also to detect charset from HTML's <meta ...> tags via HTML::Encoding::encoding_from_html_document).
20:05 sri oh, i assumed you knew about that already
20:06 kmx sri: I am still newbie as for the Mojo internals :)
20:15 bluescreen joined #mojo
20:20 xaka joined #mojo
20:31 good_news_everyone joined #mojo
20:31 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/IZIp2A
20:31 good_news_everyone [mojo/master] fixed custom template syntax example (closes #376) - Sebastian Riedel
20:31 good_news_everyone left #mojo
20:41 batman_ joined #mojo
21:25 davido joined #mojo
21:43 o_o joined #mojo
21:45 rem_lex|pivo joined #mojo
21:45 lukep joined #mojo
21:56 davido joined #mojo
21:57 gryphon joined #mojo
21:57 davido Looking at http://mojolicio.us/perldoc/Mojoli​cious/Plugin/TagHelpers#text_field How would I explicitly set a default?
21:59 davido (sorry, that should have been select_field)
22:03 davido I expected     %= select_field role => [ qw( one two three ), selected => $default ] to "dwim" ;)
22:51 batman_ joined #mojo
23:32 sri ooh, first ui change in TM2

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