Camelia, the Perl 6 bug

IRC log for #mojo, 2011-05-31

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

All times shown according to UTC.

Time Nick Message
00:08 j3nnn1 joined #mojo
00:08 alnewkirk how can i prepend my returned json data with a string, as discussed here http://insecureweb.com/javascript/se​cure-your-ajax-request-with-jquery/
00:10 d4rkie joined #mojo
00:14 D4RK-PH0ENiX left #mojo
00:14 sri partial rendering
00:14 purl partial rendering is tricky isnt it?
00:15 sri $self->render_data("don't be evil;" . $self->render_json({}, partial => 1));
00:15 sri oh, and possibly a format => 'json' for he content type
00:16 alnewkirk cool, yes exactly
00:16 alnewkirk thanx
00:16 sri and if you don't like typing so much you turn it into a helper
00:16 garu won't the format => 'json' turn it into valid json?
00:17 alnewkirk garu, no
00:17 alnewkirk ... the second render
00:17 garu ah, ok
00:17 garu but the second renderer is already json :)
00:17 j3nnn1 left #mojo
00:17 garu I'd have to look at what "partial => 1" does :)
00:18 sri the partial render won't set a content type
00:18 sri and data rendering defaults to html i think
00:18 j3nnn1 joined #mojo
00:18 sri partial => 1 makes the renderer return the result
00:18 garu nice
00:18 sri leaves the response alone, we implemented include and friends that way
00:19 garu sri: and format => 'json' only fiddles with content_type, right? not with the data itself
00:19 sri right
00:19 garu cool, one less line to write :)
00:21 sri ./myapp.pl eval -v 'app->dumper(app->types->types)'
00:21 sri that's the type map :)
00:22 alnewkirk what a good approach to rbac for an api (lots of ajax calss, etc)
00:22 sri oh, that could be abother oneliner of the day :D
00:23 alnewkirk at first i was think about enforcing rbac based on the url
00:23 alnewkirk ... but now im not so sure
00:24 alnewkirk e.g. /:username/:role/:url
00:26 garu alnewkirk: give it a try, let us know how that goes in practice!
00:27 alnewkirk im still thinking it out
00:27 D4RK-PH0ENiX joined #mojo
00:27 alnewkirk actually, that makes no sense because theres no context
00:30 * alnewkirk loves sri
00:31 alnewkirk ... im going the way of M::P::Authenticate .., over
00:31 d4rkie left #mojo
00:31 * sri swoons
00:37 alnewkirk sri, i'd like to return a json formatted 404 and 500 document if xhttprequest header exists
00:37 alnewkirk that should be a plugin i think
00:38 sri i think that's application logic
00:39 sri i've actually recently done some work in that direction, let me look
00:39 sri https://github.com/kraih/mojo/blob/master/t/m​ojolicious/lib/MojoliciousTest/Exceptional.pm
00:39 sri right
00:40 sri we make that very easy per controller
00:40 sri you could have an ajax controller for example
00:40 alnewkirk i do
00:40 sri just overload render_exception and render_not_found
00:41 alnewkirk nice nice nice ... damn it
00:41 alnewkirk i must say that what mpresses me the most about Mojolicious is how well thought out it is
00:43 alnewkirk ... though, as oppsed to overloading those routines in every controller under /api, would it be better (in my case) centralize it?
00:46 d4rkie joined #mojo
00:48 GitHub182 joined #mojo
00:48 GitHub182 mojo: master Sebastian Riedel * 15c0d85 (1 files in 1 dirs): fixed typo - http://bit.ly/jCrfP3
00:48 GitHub182 left #mojo
00:50 D4RK-PH0ENiX left #mojo
00:50 mattastrophe left #mojo
01:02 Alias joined #mojo
01:03 gbacon joined #mojo
01:20 sri i really need to troll more often, no better way to get followers on twitter :D
01:20 Alias left #mojo
01:22 sri maybe i can catch up with marcus then
01:33 sri http://ajayjapan.posterous.com/why-n​yc-is-not-palo-alto-cc-mikebloomberg # wow, you don't own the code you write in your spare time in new york? :O
02:07 perlrocks Twitter: "[Dotcloud] [perl] [mojolicious] [facebook] [yusukebe] [configuration] / DotCloud excellent platform for developers - all Suke Diary ー ー http://htn.to/ECYqF Yu" (ja) --sugyan http://twitter.com/sugyan/status/75382898890514432
02:08 D4RK-PH0ENiX joined #mojo
02:12 d4rkie left #mojo
02:23 miyagawa left #mojo
02:25 d4rkie joined #mojo
02:28 miyagawa joined #mojo
02:29 D4RK-PH0ENiX left #mojo
02:32 Kulag left #mojo
02:39 Kulag joined #mojo
02:45 Kulag left #mojo
02:46 Drossel joined #mojo
02:52 Drossel left #mojo
02:53 AigleNoir left #mojo
03:02 Kulag joined #mojo
03:07 Kulag left #mojo
03:14 Kulag joined #mojo
03:22 AigleNoir joined #mojo
03:36 j3nnn1 left #mojo
03:38 * sri is starting to love the eval command
03:39 D4RK-PH0ENiX joined #mojo
03:43 d4rkie left #mojo
03:47 sri wonder if it would make sense to rename all methods containing *_inner to *_content
03:47 sri inner_xml, replace_inner, prepend_inner, render_inner
03:47 sri content_xml, replace_content, prepend_content, render_content
03:48 d4rkie joined #mojo
03:48 sri maybe not the best time to ask design questions :)
03:52 D4RK-PH0ENiX left #mojo
03:57 gbacon left #mojo
04:09 GitHub109 joined #mojo
04:09 GitHub109 mojo: master Sebastian Riedel * c49023f (11 files in 9 dirs): deprecated all methods containing the word "inner" in favor of ones containig the word "content" - http://bit.ly/klEa3p
04:09 GitHub109 left #mojo
04:09 sri that makes more sense
04:25 sri i always hated render_inner :)
04:27 alnewkirk what module is render( json => ... using
04:27 alnewkirk try to pass JSON::true along with it
04:27 alnewkirk trying...
04:27 purl well, trying is just as important as succeeding sometimes.  :)
04:27 sri Mojo::JSON
04:27 purl i think Mojo::JSON is about 3 times faster than json::pp
04:27 * sri pats purl
04:27 * purl bites!
04:27 * sri bites purl back
04:27 * purl stabs sri in the face
04:27 sri :o
04:27 alnewkirk down boy
04:29 GitHub35 joined #mojo
04:29 GitHub35 mojo: master Sebastian Riedel * a25b6a2 (1 files in 1 dirs): slightly better render_content example - http://bit.ly/jbnbSN
04:29 GitHub35 left #mojo
04:39 plu joined #mojo
04:40 Kulag left #mojo
04:40 D4RK-PH0ENiX joined #mojo
04:42 d4rkie left #mojo
04:43 tempire shnikies
04:44 * tempire notes to not start his next project in ny
04:44 tempire oh wait, I'd have to have a job
04:44 * tempire loves freedom
04:49 D4RK-PH0ENiX left #mojo
05:00 d4rkie joined #mojo
05:15 d4rkie left #mojo
05:22 d4rkie joined #mojo
05:25 d4rkie left #mojo
05:26 ysyrota joined #mojo
05:32 tabbi joined #mojo
05:34 tabbi left #mojo
05:40 sugar joined #mojo
05:43 sugar left #mojo
06:11 AmeliePoulain joined #mojo
06:17 d4rkie joined #mojo
06:24 koban` joined #mojo
06:25 fhelmber_ joined #mojo
06:34 miyagawa_ joined #mojo
06:34 miyagawa left #mojo
07:17 arthas joined #mojo
07:18 miyagawa_ is now known as miyagawa
07:20 cosmincx joined #mojo
07:31 jwang left #mojo
07:32 crab alnewkirk: http://toroid.org/ams/etc/jquer​y-autocompletion-and-hijacking
07:33 perlrocks Twitter: "#mojolicious 1.4 and #perl 5.14 hack of the day: "./myapp.pl eval -v 'join ", ", sort keys app->renderer->helpers'"" --kraih http://twitter.com/kraih/status/75465003922235392
07:34 sri list all helpers available in your app ;)
07:38 marcus sri: hmm, maybe I can do it using plack middleware instead
07:39 sri ?
07:41 marcus verbose request logging
07:41 sri i'm sure you can do that at every layer
07:41 marcus yeah, I but if someone has done it for me, I don't have to write code :)
07:42 marcus that's the best kind of code
07:42 sri when did you become such a slacker?
07:42 marcus I've always been a slacker. that's why I use perl
07:43 sri i'm sure during the catalyst days you actually used your commit bit
07:43 marcus anyways, plackup middleware debug looks loke what I want
07:51 crab sri: you want %{app->renderer->helpers} surely?
07:51 sri perl 5.14
07:51 sri ;)
07:52 * crab pushes sri into the alligator pit.
07:52 * sri falls
07:55 sri here's a hack for marcus the slacker "hook before_dispatch => sub { app->log->debug(app->dumper(s​hift->req->params->to_hash)) };"
07:55 marcus <3 5.14
07:55 marcus sri: that is way too much code
07:55 marcus :D
07:56 sri if i ever get that tired of writing code, please someone shoot me! :)
07:56 marcus sri: that's lite syntax?
07:56 sri it is
07:56 marcus this is what I did btw; plackup -e'enable "Debug"; enable "Debug::Parameters"' script/meetv_web
08:38 crab i am a silly crab. now that i use perlbrew, i should feel more comfortable installing random modules for testing, not less.
08:42 Akron joined #mojo
08:42 alnewkirk using apache, how would i put mojo in production mode?
08:43 alnewkirk SetEnv?
08:43 purl SetEnv is probably gone
08:45 crab yep.
08:45 crab assuming you're using something where apache starts your server.
08:45 crab (and why would you do that? but that's a different question.)
08:46 alnewkirk :}
08:46 alnewkirk e.g. SetEnv MOJO_HOME production
08:46 alnewkirk ?
08:46 arpadszasz joined #mojo
08:48 crab er
08:48 crab MOJO_MODE, not MOJO_HOME.
08:49 moritz fwiw I just wrote a wrapper around my script which sets the mode, MOJO_HOME etc.
08:49 moritz and then exec()s the real script
08:50 crab i just have $ENV{MOJO_MODE} ||= "blah" in myapp.pl
08:51 spleenjack joined #mojo
08:56 arthas left #mojo
08:56 arthas joined #mojo
08:56 crab (is spleenjacking like stealing kidneys?)
09:01 cosmincx left #mojo
09:02 cosmincx joined #mojo
09:05 bosphorus joined #mojo
09:31 sh4 joined #mojo
09:32 snearch joined #mojo
09:41 arpadszasz left #mojo
09:42 arpadszasz joined #mojo
09:55 * sri wonders what the best os x twitter client might be
09:58 * moritz thought that sri repeatedly stated that "the best" usually doesn't exist
09:59 sri heh
09:59 sri don't use my words against me :(
09:59 sri but i'm really starting to not like the official twitter client
10:00 sri it doesn't even show me retweets
10:00 sh4 left #mojo
10:08 Kulag joined #mojo
10:10 nordicdyno joined #mojo
10:11 nordicdyno left #mojo
10:11 nordicdyno joined #mojo
10:13 Kulag left #mojo
10:14 tabbi joined #mojo
10:14 tabbi left #mojo
10:25 nordicdyno left #mojo
10:31 marcus I'm using the official one still
10:31 crab dammit, customers! don't fill up my logfile with requests so fast.
10:34 crab i wonder what it is about the way i'm serving pdfs that causes chrome to not display them.
10:34 nordicdyno joined #mojo
10:34 Kulag joined #mojo
10:34 nordicdyno left #mojo
11:27 fmerges joined #mojo
11:31 sh9 joined #mojo
11:38 sri firefox 6 is really great
11:49 Kulag left #mojo
11:57 crab will ship in the third quarter of 2011? that's not very far away.
11:58 crab what's going to happen to firefox 5?
12:03 sri gets released in june
12:05 sri websockets are very close to becoming an rfc now
12:37 metaperl joined #mojo
12:38 metaperl i'm making sure. No one has written anything to do a listing of a static directory of downloads, like what Apache does here - http://static.livingcosmos.org/
12:43 crab holy cow. the nightly build of firefox (labelled 7) starts up almost instantly.
12:43 crab damn. this is how a browser should be.
12:44 crab too bad the font rendering is all a bit weird.
12:44 Akron left #mojo
12:44 sh9 left #mojo
12:47 moritz crab: I found that all recent-ish firefox releases performed really well... until you added all the plugins needed to make it actually usable :/
12:47 metaperl :)
12:47 metaperl you have to deal with it - firefox is the most useable browser out there and there is no way to make it more memory efficient
12:48 * moritz believes there's still lots of room for improvement
12:48 metaperl unless we go back to the lynx days
12:48 moritz for example you could lazy-load tabs in a clever way
12:48 moritz and serialize them away if you haven't looked at them in the last 10 minutes
12:49 moritz and automatically restore them when you do something with it
12:49 metaperl I use the tab groups manager for that
12:50 metaperl I manually suspend groups
12:50 moritz if the management was more intelligent, you wouldn't have to
12:50 crab moritz: what plugins do you use?
12:52 moritz crab: adblock plus, firebug, ghostery, tab mix plus (in the minimal case)
12:52 crab i usually have firebug and pentadactyl, that's it.
12:52 moritz usually also some google customization thing (forgot what it's called), a server switcher for dev/production switching
12:52 metaperl I play Go, so I have a plugin for that too
12:53 * moritz can't imagine browsing without a good ad blocker anymore
12:54 crab "but you're stealing from the hungry mouths of the content producer's children!"
12:56 moritz that's fine, I'm a content producer too
12:58 metaperl quick basic perl question... http://pastebin.com/fQSHdefF   ... I want to take a slice of a hash reference instead of a hash ....
13:00 crab i didn't look at your pastebin, but @$x{qw(...)}
13:03 metaperl ok does 'x' have to be a simple scalar
13:03 metaperl would
13:03 metaperl @$hash_ref_name{qw( ... ) } work? I guess I could try it
13:03 crab @{complicated-expression-r​eturning-hashref}{qw(...)}
13:06 metaperl thank you
13:06 metaperl now, no one answered about a mojo plugin to provide a list of static files for download, so I'm working on it
13:09 tabbi joined #mojo
13:09 tabbi left #mojo
13:22 sri i think tempire wrote an app for that, but i'm not aware of a plugin
13:27 d4rkie left #mojo
13:32 marcus there's an app for that?
13:35 moritz is this #iphone or what? :-)
13:36 marcus pretty much
13:41 Foxcool joined #mojo
13:43 sh9 joined #mojo
13:44 AmeliePoulain Which method parses HTTP request in Mojolicious application?
13:47 * crab hands AmeliePoulain some grep
13:48 * moritz replaces grep by ack
13:48 AmeliePoulain What is it's name?
13:48 moritz I'd have to look it up, but you can do that yourself too
13:49 crab Mojo::Message::_parse and friends
13:49 crab ack is slow and kinda annoying
13:49 AmeliePoulain crab, 10x
13:50 moritz ack is fast enough for me, and less annoying than grep -r searching .git/ files etc.
14:09 AmeliePoulain left #mojo
14:12 crab that's what git grep is for.
14:13 crab and svn grep, and cvs grep, and hg grep. what's the problem? ;-)
14:14 perlrocks Twitter: "To get the controller object in the template / Mojolicious Reference - Introduction to Perl code from the sample http://bit.ly/jwbBi6" (ja) --wPerlnews http://twitter.com/wPerlnew​s/status/75565707731025920
14:14 perlrocks Twitter: "Restoring the request URL / Mojolicious Reference - Getting Started with Perl code samples http://bit.ly/lHEvdD" (ja) --wPerlnews http://twitter.com/wPerlnew​s/status/75565710063042560
14:30 elb0w why do you need to grep .git files? Im sure theres a git method to do it
14:30 elb0w ah just read crab
14:42 crab git grep avoids .git files, not greps them
14:56 dekimsey joined #mojo
14:58 bosphorus left #mojo
14:58 ajgb joined #mojo
14:59 kaare joined #mojo
15:05 metaperl http://pastebin.com/iv4Xh9UF   ... this is the object-oriented API I have for formatting a file in unix ls-style format.  It involves updating File::Stat::Ls on cpan (http://search.cpan.org/~geoti​ger/File-Stat-Ls-0.11/Ls.pm) ... for the moment I will just stash an object and loop over the directory contents and render it .. later plan to refactor into a plugin
15:05 * metaperl surges forward with plans
15:06 koban` left #mojo
15:08 dotan joined #mojo
15:13 snearch left #mojo
15:15 crab surging, eh?
15:15 metaperl :)
15:19 mhi joined #mojo
15:21 metaperl I would lke to re-implement File::Stat::Ls using Moose but dont want to have that many deps ...
15:22 moritz what does it need Moose for?
15:22 metaperl well, I dont like writing my own constructors and Class::Struct does not allow you to refine the object construction process enough for me
15:24 metaperl I think I can get away with Class::Struct
15:25 moritz IMHO Moose is mostly overkill if you just have a "dumb" data store plus a few methods
15:25 moritz if you need introspection, roles etc. Moose is a great choice
15:26 metaperl I just like how easy it is to declare fields and i like sub BUILD and I already know it.
15:26 metaperl whereas I have to figure out Class::Struct
15:26 metaperl what core OO facilities are in Perl now? fields and Class::Struct I know of.
15:34 crab moritz: i think the idea is that you start off with a dumb data store with a few methods and then grow into something bigger where you wish you'd used moose from the start
15:34 crab but personally, i get along fine without it
15:35 metaperl I think Mouse might be enough for me... though once I had a bug in it that was not in Moose
15:41 crab yes, mice are known to be carriers of all sorts of insects
15:43 tabbi joined #mojo
15:43 abra joined #mojo
15:43 metaperl lol
15:58 arthas left #mojo
16:03 ysyrota left #mojo
16:07 jdixon joined #mojo
16:08 jdixon is there a method to return the url path as one entity (rather than parts)?
16:09 jdixon I feel like I'm overlooking something obvious
16:09 crab $url->to_string()
16:09 crab er, wait. the path alone? just $url->path()
16:11 jdixon well, I'm in Lite. tried $self->req->url->path and it makes parts available, but not the original string.
16:11 jdixon e.g.
16:11 jdixon print Dumper($self->req->url->path);
16:11 jdixon it deconstructs Mojo::Path
16:11 jdixon afaict
16:12 crab yeah. if you stringify it, you'll get a string.
16:12 jdixon I could just join it, but it feels dirty. :)
16:12 sri JUST STRINGIFY IT!
16:13 sri http://mojolicio.us/perldoc?Mojo/Path#to_string
16:13 * crab stringifies sri and gets stri
16:14 sri and of course there is also an overload
16:14 * sri turns into a noose and strangles crab
16:15 jdixon sri crab: thanks, to_string works fine
16:15 crab oh noes. i'm stringled.
16:18 cosmincx left #mojo
16:30 amoore joined #mojo
16:31 ajgb left #mojo
16:32 dotan left #mojo
16:40 perlrocks Twitter: "Mojolicious today tried. nice toy. it is a toy mk after Catalyst difficult to take seriously a miracle" (ru) --dolbanavt http://twitter.com/dolbanav​t/status/75602511846850560
16:44 fmerges left #mojo
16:44 jdixon left #mojo
16:46 tabbi left #mojo
16:51 alnewkirk looking for more information on defining conditions
16:55 alnewkirk so the value used in over has to match the return value of add_condition?
16:55 alnewkirk if so, that makes sense
17:01 elb0w is it just me or was that twitter post horribly written?
17:02 crab elb0w: (ru)
17:02 elb0w oh is it translated then
17:02 elb0w Didnt catch that
17:21 arpadszasz left #mojo
17:42 spleenjack left #mojo
17:57 kaare left #mojo
18:01 kaare_ joined #mojo
18:03 sugar joined #mojo
18:08 kaare__ joined #mojo
18:08 kaare_ left #mojo
18:12 kaare joined #mojo
18:14 kaare__ left #mojo
18:18 sh9 left #mojo
18:22 kaare left #mojo
18:36 su-bzero left #mojo
18:40 curtis_ joined #mojo
18:41 curtis_ Can I put the output of $self->render into a variable instead of having ti go to the browser? Or am I going to have to parse the template in a different way to do that?
18:41 miyagawa left #mojo
18:42 crab curtis: $var = $self->render_partial('template', var => 'val', ...)
18:45 curtis_ gah, now I see how I was suppose to read that section of the documentation. Thanks.
18:45 Akron joined #mojo
19:18 Akron Where is the test suite for Mojo::Command?
19:20 Akron I think I've found a little bug and have a fix - but no idea how and where to write the necessary test case ...
19:39 Akron left #mojo
19:39 Foxcool left #mojo
19:48 curtis_ left #mojo
19:52 Foxcool joined #mojo
19:55 miyagawa joined #mojo
19:55 miyagawa left #mojo
19:56 Akron joined #mojo
20:07 sugar left #mojo
20:34 stephan48 left #mojo
20:34 stephan48 joined #mojo
20:39 stephan48 left #mojo
20:39 stephan48 joined #mojo
20:50 arpadszasz joined #mojo
20:51 dekimsey left #mojo
21:07 Akron left #mojo
21:08 d4rkie joined #mojo
21:09 Akron joined #mojo
21:16 Akron left #mojo
21:22 Akron joined #mojo
21:34 mmcleric left #mojo
21:36 mmcleric joined #mojo
21:43 metaperl I've checked the FAQ, Tutorial and ::Guides, but I still dont know something. Is there a way to get the physical path of the static file document root via Mojo?
21:48 D4RK-PH0ENiX joined #mojo
21:48 metaperl $self->static->root # appears to be the ticket
21:50 d4rkie left #mojo
21:53 amoore left #mojo
21:57 j3nnn1 joined #mojo
21:59 metaperl my fork of mojo would not retrieve the newest Mojolicious.pm . I had as upstream via it remote add upstream  git remote add upstream https://github.com/kraih/mojo.git  and I did a git fetch upstream
22:09 metaperl hmm the FAQ is very high-level, executive overview type. The cheatsheet doesnt have a programming section... I think my question about how to access the physical path of the public directory belongs in some document, but it doesnt seem to fit either
22:17 Akron metaperl: Everytime this happens to me with git I clone it again.
22:28 Foxcool left #mojo
22:32 metaperl Akron i see
22:32 Akron Doesn't hurd too bad. ;)
22:32 metaperl Mojo::Base seems to be an acceptable object system ... but there doesnt appear to be a BUILD method to refine ->new()?
22:45 Akron What do you mean with refine?
22:46 metaperl like sub BUILD in Moose
22:47 metaperl something that runs after new() to make object mods
22:48 Akron Well ... SUPER?
22:48 metaperl perhaps...
22:48 purl rumour has it perhaps is 'would you object to tabindex being applied to the controls' on the login form be a better question
22:49 Akron I make new constructors and get the instance by applying $self = $class->SUPER::new(@_); Pretty easy though.
23:02 metaperl i see. I think I will just haul in Moose and not try to add things on everytime I need something
23:02 metaperl in other news, $self->static->root is not giving me the root directory of the web app... it says no static method found
23:03 Akron What is $self in there?
23:04 metaperl Akron - the acion object
23:04 metaperl what you get via GET '/' => sub { my($self)=@_; ... }
23:06 metaperl http://pastebin.com/6mLntDSR .... haha! those quotes in the Mojo code are hilarious!
23:09 Akron metaperl: static is a method of the app.
23:09 Akron get '/' => sub { my $self = shift; $self->render(data => $self->app->static->root); };
23:10 metaperl yes, I just dumped the object and saw it :)
23:11 Akron :)
23:13 metaperl thanks for your help
23:13 metaperl what guide should we add that info too? cheatsheet or faq?
23:13 metaperl ->render(data => $value); hmmm gotta check out
23:13 metaperl check that out
23:13 Akron Isn't it in a guide?
23:14 metaperl which one?
23:15 metaperl I always mess up and go here to look at ->render : http://search.cpan.org/~kraih/Mojolic​ious-1.34/lib/Mojo/Template.pm#render  ... but I think its in the guides somewhere
23:17 Akron Looking in to the API ref is pretty confusing sometimes. I don't do it often. Either in the Guides, the Wiki or the code.
23:18 Akron Maybe the Wiki is the best place. Or sri says, it's a FAQ.
23:18 metaperl the FAQ is like an executive white paper
23:23 Akron Have no idea for a good place. :(
23:23 Akron ... tired ... have to sleep. Good night everyone!
23:23 metaperl good night Akron
23:24 Akron metaperl: Bye!
23:24 Akron left #mojo
23:29 preflex left #mojo
23:32 preflex joined #mojo

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