Camelia, the Perl 6 bug

IRC log for #mojo, 2013-06-07

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

All times shown according to UTC.

Time Nick Message
05:24 ilbot2 joined #mojo
05:24 Topic for #mojo is now 🎩, indubitably | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
05:25 ilbot2 joined #mojo
05:25 Topic for #mojo is now 🎩, indubitably | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
05:31 mrphilov joined #mojo
05:35 sh4 joined #mojo
05:49 Britzel_ joined #mojo
05:57 basiliscos joined #mojo
05:59 ynonp joined #mojo
06:02 d4rkie joined #mojo
06:10 suy joined #mojo
06:13 mehltau joined #mojo
06:15 basiliscos joined #mojo
06:21 jnbek joined #mojo
06:40 Dandre hello
06:41 Dandre if I have a route: get '/foo' => {text =>'bar'} and if I do get /foo.json the response is of type json but the content is raw text. Is it intended?
06:47 Dandre get /foo?format=json  seems more consistent. The response is of type text/html. Not sure what should be the behaviour il this situation
06:47 Dandre anyone here?
06:56 dod joined #mojo
07:03 Dandre jberger: or sri ?
07:06 fhelmber_ joined #mojo
07:11 mattastrophe joined #mojo
07:17 dod joined #mojo
07:18 mehltau joined #mojo
07:20 Vandal joined #mojo
07:21 yakudza joined #mojo
07:28 mattastrophe joined #mojo
07:28 nicolaas joined #mojo
07:42 cosimo_ joined #mojo
07:49 cosimo_ joined #mojo
07:56 kwa Dandre: I'm not quite sure what you mean. If you don't respond_to json, or render json, it will just default to whatever format you're rendering.
07:56 kwa Putting .xml and .csv at the end of foo will render the same thing.
07:57 kwa Setting format=json format=xml in the query string will not magically change the formatting for you. It just lets respond_to know how it should represent the request.
07:59 Dandre get /foo.json will return the body as text but the format put in Content-Type header is said to be json
07:59 Dandre shouldn't it  be text ?
08:00 Dandre I don't understand why .json and format=json are handled differently
08:00 jzawodn joined #mojo
08:14 d4rkie joined #mojo
08:28 egopro joined #mojo
08:32 maxhq joined #mojo
08:55 egopro joined #mojo
09:00 mire joined #mojo
09:03 Dandre kwa: get /foo.json will return the body as text but the format put in Content-Type header is said to be json. Shouldn't Content-Type be text to match output?
09:07 kwa Dandre: You will probably need to set format in the stash to txt to get a constisent content-type. $self->render(txt => 'hi', format => 'txt');
09:09 kwa Don't think it's a bug because it's probably intended so you can render json yourself. $self->render(txt => myjson($obj), format => 'json');
09:14 Dandre ok
09:15 Dandre kwa: yesterday I had this question:
09:15 Dandre in Controler->respond_to, when fallback is reached, $stash->{format} is deleted. Why?
09:15 Dandre if it was kept, fallback renderer handler could have a chance to produce output accordingly to format
09:16 kwa Dandre: I'm not sure I understand your question. What's 'fallback'?
09:16 Dandre but if I remove the dlete $option->{format} the tests failed due to the issue we previously spoke about
09:17 Dandre if I put any => ... in the route, handled by Controler->respond_to
09:17 kwa Is it similar to: http://pastebin.com/CzqZGNYt ?
09:19 hotsnow joined #mojo
09:21 Dandre yes but with something like any => sub{ myhandler} wher my handler will output datas accordingly to format requested by the rest client
09:24 nic Dandre: Can you make a mini lite app + a test that demonstrates your problem?
09:24 kwa That was my next question. I'm not quite following you Dandre.
09:24 kwa :)
09:25 Dandre ok
09:26 nic Make it so the test looks for what you want (and fails)
09:27 nic Then either (a) during the process you discover a fix yourself or (b) we understand the problem and help or (c) your example isn't minimal enough
09:39 Dandre http://pastebin.fr/27651
09:40 Dandre I don't know how to write a test
09:42 kwa Dandre: Right, so you're saying that the renderer is falling through and returning at line #58?
09:43 Dandre What I am trying (basically) to do is:
09:43 Dandre I have a data structure that I want to render either as json or xml depending on format requested by the rest client. But I don't want to duplicate each route for each format as they are basically the same except the serializer. I haven't found how to do that
09:44 kwa You don't need to duplicate each route, that's what respond_to is for.
09:44 Dandre kwa: yes exactlye
09:45 kwa Dandre: instead of $options->{format}, have you tried $c->stash->{format}?
09:45 Dandre not sure. I'll try
09:46 denisboyun_ joined #mojo
09:50 Dandre I have a 404 Not Found response
09:52 Dandre sorry, checking
09:55 Dandre kwa: same result bur body doesn't show any format (first word). Previously it was set to html
09:57 kwa Dandre: Hmm, I wouldn't have expected anything to change if $c->stash->{format} didn't work?
10:01 Dandre I think that $c->stash->{format} isn't set and $options->{format} is set to default format
10:03 Dandre kwa: I think this is due to line 287 in Controler.pm
10:03 kwa I've come across problems when using respond_to in the past. In bridges the format wasn't set yet for the controller. As you're calling your render from the controller, I expect format is set accordingly. I'd inspect the options and stash in your renderer to see where it is. I don't know the official reason for this.
10:18 Dandre has I've understood, the main developpers are sri and jberger?
10:34 ver joined #mojo
10:51 hotsnow joined #mojo
11:24 kwa Dandre: http://search.cpan.org/~sri/Mojolicious-​4.12/lib/Mojolicious.pm#CORE_DEVELOPERS
11:29 DaTa woot, there is my name... but why? :)
11:35 libsysguy joined #mojo
11:35 libsysguy o/
11:52 ThePoster32 joined #mojo
11:52 ThePoster32 Want to take someone offline Friends, Game Servers, Website? Join iBooter ! ibooter.us | ibooter.info
11:52 ThePoster32 left #mojo
11:54 plu joined #mojo
11:56 ThePoster32 joined #mojo
11:56 ThePoster32 Want to take someone offline Friends, Game Servers, Website? Join iBooter ! ibooter.us | ibooter.info
11:56 ThePoster32 left #mojo
12:01 Adura joined #mojo
12:09 Dandre kwa: thanks
12:19 moltar joined #mojo
12:21 moltar joined #mojo
12:24 gtodd joined #mojo
12:27 Dandre jberger: Are you there?
12:28 btyler joined #mojo
12:34 marty o/
12:37 dod joined #mojo
12:37 mattastrophe joined #mojo
12:58 judofyr joined #mojo
12:59 judofyr sri marcus: I implemented a simple JSON builder (inspired by Jbuilder in Rails): https://github.com/judofyr/json-builder
12:59 judofyr thoughts?
13:00 judofyr you can still use TO_JSON, but I find this pattern useful when you have data from different sources
13:03 ThePoster62 joined #mojo
13:03 ThePoster62 Want to take someone offline Friends, Game Servers, Website? Join iBooter ! ibooter.us | ibooter.info
13:03 ThePoster62 http://ibooter.us || http://ibooter.info Join us !
13:03 ThePoster62 left #mojo
13:03 depesz joined #mojo
13:03 suy OMFG
13:03 suy I never saw that in IRC yet
13:04 libsysguy yeah that is annoying
13:04 judofyr saw what?
13:04 judofyr spammers?
13:04 libsysguy the spambot
13:04 depesz joined #mojo
13:12 asarch joined #mojo
13:17 bluescreen joined #mojo
13:31 gryphon joined #mojo
13:36 zivester joined #mojo
13:47 btyler joined #mojo
13:48 inokenty joined #mojo
13:52 dod1 joined #mojo
14:08 xaka joined #mojo
14:52 delias joined #mojo
14:56 * sri waves at the nsa o/
14:57 libsysguy they knew you were going to do that
15:12 sri judofyr: can't say i'm a big fan of the concept, but i'm sure it will be useful for some folks
15:12 judofyr sri: what do you prefer?
15:13 sri the old fashioned way
15:13 judofyr building a hash?
15:13 * sri nods
15:13 judofyr I think it becomes very messy when you add conditionals
15:14 judofyr { foo => 'bar', bar => 'baz' } is fine
15:14 Dandre where can I find production sites running under mojolocius?
15:15 sri $json->{visitor} = $self->calculate_visitors($message) if $self->current_user->is_admin;
15:28 libsysguy Dandre: https://github.com/kraih/mojo/wiki/Pro​jects-and-Companies-Using-Mojolicious
15:29 btyler joined #mojo
15:35 Dandre ok
15:36 nic http://theintern.io/ looks interesting
15:38 depesz joined #mojo
15:43 r0b3rt joined #mojo
15:56 delias joined #mojo
16:00 delias joined #mojo
16:16 basiliscos joined #mojo
16:34 russum1 joined #mojo
16:45 depesz joined #mojo
16:47 depesz joined #mojo
17:17 denisboyun_ joined #mojo
17:37 depesz joined #mojo
17:39 depesz joined #mojo
17:51 mattastrophe joined #mojo
18:19 btyler joined #mojo
18:28 rem_lex|pivo joined #mojo
18:40 yakudza joined #mojo
18:43 mrphilov joined #mojo
18:45 denisboyun_ joined #mojo
19:18 sri haha, judging by wwdc spoilers this will be the font of the year 2013 http://www.myfonts.com/fonts/adobe/helvetic​a-neue/helveticaneue-ultralight/glyphs.html
19:33 yko joined #mojo
19:36 denisboyun joined #mojo
19:54 gryphon joined #mojo
20:04 sri marcus just tweeted me this... wonder if that makes RHEL less of an issue http://www.computerworld.com/s/article/9239867/​Red_Hat_packages_newer_versions_of_Ruby_Python
20:05 sri guess it depends on centos
20:15 perlite_ joined #mojo
20:19 basiliscos joined #mojo
20:27 basiliscos joined #mojo
20:29 basiliscos joined #mojo
20:42 denisboyun joined #mojo
20:44 sri i guess it's finally summer and irc will be a ghost town the next few weeks :)
20:57 dabudabu Is that the font Microsoft is using in their PR stuff at the moment?
21:18 rihegher joined #mojo
21:22 rihegher left #mojo
21:30 marcus sri: judofyr showed me something cool we should steal from rails today. jbuilder
21:30 marcus oh, he also implemented in perl and pasted it here :D
21:31 mire joined #mojo
21:31 marcus sri: It seemed pretty clean for the thing I was doing in rails at least.
21:32 marcus judofyr: It looked sexier in ruby tho :)
21:32 bluescreen_ joined #mojo
21:36 moltar joined #mojo
21:49 sri think i saw dhh tweet about it when it was added, didn't get it then either
22:12 marcus sri: it lets you pretty cleanly design a json "template". Often your wanted json data doesn't match the layout of your object model.
22:14 marcus sri: here's the jbuilder thing judofyr made for me in rails https://gist.github.com/marcusramberg/5732782 which was rather cleaner than my first implementation mixing erb and to_json
22:16 coff joined #mojo
22:37 rihegher joined #mojo
22:41 rihegher left #mojo
22:43 denisboyun_ joined #mojo
22:49 delias|w joined #mojo
22:50 whitebook joined #mojo
23:51 mattastrophe joined #mojo
23:52 asarch joined #mojo

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