Camelia, the Perl 6 bug

IRC log for #mojo, 2012-07-20

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

All times shown according to UTC.

Time Nick Message
00:42 jontaylor joined #mojo
00:51 laouji joined #mojo
01:01 scott joined #mojo
01:25 ispy_ joined #mojo
01:46 ispy_ Check out my latest mojo project boys... http://televisionsuicide.com ... I love Mojolicious!
02:04 d4rkie joined #mojo
02:07 tempire the site makes an excellent point about TVS 1.002012a
02:07 tempire I've often thought as much while watching it
02:08 noganex joined #mojo
02:36 Psyche^ joined #mojo
02:50 GitHub69 joined #mojo
02:50 GitHub69 [mojo] kraih pushed 1 new commit to master: http://git.io/3N_whQ
02:50 GitHub69 [mojo/master] added json_class attribute to Mojolicious::Sessions - Sebastian Riedel
02:50 GitHub69 left #mojo
02:52 sri i always wondered why people mix up Mojolicious::Sessions with $c->session... only now i noticed that the documentation says $session everywhere :S
03:35 mattastrophe joined #mojo
03:38 * tempire goes dancing
03:56 xaka joined #mojo
04:06 sri https://github.com/kraih/mojo/issues/357 # bit puzzled by this issue
04:07 xaka1 joined #mojo
04:55 sri marty++ # getting involved
05:46 d4rkie joined #mojo
06:03 Foxcool joined #mojo
06:06 xaka joined #mojo
06:09 Coff joined #mojo
06:13 Mad_Dud joined #mojo
06:15 ovnimancer joined #mojo
07:15 taryk joined #mojo
07:24 Vandal joined #mojo
07:40 cosmincx joined #mojo
07:41 pau4o joined #mojo
07:56 cosmincx joined #mojo
07:59 snailfromhu joined #mojo
08:00 snailfromhu hey guys
08:01 snailfromhu can anyone help me out with the http://mojolicio.us/perldoc/Test/Mojo#post_json_ok method? I tried to use it in my test but I get Can't locate object method "post_json_ok"... error.
08:01 spleenjack joined #mojo
08:03 sri snailfromhu: it's too new :)
08:03 sri will be in the next release
08:03 snailfromhu @sri I see, is there a way to emulate it then for now?
08:04 tempire snailfromhu: install from githubs
08:04 tempire but be wary of changes
08:04 sri "cpanm http://latest.mojolicio.us" should work
08:07 sri tempire: let me know when i'm allowed to release 3.12 :)
08:08 * sri is surprised by the demand for post_json
08:08 tempire I'm not surprised.  I've often thought about it but never mentioned it.
08:09 tempire I'd like to do something more with 3.11 release, but it's not a big deal, and I don't have the time anyway.
08:09 tempire so go ahead and release
08:10 marcus I've never thought of it, but often mentioned it...
08:10 marcus :D
08:10 tempire still, it's a good image: http://mojocasts.com/images/mfw311setup.png
08:10 jontaylor joined #mojo
08:10 marcus tempire: we should have shipped with that in the Makefile.PL
08:12 tempire How do I post something to the Mojolicious google+ page?
08:13 * sri always forgets google+ exists
08:13 tempire I always post to it just in caase
08:13 tempire but I don't understand it.
08:15 fhelmber_ joined #mojo
08:18 tempire I like the comment on the AutoRoute plugin: "If you like PHP, this plugin is very good."
08:18 tempire Can't figure out whether that's a statement or an apology.
08:18 sri haha
08:19 snailfromhu <tempire>, <sri> guys, thanks for the help, I'm eagerly waiting for 3.12 to be released :)
08:20 sri just making some last tweaks
08:20 snailfromhu limechat must be making fun of me with these <> signs :D
08:20 tempire wonder how mikegrb's useragent talk went
08:20 tempire slides?
08:21 * marcus is looking forward to 3.14, our PI release.
08:21 sri there's 67 results for mojolicious on slideshare, why doesn't anyone ever share their slides with us here? :(
08:21 mikegrb http://mail.pm.org/pipermail/atla​nticcity-pm/2012-July/000015.html
08:22 tempire slideshare?  what is this, 2010? ;)
08:22 marcus the client strikes back!
08:22 marcus better get him before he gets you!
08:22 sri :o
08:22 mikegrb slides were rather short, it was mosty a rough outline for discussion
08:22 * tempire doesn't understand why the whole world isn't using speakerdeck
08:23 mikegrb everybody was pretty stoked to start using it
08:23 mikegrb the pm group members are more towards beginner level
08:23 mikegrb heh, we ended up having a quick map tutorial too
08:25 sri hmm, maybe i don't need to make last minute tweaks...
08:26 * sri wonders if json_class attributes belong into Mojo::UserAgent::Transactor and Mojolicious::Sessions or not
08:27 * marcus liked these slides https://speakerdeck.com/u/tanoku/p/interga​lactic-javascript-robots-from-outer-space
08:27 sri Mojolicious::Sessions could theoretically reuse $c->req->json_class
08:27 marcus so could the other one, no?
08:28 marcus I was thinking about that yesterday
08:28 sri nope, the other one actually builds the transaction
08:28 sri so the user could never change the class
08:28 marcus Mojo::Message::Response knows how to deserialize json, wouldn't it be better if ::Request knew how to serialize it?
08:28 marcus more symetric, kinda
08:30 sri request or response is irrelevant
08:30 sri we deserialize for both
08:31 marcus well, I think we tend to build the request, not receive it :)
08:31 marcus hmm, I guess we do both
08:31 sri on the server side we receive it
08:31 marcus yepp
08:31 sri both are pretty much equal for us
08:32 sri if we allowed $tx->req->json({hello => 'world'}) it wouldn't really solve the problem
08:33 marcus it would allow us to reuse the json_class from Mojo::Message?
08:33 sri since post_json builds the whole transaction
08:33 sri you never get to see the transaction before it's too late
08:33 sri of course you can build everything manually
08:34 marcus NOBODY EXPECTS, THE SPANISH TRANSACTION
08:34 sri but then we could just as well get rid of all json_class attributes :)
08:35 marcus ye
08:35 marcus btw, isn't json_class->new->encode a bit of overhead compared to keeping a json instance around and calling ->encode on it?
08:36 sri instantiating is not very expensive in that context
08:36 marcus yea, guess we're not using moose =]
08:36 spleenjack joined #mojo
08:36 sri i've profiled it and it wasn't worth the ugly code ;p
08:37 sri still, what to do about json_class? get rid of all attributes?
08:39 marcus the main use case for having it is switching to Mojo::JSON::XS, right?
08:39 sri i don't think that module works anymore
08:39 sri there might be no official use case atm
08:39 marcus I think we use Mojo::JSON::XS in a $client project
08:40 sri i believe there are incompatibilities
08:40 marcus because we're processing a megaton of Solr stuff
08:40 marcus I have permissions on the module too.
08:40 marcus so I could fix it if there's an actual issue
08:41 sri then tell me how to handle json_class :)
08:41 sri how should it be changeable for post_json
08:41 marcus ENV variable? :)
08:41 marcus I think if you want to switch it, you want to switch it everywhere
08:42 sri hmm, i don't like the inconsistency that causes
08:42 sri there are quite a few more *_class attributes
08:42 sri and none have env vars
08:43 marcus maybe just keep it the way it is then.
08:52 batman_ joined #mojo
09:04 GitHub122 joined #mojo
09:04 GitHub122 [mojo] kraih pushed 1 new commit to master: http://git.io/ESpudQ
09:04 GitHub122 [mojo/master] removed json_class attributes again - Sebastian Riedel
09:04 GitHub122 left #mojo
09:04 marcus tempire++ # good blogpost
09:04 batman which?
09:05 sri marcus: i assume you meant the 3.11 state
09:05 sri which means you can't change the serializer used by post_json at all
09:09 marcus batman: the heroku deployment one. http://tempi.re/deploy-a-web-app-in-one-step
09:09 sri well, i'm getting a headache, if someone is interested in changing the serializer, please solve the problem
09:09 batman aha
09:10 jamesw joined #mojo
09:11 sri marcus: in fact, i will forward all discussions about json_class to you, since you maintain the only option :D
09:11 marcus sri: I've yet to actually 'maintain' it :D
09:12 sri that's good enough for me ;p
09:14 * sri really dislikes the inconsistency between serializing and deserializing we have now
09:18 daxim joined #mojo
09:19 sri i think we should delay 3.12 until this is resolved
09:22 sri or move post_json into a branch so the bugfix can be released
09:49 AmeliePoulain joined #mojo
09:49 AmeliePoulain joined #mojo
09:56 daxim http://stackoverflow.com/questions/11576​281/why-does-mojolicious-nest-my-routes
10:02 Coff joined #mojo
10:17 crab what is the inconsistency?
10:17 * sri forwards crab to marcus :)
10:18 * crab becomes dizzy, flowing willy-nilly through the intertubes
10:18 * marcus gives crab another good spin
10:20 sri the inconsistency is that you can define a json deserializer for ->json() and friends, but not a serializer for ->post_json()
10:22 sri https://github.com/kraih/mojo/blob/maste​r/lib/Mojo/UserAgent/Transactor.pm#L100
10:22 sri that will always use Mojo::JSON
10:25 sri i'm close to deprecating json_class and dom_class completely
10:34 mikegrb just like urmom
10:34 mikegrb wrong win, sorry
10:36 crab ugh
10:43 lukep joined #mojo
10:51 sri marcus: you decide
10:51 sri 3.12 is blocked until you do ;p
10:57 Coff joined #mojo
11:07 marcus why must the pretty ones always suffer? :-/
11:11 GitHub43 joined #mojo
11:11 GitHub43 [mojo] kraih pushed 1 new commit to master: http://git.io/MnxptQ
11:11 GitHub43 [mojo/master] added json_class attribute to Mojo::UserAgent::Transactor - Sebastian Riedel
11:11 GitHub43 left #mojo
11:12 marcus I think that is for the best, sri.
11:12 * sri still hates it
11:12 crab i think i'd prefer to remove it altogether.
11:13 crab though i'm prepared to hold my nose and leave it as it is too
11:13 sri i would be ok with that
11:13 sri tempire: ?
11:13 marcus guess I am ok with that too.
11:14 sri first deprecation in months
11:19 ZadYree joined #mojo
11:21 crab we need some depredations!
11:23 aleph joined #mojo
11:24 ZadYree predation may lose my packets
11:24 ZadYree http://en.wikipedia.org/wi​ki/IP_over_Avian_Carriers
11:26 aleph hi! does anybody know how to display public directory listing in mojolicious?
11:27 GitHub157 joined #mojo
11:27 GitHub157 [mojo] kraih pushed 1 new commit to master: http://git.io/lAm8zA
11:27 GitHub157 [mojo/master] deprecated Mojo::Message->dom_class and Mojo::Message->json_class - Sebastian Riedel
11:27 GitHub157 left #mojo
11:29 crab aleph: you'll have to write code to do it.
11:30 * sri wonders if Mojo::IOLoop->client_class, Mojo::IOLoop->server_class and Mojo::IOLoop->stream_class should be deprecated as well
11:33 sri but i guess they are rather clean and don't cause any trouble
11:34 aleph I wonder what would be the best approach to display a directory listing... perhaps I should intercept 404 and check if it matches a directory
11:35 aleph that could be done with a after-dispatch hook
11:40 crab why not write a wildcard route and see if it matches a directory?
11:40 crab are these files in public or elsewhere?
11:49 aleph crab: that's a good idea... although I think mojolicious should have a plugin to display directory listings... Mojolicious::Plugin::DirectoryListing
11:55 crab sounds good. since you're writing the code, you can make it a plugin.
11:55 GitHub156 joined #mojo
11:55 GitHub156 [mojo] kraih pushed 1 new commit to master: http://git.io/79mnFw
11:55 GitHub156 [mojo/master] deprecated Mojo::Home->app_class, Mojo::IOLoop->client_class, Mojo::IOLoop->server_class and Mojo::IOLoop->stream_class - Sebastian Riedel
11:55 GitHub156 left #mojo
12:00 GitHub196 joined #mojo
12:00 GitHub196 [mojo] kraih pushed 1 new commit to master: http://git.io/uyCxZw
12:00 GitHub196 [mojo/master] fixed Mojo::Home documentation - Sebastian Riedel
12:00 GitHub196 left #mojo
12:05 sri ok, 3.12 is ready as far as i'm concerned, please test!
12:09 CromeDome joined #mojo
12:16 crab passes here.
12:25 sri \o/
12:41 cosimo joined #mojo
12:42 tadamo_ joined #mojo
13:04 aleph joined #mojo
13:24 tadamo__ joined #mojo
13:29 jnap joined #mojo
13:40 inokenty joined #mojo
14:12 mire joined #mojo
14:14 aleph joined #mojo
14:26 xaka joined #mojo
14:31 aleph hi! I'm trying to rewrite output of static files before it is sent to the browser, using the after_dispatch hook. I can check the type using $self->res->headers->content_type and check the content with $self->res->content.
14:31 crab sounds good.
14:32 crab (let's see what my crystal ball says: do you want to know how to tell if it was a static resource or not?)
14:32 aleph no... actually my question is how to actually change the content that goes to the browser
14:33 aleph I tried to set $self->res->body(...) and $self->res->content(...)
14:33 aleph I guess I can pass a sub to $self->res->content, but I was wondering if there is a way to simply replace the string
14:34 aleph or, putting it in three lines:
14:34 aleph my $content = $self->res->content;
14:34 aleph $content =~ s/foo/bar/gs;
14:34 aleph $self->res->body($content);
14:34 * crab throws away his crystal ball and orders a new one
14:35 crab (no way to simply replace the string)
14:37 aleph oh
14:37 aleph that's a great answer :)
14:38 aleph so I can stop looking around for the simple way and do the right way :D
14:38 aleph (should have done that since start... but wanted to know if there was a shortcut ;))
14:38 aleph thanks!
14:40 crab you're welcome.
14:50 batman_ joined #mojo
15:20 batman_ if ->json_class is gone, does this mean that you can't use JSON::XS or such?
15:21 batman_ oh. internet is going to die now... *bbl*
15:26 crab oh no! the internet is going to die?
15:35 jnap joined #mojo
16:02 pau4o left #mojo
16:07 jnap joined #mojo
16:29 ryozi joined #mojo
16:41 Coff joined #mojo
17:08 sri batman: you can still use JSON::XS, just not as a backend for the built in JSON stuff (at least not without monkey patching, which is fine for such a small user base i guess)
17:09 sri Mojo::JSON::XS could go the way of Mojo::Base::XS and add an -infect import flag
17:10 sri but you're also welcome to solve the dependecy injection problem in a clean way, json_class only got deprecated because we failed at it
17:12 sri noooooooooo!
17:12 sri google bought sparrow :(
17:17 sri marcus: HALP! what's the best alternative?
17:19 tempire entourage
17:19 tempire !
17:20 tadamo joined #mojo
17:22 jnap joined #mojo
17:30 tadamo_ joined #mojo
17:55 mire joined #mojo
18:02 mattastrophe joined #mojo
18:05 jnap joined #mojo
18:05 marcus sri: woot?
18:05 marcus sri: there's no alternative.
18:06 marcus mail.all
18:06 marcus mail.app
18:08 rem_lex|pivo joined #mojo
18:10 kthakore hello guys
18:12 kthakore I have a mobile app I am trying to deploy, which talks to a mojolicious server. However I am getting  'Origin null is not allowed by Access-Control-Allow-Origin.' errors. How do I do CORS with mojolicious?
18:13 * marty waves
18:14 kthakore hi marty
18:14 marty Hi kthakore
18:16 marty I can't remember.  does CORS simply rely on the presence of a particular header?
18:17 kthakore I dunno
18:17 njlg you have to put something like "Access-Control-Allow-Origin: *" in the header
18:17 kthakore how do I do that on nginx/mojolicious
18:18 njlg or use something like jsonp (if you can)
18:19 kthakore how do I use jsonp?
18:19 kthakore I am using backbone js to do the request
18:20 njlg Do you own the backend and the frontend code?
18:22 kthakore yeah
18:23 njlg I would try add ACAO to your Mojolicious: something like
18:23 njlg $self->res->headers->header('​Access-Control-Allow-Origin' => '*');
18:26 kthakore ok
18:30 kthakore I think the broswer is preventing the header maybe
18:31 jnap joined #mojo
18:35 njlg idk. You could try looking in the browsers console to verify that your app now sends the header. Or if you have curl, run `curl -I http://yoursite.com`
18:38 marty kthakore:  If you want that header on every request you can wrap it in a before_dispatch hook.  i.e…. $self->hook(before_dispatch => sub { my $c = shift;$c->res->headers->header​('Access-Control-Allow-Origin' => '*');});
18:43 xaka joined #mojo
18:52 tadamo joined #mojo
18:57 kthakore ok
18:57 kthakore I am sending jsonp requests now. How do I handle it?
18:59 xaka joined #mojo
19:01 njlg kthakore: handle it from backbone.js? there are some good examples on google: basicaly add dataType: 'jsonp' where you configure your ajax requests
19:01 kthakore yeah
19:01 kthakore I am using backbone.js
19:02 kthakore I am just wondering what I should do with the callback and other information
19:02 kthakore on mojolicious side?
19:03 kthakore I get callback  and an {object
19:03 kthakore }
19:03 kthakore does mojolicious automatically converts this?
19:07 spaceships joined #mojo
19:35 tempire huh
19:35 tempire you can make your own fonts with fontstruct.com
19:41 kthakore how do I handle jsonp requests like this?
19:41 kthakore callback=jQuery17107675381165463477_13428​12519754&{"email":"","password":"","confi​rm":"","gender":"","age":"","city":"Londo​n","dataType":"jsonp"}&_=1342812520780
19:41 kthakore 127.0.0.1:3000/api/mobile/signup/?callback=jQuery​17107675381165463477_1342812519754&{"email":"","p​assword":"","confirm":"","gender":"","age":"","ci​ty":"London","dataType":"jsonp"}&_=1342812520780
19:41 tempire kthakore: I'm not sure what you're asking.  that's generally something that the client handles.
19:41 kthakore yeah?
19:42 kthakore tempire: well backbone.js
19:42 kthakore makes that request
19:43 kthakore with option jsonp
19:43 kthakore how do I get the param('email') etc out of it?
19:44 tempire in that url, the json is parameter name.  you would have to parse the query string manually.
19:45 tempire it looks a little strange.
19:45 kthakore well that is what a jsonp request looks like
19:49 knshaum joined #mojo
19:49 kthakore oh apperntly I setup a page on the server side to do the callback of the jsonp and send it to the server
19:49 kthakore hmm
19:49 kthakore how to do this
20:11 kthakore tempire: I am looking at this http://www.ibm.com/developer​works/library/wa-aj-jsonp1/
20:11 kthakore tempire: see listing 6?
20:11 kthakore how do I do that?
20:12 tempire my $json_data = Mojo::JSON->new->decode($self->param('symbol'))
20:16 daniel_ joined #mojo
20:29 marty Hmm.  I'm failing one Mojolicious test… https://gist.github.com/3153034   Has anyone run into this before?  I think it is my environment but I cannot track it down.
20:38 xaka joined #mojo
21:13 doubi joined #mojo
21:17 doubi 'evening all. I <3 Mojo::UserAgent and ojo, but I also like to be polite to servers when experimenting, so usually end up using WWW::Mechanize::Cached. Would it be worth my knocking out a MojoX::UserAgent::Cached? Too trivial to be useful? Some option I'm failing to notice?
23:24 mojobot18401 joined #mojo
23:27 billybob joined #mojo
23:39 tempire doubi: never used WWW::Machanize::Cached, but by all means go forth and create a UserAgent version.
23:45 andrefs joined #mojo
23:57 tempire sri: found out that you can eliminate the black sidebars when embedding SD vimeo video by specifying width & height attributes that have 4x3 ratio

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