Camelia, the Perl 6 bug

IRC log for #mojo, 2012-11-25

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

All times shown according to UTC.

Time Nick Message
00:29 yakubori joined #mojo
00:31 * yakubori waves
00:34 memowe joined #mojo
00:41 gryphon joined #mojo
00:51 sinkovsky joined #mojo
00:59 memowe_ joined #mojo
01:01 yakubori man, i've been dealing with crappy legacy perl for so long, i had no idea how much awesome has been added to it.
01:11 good_news_everyone joined #mojo
01:11 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UcWmfQ
01:11 good_news_everyone mojo/master 9dc12cd Sebastian Riedel: fixed Mojo::URL documentation
01:11 good_news_everyone left #mojo
01:17 Mike-PerlRecruiter_ joined #mojo
01:25 d4rkie joined #mojo
01:30 good_news_everyone joined #mojo
01:30 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/48ZZ_g
01:30 good_news_everyone mojo/master a42ea5e Sebastian Riedel: small user agent tweaks
01:30 good_news_everyone left #mojo
01:55 sinkovsky joined #mojo
01:56 memowe joined #mojo
01:57 dvinciguerra joined #mojo
02:05 good_news_everyone joined #mojo
02:05 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ERKcYw
02:05 good_news_everyone mojo/master 02d13be Sebastian Riedel: mention that encoding/decoding can be disabled
02:05 good_news_everyone left #mojo
02:34 bpmedley joined #mojo
02:56 sinkovsky joined #mojo
03:00 duncanthrax joined #mojo
03:16 noganex_ joined #mojo
03:17 memowe joined #mojo
03:32 Miked joined #mojo
03:35 good_news_everyone joined #mojo
03:35 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ifNjkw
03:35 good_news_everyone mojo/master 9fce95f Sebastian Riedel: fixed clone bugs in Mojo::URL
03:35 good_news_everyone left #mojo
03:38 rem_lex|pivo joined #mojo
03:39 dabudabu joined #mojo
03:46 good_news_everyone joined #mojo
03:46 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ICXq-g
03:46 good_news_everyone mojo/master 7761eaa Sebastian Riedel: small optimization
03:46 good_news_everyone left #mojo
03:53 xaka joined #mojo
03:56 sinkovsky joined #mojo
04:10 d4rkie joined #mojo
04:16 good_news_everyone joined #mojo
04:16 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/mnXuNA
04:16 good_news_everyone mojo/master 58d9d71 Sebastian Riedel: more Mojo::URL tests
04:16 good_news_everyone left #mojo
04:18 Mithaldu nachtcoding++
04:18 asarch joined #mojo
04:57 sinkovsky joined #mojo
04:59 panaggio joined #mojo
05:01 panaggio I'm using this code as a demo, to get what's going wrong with Mojolicious::Lite and my app http://pastebin.com/diWtM37u
05:01 panaggio feels like the app is doing ok, from the logs (I've spent several hours debuging it till I was sure the bug was on my Perl code)
05:05 panaggio I'm sending a json to /auth, but it won't be on params. But that seems expected. I've found somethere that I should use req->json
05:05 panaggio but I've tested it too and I'll keep getting 204-empty response
05:05 panaggio any ideas?
05:16 dvinciguerra_ joined #mojo
05:20 dvinciguerra__ joined #mojo
05:24 dvinciguerra joined #mojo
05:27 dvinciguerra_ joined #mojo
05:31 dvinciguerra__ joined #mojo
05:36 dvinciguerra joined #mojo
05:40 dvinciguerra_ joined #mojo
05:46 dvinciguerra__ joined #mojo
05:51 dvinciguerra joined #mojo
05:54 dvinciguerra_ joined #mojo
05:57 Foxcool joined #mojo
05:57 dvinciguerra__ joined #mojo
06:02 dvinciguerra joined #mojo
06:05 dvinciguerra_ joined #mojo
06:09 dvinciguerra__ joined #mojo
06:14 dvinciguerra joined #mojo
06:17 dvinciguerra_ joined #mojo
06:20 dvinciguerra__ joined #mojo
06:25 dvinciguerra joined #mojo
06:29 dvinciguerra_ joined #mojo
06:30 sinkovsky joined #mojo
06:34 dvinciguerra__ joined #mojo
06:39 dvinciguerra joined #mojo
06:45 dvinciguerra_ joined #mojo
06:47 dvinciguerra__ joined #mojo
06:52 dvinciguerra joined #mojo
06:55 dvinciguerra_ joined #mojo
07:01 dvinciguerra__ joined #mojo
07:10 lukep joined #mojo
07:32 Vandal joined #mojo
08:05 good_news_everyone joined #mojo
08:05 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/NElulw
08:05 good_news_everyone mojo/master c9f0b6c Sebastian Riedel: even more Mojo::URL tests
08:05 good_news_everyone left #mojo
08:07 * sri is a little unhappy about the performance regression in 3.61
08:09 sri the biggest hit might be from using Encode::decode instead of utf8::decode
08:10 sri perhaps bringing back a cache for encoding objects could improve that
08:10 sinkovsky joined #mojo
08:16 good_news_everyone joined #mojo
08:16 good_news_everyone [mojo] kraih created encoding_cache (+1 new commit): http://git.io/iHUvow
08:16 good_news_everyone mojo/encoding_cache 158366e Sebastian Riedel: improve encoding performance with a cache
08:16 good_news_everyone left #mojo
08:18 sri not sure if it's a good idea
08:43 sh4 joined #mojo
09:06 jwang joined #mojo
09:20 d4rkie joined #mojo
09:35 sinkovsky joined #mojo
09:44 good_news_everyone joined #mojo
09:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/bpG_5A
09:44 good_news_everyone mojo/master 84b1d53 Sebastian Riedel: fixed clone bugs in Mojo::URL
09:44 good_news_everyone left #mojo
09:45 Britzel_ joined #mojo
09:50 dbr joined #mojo
09:59 good_news_everyone joined #mojo
09:59 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/yTGwlg
09:59 good_news_everyone mojo/master 26ae8d0 Sebastian Riedel: better base URL tests
09:59 good_news_everyone left #mojo
10:00 SmokeMachine joined #mojo
10:02 sinkovsky joined #mojo
10:02 good_news_everyone joined #mojo
10:02 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/vvyCsw
10:02 good_news_everyone mojo/master 949ece5 Sebastian Riedel: fixed formatting
10:02 good_news_everyone left #mojo
10:03 jwang joined #mojo
10:07 jwang joined #mojo
10:21 bjoernfan_ joined #mojo
10:22 panaggio joined #mojo
10:28 yakubori joined #mojo
10:29 yakubori hello
10:30 yakubori i am trying perlbrew on the recommendation of the mojo site and want to test the initial Hello World with the ::LIte module, but Morbo.pm is not in my path. Should I simply have a 'use lib' line in my .pl file, or is there a better or more correct way to ensure Morbo.pm (under perlbrew) is in my path at all times? perhaps via export command? I am running the latest OS X...
10:41 mfontani have you switched to the perlbrewed perl, and installed Mojolicious in that new perlbrewed environment, and are you using the perlbrewed perl to call the ::lite module?
10:41 yakubori ah -- i didn't do a perlbrew switch before mojo install
10:41 yakubori it works now
10:41 yakubori this is nice!
10:42 yakubori @mfontani: that was it, exactly. thanks!
10:49 mfontani no problem
10:55 bjoernfan Can you add custom commands to lite apps..? (Or am I missing something obvious?)
10:56 jwang joined #mojo
11:02 sinkovsky joined #mojo
11:04 jwang joined #mojo
11:15 jwang joined #mojo
11:18 dotan joined #mojo
11:19 yakubori @bjoernfan: as in, './myapp.pl mycommand' ?
11:20 yakubori if so, check this out: http://mojolicio.us/perldoc/Mojolicious
11:20 yakubori there's a 'commands' section
11:20 jwang joined #mojo
11:33 sh4 joined #mojo
11:34 alexeiras joined #mojo
11:36 yakubori joined #mojo
11:51 jwang joined #mojo
12:01 jwang joined #mojo
12:06 jwang joined #mojo
12:22 yakubori with regards to rendering templates, is 'template => pate/to/some/templatefile' valid?
12:22 yakubori s/pate/path/
12:26 jwang joined #mojo
12:50 jwang joined #mojo
13:04 jwang joined #mojo
13:05 jwang joined #mojo
13:09 kitt_vl joined #mojo
13:17 Mike-PerlRecruiter_ joined #mojo
13:22 yakubori joined #mojo
13:26 jwang joined #mojo
13:51 jwang joined #mojo
13:57 jwang joined #mojo
14:14 yakubori joined #mojo
14:15 panaggio My Accept and Content-Type headers are ok AFAICS: Accept: application/json, Content-Type: application/json; charset=UTF-8
14:16 panaggio but I can't get data from $self->render(json => { hello => 'world' })
14:16 panaggio response is always empty =(
14:28 mfontani perl -e'use Mojolicious::Lite; get "/" => sub { return $_[0]->render( json => {hello => "world"} ) }; app->start' daemon
14:33 panaggio mfontani: the same should work for s/get/post, right?
14:38 mfontani change get to post, test via curl -vX POST http://127.0.0.1:3000/
14:43 yakubori joined #mojo
14:44 panaggio mfontani: ok, so, curling it, we data come, but on the browser, via ajax, it won't
14:45 panaggio I can get the proper status code using both render and respond_to, but can't get any data
14:47 sinkovsky joined #mojo
14:52 panaggio http://pastebin.com/ZGMS8etW
14:52 panaggio my request's headers and data
14:52 panaggio can't see what's wrong mfontani
14:54 jnbek joined #mojo
15:01 mfontani I've a spotty connection as I'm on a train - no idea as I don't have the server- and client- side code which are generating that communication
15:01 mfontani I'd suggest you try starting with the simplest thing you can use for both, and start from there
15:04 panaggio mfontani: I'm on that path. But I do need CORS. I have pastebins with both codes, I'll post them here again
15:05 panaggio And sorry for botthering you on while traveling =/
15:06 mfontani so you're debugging cross-origin resource sharing rather than the simple ajax request?
15:16 panaggio mfontani: yes, but no. I mean, I'm almost sure that CORS is working
15:18 mfontani start from using the same domain then, make sure it works - at which point it's not your code at fault but it's CORS
15:18 mfontani then, and only then - debug CORS
15:21 gryphon joined #mojo
15:22 panaggio http://stackoverflow.com/questions/1​3552337/always-get-empty-response-fr​om-mojoliciouslite-via-jquery-ajax
15:23 panaggio All the code are on this SO question
15:23 bjoernfan yakubori: Yeah, I have commands for a full app, but I'm not sure of how to do it for lite apps
15:23 yakubori ah, i see. sorry
15:24 bjoernfan Maybe you can have multiple namespaces in the same file... a part of Perl I'm not sure about...
15:25 mfontani package foo; package bar; package main;
15:25 sinkovsky joined #mojo
15:28 mfontani panaggio: I'd look at your JS & firebug to see what' wrong there, if curling it works
15:32 yakubori if i stash something, e.g. $self->stash(username => 'foobert'), should i not expect to be able to access it in a template via $username?
15:33 yakubori @bjoernfan, ya you can. i personally haven't done it though
15:33 bjoernfan Let's see if I figure it out!
15:47 marcus sri: I like the charset solutions
15:47 marcus -s
15:47 panaggio mfontani: you're right: It's still a cors issue
15:53 dpetrov_ joined #mojo
15:57 yakubori any recommendations for properly using external template files? i would like to avoid the __DATA__ approach if possible
15:57 yakubori trying to find some good documentation
15:58 mjy http://mojolicio.us/perldoc/Mojo​licious/Lite#External_templates ?
15:59 yakubori ya, but looking for more than that. e.g. using stash values, conditionals, etc.
16:00 mjy you mean the syntax for templates? should be the same imho ...
16:00 marcus yakubori: that works exactly the same for external and internal templaes
16:00 mjy http://mojolicio.us/perldoc/​Mojolicious/Guides/Rendering
16:00 marcus yakubori: I recommend reading the rendering guide.
16:00 yakubori i'd like to run something like, %if ( $username ) { % <p> <%= $username %> </p> % } else { % <p>no user % } %
16:00 marcus which mjy linked to :)
16:01 marcus yakubori: unfortunately you can't just make up syntax ;-)
16:01 bjoernfan mfontani: Thanks, got it. :)
16:01 yakubori if i stash username, i get a scope error
16:02 marcus yakubori: anything in stash should be exposed as scalars to .ep templates.
16:02 yakubori @marcus, i was going based on what i saw for while/for loops, but it's apparently not correct
16:03 yakubori can you not do if/else blocks?
16:03 yakubori with the default templating?
16:03 yakubori oh crap, i think i see what i did
16:03 mjy % ... % is wrong if you put it on the same line ... the syntax is %  ... perl code if you use the whole line for perl code, or <% perl code %>
16:04 alexeiras joined #mojo
16:06 yakubori ya, i just saw that
16:06 yakubori thanks
16:06 mjy pays off to read the available documentation, it's good
16:06 yakubori it looks like it's working
16:07 yakubori i am reading it, but i got confused due to my years with TT ;)
16:07 mjy TT is terrible
16:09 d4rkie joined #mojo
16:10 yakubori eh, it's good for what it solved a few years back. but i'm finding it hard to argue with this template system (other than currently being a donk)
16:10 mjy I haven't seen a single TT template in our projects that didn't end up as unreadable spaghetti that would have been more readable as plain perl code ... :/
16:31 mire joined #mojo
16:32 d4rkie joined #mojo
16:33 mfontani back from !train
16:34 b2b joined #mojo
16:41 * b2b waves a casual hi to everyone
16:45 yakubori joined #mojo
17:08 sri marcus: i wouldn't say "like", but at least it's consistent with Mojo::Parameters :)
17:16 panaggio mfontani: a guy on #jquery said me that the issue can only be on the server. Now I'm really lost =(
17:17 asarch joined #mojo
17:20 marcus sri: at least it allows people to work around the problem without breaking backwards compat.
17:33 good_news_everyone joined #mojo
17:33 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ZXZwzQ
17:33 good_news_everyone mojo/master 95e5709 Sebastian Riedel: improved compatibility with IO::Socket::SSL 1.79
17:33 good_news_everyone left #mojo
17:41 kmx joined #mojo
17:42 alexeiras joined #mojo
17:44 mattastrophe joined #mojo
17:47 dabudabu joined #mojo
17:53 sh4 joined #mojo
17:56 yakubori joined #mojo
18:21 Britzel joined #mojo
18:35 panaggio http://stackoverflow.com/questions/13​552337/cors-always-get-empty-response​-from-mojoliciouslite-via-jquery-ajax
18:35 panaggio I've been on this issue almost 24 hours nonstop now
18:35 panaggio (
18:35 panaggio =(
18:46 yakubori panaggio: without being an experienced mojo user, and not yet aware of a config that might help you, what you're trying to do seems more like a web services kind of thing to me
18:47 panaggio yakubori: in which sense of web service? People use it for too many meanings =/
18:47 yakubori most frameworks i've seen tend to want to restrict ajax interaction to their own domain
18:48 panaggio I'm trying to create a RESTful API for a mobile app
18:48 panaggio I've created APIs like that for the same purpose dozens of times, using Ruby, JS, ...
18:49 panaggio I've chosen Mojolicious::Lite because it seems very similar to Sinatra (and it really is)
18:49 panaggio But it can't get the bug. The headers all seem to be right =(
18:49 sinkovsky joined #mojo
18:52 yakubori what you're trying to do, does it require ajax()?
18:53 yakubori or could you expose the bits you want and return json data in all cases?
18:53 yakubori e.g. /mobile/* always gives you the data in the structure you want
18:54 yakubori a csrf token, if it's in place, is going to prevent external requests from being processed, iirc
18:54 yakubori *csrf token requirement
18:55 yakubori by web services, i meant like Apache Axis, wsdl, soap, etc.
18:58 panaggio yakubori: still don't get it. I have a mobile web app and need to load data assync-ly. So, it ajax or nothing isn't it?
18:59 yakubori ya, nm
19:01 yakubori not a web services requirement in any case
19:05 yakubori i haven't yet hit the csrf bits (if any) in mojo
19:06 yakubori still going through intro documentation myself
19:17 yakubori OT: ./myapp.pl inflate <- that's a nice touch
19:32 sinkovsky joined #mojo
19:39 yakubori panaggio, is it because you don't have the headers in the response for /path?
19:40 yakubori is that two separate requests in our SO, OPTIONS and POST?
19:40 yakubori s/ our/ your/
19:42 panaggio yakubori: you mean I don't have the CSRF header on the response?
19:42 yakubori right, those headers aren't in the post /path sub {}
19:42 yakubori does that matter?
19:42 yakubori looks like they go out on the options method, but not post
19:43 panaggio Content-Type is there
19:43 panaggio and it's all that matters IFAICS
19:43 panaggio Am I wrong?
19:44 yakubori Access-Control-Allow-Origin <- how does this get sent in the response on the post handler?
19:45 yakubori same question for all the Access-Control-Allow* headers
19:47 yakubori is the wild card for the options handler supposed to supply those headers for all requests?
19:48 yakubori only asking because, in your SO, the response for the post doesn't have them.
19:49 asarch joined #mojo
19:50 sergeysinkovsky joined #mojo
19:52 yakubori let me know if that's it, panaggio. you've got me interested in this topic now :P
19:54 panaggio yakubori: Access-Control-Allow-Origin is there to tell the browser it can allow request from that origin
19:54 panaggio Origin is there, on all requests
19:54 panaggio Access-Control-Allow-Credentials tell the browser that it can send credentials along with the request
19:55 panaggio the wild card is there to tell Mojo take any OPTIONS request should be treated by that same subroutine
19:56 panaggio Access-Control-Allow-Methods tell the browser it can sed those different methods to that specific route (the one * matches on OPTIONS
19:57 yakubori right, so how do those headers go out on the post 'path/' handler, is that automatic because of the handler you define for options '*'?
19:57 panaggio to be more precise, it allows every request from that origin, but it may ask for any route that requires preflight
19:59 panaggio yakubori: all headers are generated by Mojo. I've asked a json and rendered one, so Mojo itself adds Content-Type
19:59 yakubori more specifically, why do you not need the $self->res->headers->header('A​ccess-Control-Allow-Origin'=> 'http://localhost:7000'); line in the post '/path' sub?
20:01 panaggio yakubori: (not intending to be stupid and something like that, just to know from where should I start explaining) have you ever read the docs on CORS? Do you know how it works (or should work)?
20:03 yakubori a little -- it seems like the Origin header needs to be set on a response somewhere, I just didn't see that on the post handler on your SO question
20:05 panaggio yakubori: you're right, the header should be there. But it's set automatically. Maybe I forgot to copy that line or removed it accidentally =/
20:07 yakubori so, you've added it to the post hander, and it still does not work?
20:07 yakubori or, are you saying it's configured elsewhere?
20:09 panaggio it's added by Mojo
20:11 panaggio sorry, now I got it
20:11 panaggio there's no need to put Origin in the headers of a respose
20:11 yakubori you confuse me, sir… :P
20:11 panaggio the Origin header comes on the POST request
20:11 panaggio what the response of OPTIONS tells the browser is that it's ok t send requests from that Origin
20:12 yakubori i'll have to try this out once i've got a test env to give it a shot
20:13 Kulag joined #mojo
20:13 yakubori ok -- so, the options handler is what should provide that functionality?
20:19 yakubori http://enable-cors.org/ <- was looking at that, panaggio, which mentioned setting the header. but, if there's a global way to do this, then that seems ideal.
20:19 panaggio the options handler is there to recieve the OPTIONS http request and give the browser permission to do some request
20:25 mjy panaggio: if you only need web browsers as clients, why don't you save yourself the headache and use JSONP?
20:25 panaggio mjy: I'm developing mobile web apps, using phonegap
20:26 panaggio apps for android and iphone and stuff but using web technologies
20:27 mjy I don't understand, if it relies on ajax, it has to use a web browser and js internally anyway?
20:28 panaggio oh man, you said JSONP :( I'm overnight on this, I'm getting slow. sorry
20:29 yakubori mjy, i don't think phonegap-developed apps restrict you to that.
20:30 panaggio yeah, maybe it could be done with jsonp. But it has it's issues. CORS is the most secure way to do that
20:33 lukep joined #mojo
20:45 mjy panaggio: I think you need to send "Access-Control-Allow-Origin: http://localhost:7000" also in the POST response headers
20:46 yakubori that's what i thought as well
20:47 yakubori or in a shared function like a prerun or something
20:47 yakubori thought it looks like you can do server configs in some cases
20:47 yakubori s/thought/though/
20:56 alexeiras joined #mojo
21:10 gryphon joined #mojo
21:16 sinkovsky joined #mojo
21:17 good_news_everyone joined #mojo
21:17 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/A-WaXQ
21:17 good_news_everyone mojo/master cf0855f Sebastian Riedel: updated entities.pl example
21:17 good_news_everyone left #mojo
21:47 yakubori joined #mojo
22:34 jnbek joined #mojo
22:41 xaka joined #mojo
22:52 yakubori $r->any('/')->to('login#index') <- is an index() sub implied inside of a Login.pm controller in this case/
22:53 yakubori or, I guess, is it expected in that case?
22:55 gryphon joined #mojo
22:55 sri marcus: any thoughts on https://github.com/kraih/mojo/commit/15​8366efaf7a5fa90f6d2ee34cf468fcf50b73c3 ?
22:55 sri or tempire/crab?
22:56 marcus sri: seems fine to me.Are you worried it might cache too much?
22:56 sri naah, worried i might be missing something :)
22:56 sri i vaguely remember we had a cache once, but not why it was removed
22:57 sri it was during the perl 5.8.x time though
23:07 jzawodn joined #mojo
23:12 SmokeMachine joined #mojo
23:21 good_news_everyone joined #mojo
23:21 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/lRJGfg
23:21 good_news_everyone mojo/master ad9c717 Sebastian Riedel: improved encode/decode performance in Mojo::Util with a cache
23:21 good_news_everyone left #mojo
23:21 sri well, the gain seems to be significant
23:22 sri in my http stack micro benchmarks it's a difference of 100-200 rps for a test that runs at 3000 rps
23:23 sri same for our normal unit tests
23:24 b2b joined #mojo
23:25 yakubori joined #mojo
23:28 sri it's also a little more complexity, but i guess it's well worth it
23:31 jwang joined #mojo
23:36 yakubori nm -- took a look at the source for to() in Routes/Route.pm
23:37 wmarcus joined #mojo
23:37 wmarcus left #mojo
23:37 wmarcus joined #mojo
23:40 wmarcus joined #mojo
23:43 wmarcus joined #mojo
23:45 wmarcus joined #mojo
23:48 wmarcus joined #mojo
23:50 wmarcus joined #mojo
23:50 Averna joined #mojo
23:51 jwang joined #mojo
23:53 wmarcus joined #mojo
23:55 wmarcus joined #mojo
23:57 wmarcus joined #mojo
23:59 jwang joined #mojo

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