Camelia, the Perl 6 bug

IRC log for #mojo, 2013-03-06

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

All times shown according to UTC.

Time Nick Message
00:01 GabrielVieira2 joined #mojo
00:01 hmepas joined #mojo
00:15 hmepas joined #mojo
00:19 bpmedley sri: Why mango?  Would you consider Gearman?
00:20 shmuel joined #mojo
00:20 sri bpmedley: for fun of course
00:20 sri diegok: mango is non-blocking
00:21 MeierM joined #mojo
00:21 sri i could dispatch jobs and wait for results with a tailable cursor
00:21 diegok sri: sure, I know. I've been missing but I'm reading it :)
00:22 PanzerBjorn joined #mojo
00:22 diegok how do you prevent one job to be dispatched twice?
00:23 Averna joined #mojo
00:23 diegok ok, tailable cursor on the event loop.
00:23 sri how is that relevant to it being non-blocking?
00:24 bpmedley sri: https://gist.github.com/brianmed/5095681
00:24 PanzerBjorn I have something bizarre going on with my hypnotoad server, perhaps someone can help shed some light on something I'm overlooking? I recently moved some templates from the root templates folder into a subfolder named 'cl', but when I changed my $self->render('index') to $self->render('cl/index') I get timeouts from hypnotoad trying to access those pages.
00:24 sri bpmedley: i really don't care about gearman
00:25 diegok well, I was thinking on several workers trying to get a job to do...
00:25 sri mongodb has atomic operations
00:25 PanzerBjorn I shut down hypnotoad and tried the server in morbo and the pages render fine, showing the expected debug info for finding the templates and rendering them out. Is there a way to get dev-level debug logging like that in hypnotoad?
00:27 PanzerBjorn Also, other templates other than those moved to the 'cl' folder are still rendering fine.
00:27 PanzerBjorn Permissions are all correct on the 'cl' folder and its contents as well.
00:28 diegok hm... ok, just fetch a doc, try to update "if current" and then dispatch. That solves my question :)
00:28 * diegok reading about atomic ops
00:28 sri it's find_and_modify
00:30 diegok http://docs.mongodb.org/manual/reference​/method/db.collection.findAndModify/#db.collection.findAndModify
00:30 diegok :)
00:34 sri bpmedley: btw. that's not non-blocking
00:34 bpmedley sri: Why do you say that?
00:34 sri because ->wait blocks
00:39 bpmedley sri: https://gist.github.com/brianmed/5095752
00:39 bpmedley sri: Sorry, here is a better version: the ->wait is not required, I don't *believe*.
00:40 sri bpmedley: which event loop is it using then?
00:40 bpmedley sri: Honestly, it's in a foreach loop in a Mojo helper.
00:41 bpmedley sri: Did I mis-understand the question?
00:41 sri that's not non-blocking ;)
00:41 bpmedley sri: The code can be placed anywhere.  I do believe the $tasks->add_task($task) to be async and non-blocking.
00:42 sri seriously
00:45 mattastrophe joined #mojo
00:46 sri https://metacpan.org/source/DORMANDO/​Gearman-1.11/lib/Gearman/Util.pm#L147
00:46 sri that is its idea of an event loop
00:46 sri that does not play nice with others
00:47 bpmedley sri: Moment, pls.
00:53 bpmedley sri: I'm not seeing that code called via add_task().  Did I miss something?  https://metacpan.org/source/DORMANDO/Ge​arman-1.11/lib/Gearman/Taskset.pm#L178
00:54 bpmedley sri: I only see it called in the worker.
00:56 sri which only makes it worse
00:57 sri all those reads and writes are blocking, waiting for the socket to be readable
00:57 bpmedley In what way?  Do you have time to elaborate?
00:58 sri https://metacpan.org/source/DORMANDO/​Gearman-1.11/lib/Gearman/Util.pm#L96
00:59 sri those are blocking reads that wait a full response
00:59 PanzerBjorn $self->app->log->warn('Index Page called 1 - template: '. $self->stash('template') .' - format: '. $self->stash('format'));   $self->render( template => 'cl/index', format => 'html');   $self->app->log->warn('Index Page called 2 - template: '. $self->stash('template') .' - format: '. $self->stash('format'));
00:59 PanzerBjorn Yields:
00:59 PanzerBjorn [Tue Mar  5 16:58:42 2013] [warn] Index Page called 1 - template:  - format: [Tue Mar  5 16:58:42 2013] [warn] Index Page called 2 - template:  - format: html
00:59 sri PanzerBjorn: please don't paste into the channel
01:00 sri bpmedley: anyway, i'm out of time now i'm afraid
01:00 bpmedley sri: So, the issue is that, the reads and writes between the Worker and Client could block?
01:01 PanzerBjorn Sorry, just going by what the bottom of every page of documentation says, which I won't paste but to paraphrase says to come here without hesitation.
01:01 bpmedley sri: Thanks for the time you spent on it.
01:01 PanzerBjorn Is there someone my company can pay for Mojo support?
01:02 PanzerBjorn Or would anyone here be willing to bill hours for support?
01:04 PanzerBjorn I'll Paypal over $25 to anyone who can help me solve this template rendering issue.
01:06 jb360 joined #mojo
01:08 bpmedley sri: In order to change Gearman to be non-blocking it's socket model would have to change, is that correct?
01:12 ka2u joined #mojo
01:18 hlin joined #mojo
01:21 sri bpmedley: how do you call ->wait currently?
01:21 bpmedley sri: Just a sec.
01:23 sri there are two options a) you change the gearman socket handling code to use a real event loop b) you can get the socket handle and write a wrapper around the current gearman code
01:23 sri a basically means writing a new client
01:24 sri b means writing code like Mojo::IOLoop->singleton->reactor->on(readable => sub { ... $ts->wait }) and the like
01:25 sri *but* b can never be as good as a, since there is blocking reads and writes you still can't change and which in some cases will get in the way
01:27 sri had the task api used the select() code, there would have also been an option c... wrapping the whole thing in a Coro
01:27 sri https://metacpan.org/module/AnyEvent::Gearman
01:28 sri this is how non-blocking looks like
01:36 sri but it's not just about ->wait, when you do ->add_task it actually opens a socket, writes the request, receives a response (with the job id i suppose) and only once all that is finished returns
01:36 sri a non-blocking client would return even before opening the socket
01:37 sri all work would happen in small chunks whenever the event loop feels like it
01:52 lukep joined #mojo
01:56 d4rkie joined #mojo
02:12 GabrielVieira joined #mojo
02:14 jberger PanzerBjorn, the folder name cl, is that the name of the controller as well?
02:15 jberger templates belonging to specific controllers can be in a subfolder of the same (decamelized) name
02:16 PanzerBjorn Nope, not the controller.
02:17 PanzerBjorn So you can't direct the renderer to render a template under an arbitrary subfolder?
02:18 jberger the docs say you can, though I haven't used it that way
02:18 jberger http://mojolicio.us/perldoc/Mojoliciou​s/Guides/Rendering#Rendering_templates
02:18 PanzerBjorn Hmmm. Mayhaps I can restructure my Controller name and what goes with it then.
02:19 jberger not sure you should need to reading this
02:19 bpmedley sri: Understood, thanks again.  I'll try and answer your ->wait call in a sec.
02:20 sri jberger: the whole template name with controller and route name thing is actually really simple
02:20 sri https://github.com/kraih/mojo/blob/mas​ter/lib/Mojolicious/Controller.pm#L159
02:21 sri that block is the whole logic, nothing else is involved
02:21 sri it's just a default that gets generated
02:22 jberger yeah, I see that now
02:22 jberger so PanzerBjorn should be ok requesting a specific template by full path
02:23 jberger also PanzerBjorn, its IRC etiquette to use a pastebin when you would paste into a channel
02:24 PanzerBjorn Not familiar with what that means, @jberger
02:24 jberger gist.github.com or pastie.org
02:24 jberger that way you don't fill our chat clients with pasted code
02:25 jberger there are many pastebin sites, I usually use those two
02:25 jberger gist when its something I might want to come back to at some point pastie when its a throwaway
02:26 * jberger should start using template inheritance more often
02:28 PanzerBjorn I'm not sure what happened, but nothing is rendering anymore. My hypnotoad isn't finding any templates now, I've verified that the paths are correct, file perms, path on disk, etc.
02:30 jberger PanzerBjorn, are you using the basic folder structure or are you appending to the renderer paths
02:30 jberger meaning do you just have 'templates' folder in the application root
02:31 jberger or are you doing something more creative
02:31 PanzerBjorn Using the basic folder structure, though my templates folder is a directory hardlink
02:31 PanzerBjorn I wanted to separate out the templates and public folders into a shared location for multiple appservers.
02:33 jberger at first glance that sounds like that should work, but to test, you might try copying them back
02:34 PanzerBjorn Good idea.
02:35 gryphon joined #mojo
02:38 PanzerBjorn Well damn.
02:38 PanzerBjorn Copying them over made it work. It's like magic.
02:38 bpmedley Is the hardlink across disk boundaries?
02:39 PanzerBjorn Nope, it wasn't.
02:39 PanzerBjorn The link was just /www/sitename/mojo/appname/templates to /www/sitename/mojo/shared/templates
02:47 ka2u joined #mojo
02:53 Gedge joined #mojo
03:00 PanzerBjorn Thanks for the help, @jberger =)
03:01 PanzerBjorn Everything is running fine now, instead of trying to use a sub-folder I've just conglomerated a couple classes into one aptly named class and put it's specific templates into a non-camel-case subfolder of the same name. Problem solved.
03:02 jberger cool
03:02 jberger glad it worked
03:03 bpmedley sri: Are you still interested in the ->wait usage?
03:03 sri bpmedley: i was only interested in it to show you where it's blocking, don't think that's necessary anymore :)
03:04 bpmedley sri: Cool, thanks.
03:07 PanzerBjorn left #mojo
03:09 Adura joined #mojo
03:10 sri BSON serialization should actually be pretty nice for a job queue... $self->job(whatever => {foo => 'bar', baz => 'yada'} => sub { my $result = shift; $self->render(json => $result->{some}{data} ) });
03:21 sri https://github.com/airblade/vim-gitgutter # wow
03:32 egopro joined #mojo
03:49 hlin joined #mojo
04:39 egopro joined #mojo
04:42 egopro joined #mojo
04:42 sh4 joined #mojo
04:44 andrefs joined #mojo
04:55 andrefs joined #mojo
04:56 preflex_ joined #mojo
04:59 mattastrophe joined #mojo
05:02 ka2u joined #mojo
05:11 sh4|2 joined #mojo
05:15 mattastrophe joined #mojo
06:13 mattastrophe joined #mojo
06:15 crab looks fairly harmless.
06:15 crab urk
06:19 davido joined #mojo
06:26 yakudza joined #mojo
06:30 anewkirk joined #mojo
06:40 hesperaux joined #mojo
07:00 hrupp joined #mojo
07:20 hesperaux joined #mojo
07:21 jzawodn joined #mojo
07:34 dpetrov_ joined #mojo
07:35 Vandal joined #mojo
07:35 ver joined #mojo
07:57 anewkirk joined #mojo
08:13 fhelmber_ joined #mojo
08:16 dhg joined #mojo
08:23 suy joined #mojo
08:26 maxhq joined #mojo
08:27 chansen joined #mojo
08:29 phillipadsmith joined #mojo
08:29 ObseLeTe joined #mojo
08:51 egopro joined #mojo
09:02 d4rkie joined #mojo
09:23 dhg joined #mojo
09:37 daxim joined #mojo
09:45 mugenken joined #mojo
10:13 jpn joined #mojo
10:21 ryozi joined #mojo
10:26 n0n joined #mojo
10:27 n0n hi. maybe this one is obvious, but I can't get my HEAD requests routed to my desired action. it always takes the GET route.
10:28 n0n is it possible to have a GET and a HEAD route to different actions with same URL?
10:30 crab yes. what do your routes look like? pastebin them somehwere?
10:31 egopro joined #mojo
10:32 n0n pasting is a little involved in the moment. but basically they look like: $root->route('/')->via('HEAD')->to(action=>'meta')
10:32 n0n GET route parallel
10:32 n0n controller is set in $root
10:34 n0n basically this should work?
10:34 n0n i'll try other HTTP verbs...
10:34 crab basically it should
10:35 n0n OPTIONS works like a charm
10:35 n0n what's wrong with GET/HEAD?
10:36 crab with the information i have, i can confidently say that something must be wrong.
10:38 n0n ok, back to HEAD: just exchanged OPTIONS with HEAD in client and server and it stops working: I see the HEAD request arriving in server, but routing is wrong (wrong action)
10:40 crab that sucks.
10:40 crab i hope you can find the problem.
10:40 n0n1 joined #mojo
10:42 n0n1 yeah: and there's a mapping from HEAD -> GET in Routes::Match.... so
10:44 crab oh, sorry. yes, i forgot about that. you can't actually have separate routes for HEAD and GET.
10:54 n0n joined #mojo
10:58 n0n ping
10:59 crab pong
11:06 d4rkie joined #mojo
12:17 n0n joined #mojo
12:20 komodo joined #mojo
12:22 SmokeMachine joined #mojo
13:02 Akron joined #mojo
13:02 judofyr joined #mojo
13:02 judofyr sri: how would you debug "[Wed Mar  6 13:48:48 2013] [info] Worker 63634 has no heartbeat, restarting." ?
13:02 judofyr followed by tons of "Trying to stop worker 63634 gracefully."
13:03 judofyr until "Stopping worker 63634." and timeout? :(
13:06 Akron judofyr: changing heartbeat_timeout?
13:07 Akron judofyr: https://metacpan.org/module/Mojo::S​erver::Hypnotoad#heartbeat_interval
13:07 judofyr Akron: that doesn't really solve the problem. I want to figure out what takes ~20s blocking seconds
13:07 judofyr we might be using a blocking UserAgent-call
13:10 Akron judofyr: Ah, okay. If the blocking happens with Mojo::UserAgent you could of course set MOJO_USERAGENT_DEBUG=1, but maybe limmiting MOJO_CONNECT_TIMEOUT is better - in that case you'll see what doesn't response in time. But maybe I'm getting your question wrong.
13:11 judofyr Akron: yeah, I'm setting MOJO_USERAGENT_DEBUG now to check
13:14 SmokeMachine joined #mojo
13:14 Akron judofyr: Btw. I changed M::P::Util::Callback based on your feedback in a way, that you can now easily set the callbacks as plugin parameters. http://search.cpan.org/dist/Moj​olicious-Plugin-Util-Callback/ . Makes it more useful, I guess.
13:43 ObseLeTe joined #mojo
13:48 ObseLeTe joined #mojo
13:57 asarch joined #mojo
14:02 jberger http://mojolicio.us/perldoc/Mojolici​ous/Guides/FAQ#What_does_Worker_3184​2_has_no_heartbeat_restarting_mean
14:04 sh4 joined #mojo
14:22 d4rkie joined #mojo
14:36 gryphon joined #mojo
14:39 mugenken_ joined #mojo
14:41 bluescreen joined #mojo
14:49 ladnaV joined #mojo
14:53 btyler joined #mojo
14:58 sh4|2 joined #mojo
14:58 Vandal joined #mojo
14:59 sri \o\
14:59 sri /o/
15:00 bd hip hop hurray?
15:04 jberger == and do the harlem shake ==
15:04 ladnaV joined #mojo
15:05 jberger sri: I'm not sure of the semantics just yet
15:06 jberger but I find myself using plugin objects often
15:06 jberger and I am thinking of what can be done to make that easier
15:06 jberger the one thing I think that can be done easily is let load_plugin take constructor arguments for the plugin object
15:09 sri i think that ship has sailed, huge plugin changes are not gonna happen
15:10 jberger at least that change to load_plugin doesn't break anything (I'm testing it right now, but it shouldn't)
15:11 wk joined #mojo
15:11 jberger with that primative, I should be able to bolt the rest on without any problems, even as an extension
15:11 * sri doesn't like it
15:12 jberger http://pastie.org/6404793
15:13 sri load_plugin is not enduser api, and your addition wouldn't be used by anything in the framework
15:13 nicolaas joined #mojo
15:13 jberger not yet
15:13 jberger but its a paradigm that I'm really liking for my plugins
15:13 jberger it allows easier setting of defaults for helpers
15:14 sri which conflicts with how we configure plugins now
15:14 jberger more complex helpers like my column/columns for presentations
15:14 jberger not necessarily
15:15 jberger this isn't a fully baked idea yet, maybe I shouldn't have brought it up yet
15:15 sri you either end up with two ways to configure plugins, or you deprecate the way almost all plugins on cpan are configured
15:16 Molaf__ joined #mojo
15:16 Akron joined #mojo
15:17 nicolaas hello .. i want to render templates using a layout, but some of them don't have to add anything to the layout content. However, as my code dynamically render the so-called template, i MUST create an empty file for this template name. Is there any way to avoid this ? Or should i check if the template exist and render a default template if not ?
15:17 sri two is pretty much out of the question, and one would be pretty ugly, since you could never expose one of the ways through app->plugin()
15:19 sri jberger: maybe not ;p
15:20 jberger sri: http://pastie.org/6404826
15:20 jberger again, just an idea
15:20 Akron nicolaas: If I remember correctly, you can do "return $self->render('temlate1') or $self->render('template2');"
15:22 sri jberger: better, but have you checked if all existing plugins would keep working?
15:23 jberger I think that paste is more likely to break mine than others :-P , but no I haven't checked
15:24 jberger there must be some way to use metacpan to list all the modules under Mojolicious::Plugin and pipe them to cpanm right?
15:24 * jberger looks at metacpan api
15:24 Akron jberger: I don't understand when these parameters are passed to the plugin.
15:24 jberger Akron, the problem is that using attributes with the current mechanism is really cumbersome
15:25 sri jberger: i can see this go horribly wrong if someone wants to use Moose instead of Mojo::Base for example
15:25 Akron jberger: You mean, as the object is not directly exposed?
15:25 sri you would have to have attributes for all config options
15:25 jberger sri: that is a valid point
15:27 jberger sri: in my perfect world, with the change I proposed to load_plugin I would build (form myself at first) another 'plugin'-like method which loads objective plugins
15:27 jberger and probably stores the object somewhere so I don't keep having to make a helper which closes over it for that
15:27 jberger s/form/for/
15:29 jberger see how I use plugins here: https://github.com/jberger/Mojoliciou​s-Plugin-SimpleSlides/blob/master/lib​/Mojolicious/Plugin/SimpleSlides.pm
15:30 jberger and here: https://github.com/jberger/Mojolicious-Plugin-Hum​ane/blob/master/lib/Mojolicious/Plugin/Humane.pm
15:30 Akron jberger: I see. For M::P::BlogSpam I just appended a new package ... but I don't really know if this works with inline data.
15:31 jberger its just an idea I'm floating to get the thought percolating through the right minds
15:31 Vandal joined #mojo
15:31 jberger I think plugins with attributes work really nicely, once you have them built and stored
15:32 sri what's so wrong with return $plugin?
15:32 jberger can't get it back later
15:32 jberger I do return $plugin
15:32 sri app->plugin('Foo')->bar(1)->baz('test') is not that bad
15:32 jberger yeah, when there are only a few options
15:33 sri perhaps you want a more meta-ish base class for your plugins that configures attributes based on config options?
15:35 jberger not sure I follow, do you mean the app-wide config options?
15:35 jberger thats not a bad idea
15:35 sri something that provides a register sub for you, and you overload different methods
15:35 judofyr $self->$_($config->{$_}) for keys %config   ?
15:35 sri package MyPlugin; use Mojo::Base 'JBerger::Plugin';
15:35 judofyr oops: keys %$config
15:36 jberger judofyr, thats not terrible
15:36 sri $plugin->can($_) and $plugin->$_($config{$_}) for keys %config
15:36 sri judofyr: heh :)
15:37 judofyr sri: I'd rather croak (or is it confess?) :)
15:37 judofyr fucking Carp
15:37 judofyr … than silently ignoring options
15:37 * sri nods
15:43 jberger this is more like what I would LIKE, not sure about just everything yet, but down this road
15:43 jberger http://pastie.org/6404928
15:46 arpadszasz joined #mojo
15:46 jberger just a silly thought
15:47 jberger though to be honest, I'm starting to think that judofyr's line of reasoning works fine too
15:47 judofyr \o/
15:48 judofyr jberger: I just like to remind you that the previous time sri accepted an idea from me, we ended up with like 7 layers of deprecations warnings :/
15:48 jberger I do remember that
15:48 judofyr (I still haven't fixed it in all of my apps)
15:48 jberger :-)
15:48 jberger hahha
15:48 ladnaV joined #mojo
15:48 jberger thats what you get!
15:48 jberger but that one is a great idea
15:52 jberger I'm liking the subclass idea
15:53 jberger I will let that one roll around in the ol' noodle for a few hours as I go in to work
15:53 jberger on that note, its time to start getting ready
16:03 bluescreen_ joined #mojo
16:06 maxhq joined #mojo
16:15 maxhq joined #mojo
16:21 mattastrophe joined #mojo
16:26 basiliscos joined #mojo
16:34 maxhq joined #mojo
16:41 mattastrophe joined #mojo
16:44 maxhq1 joined #mojo
16:50 btyler joined #mojo
16:57 bpmedley_ joined #mojo
17:07 Vandal joined #mojo
17:07 sri jberger, marcus, tempire, crab: think we should do anything about the Encode memory leak?
17:09 sri like a pubic warning to tell people to upgrade to Encode 2.49
17:09 sri *public
17:09 sri tweet or list post perhaps?
17:13 sh4|3 joined #mojo
17:15 maxhq joined #mojo
17:15 amirite_ joined #mojo
17:15 amirite_ any plugins for tracking memory leaks?
17:15 amirite_ i used one for catalyst once
17:16 xaka joined #mojo
17:42 dummy_jb_ joined #mojo
17:43 jberger__ sri: is it likely to be a big issue? (re: Encode)
17:43 jberger__ it looked like a very specific case and a slow leak
17:43 jberger__ never hurts to spread the word though
17:43 jberger__ frame it as "the success of open source" a random bug report, the quick work of devs and software gets better
17:46 jjj joined #mojo
17:47 jjj i know it's weird but can I use Moose and Mojo::Base 'Mojolicious::Controller' in a same class ?
17:47 jjj just to make sure the attributes won't change by setting them 'ro'
17:48 mattastrophe joined #mojo
17:56 wk joined #mojo
17:58 jberger__ jjj, you can define your Controller class using Moose I believe
17:58 ObseLeTe joined #mojo
17:59 jberger__ otherwise you probably should just override the default accessor
18:03 maxhq joined #mojo
18:08 sh4|3 joined #mojo
18:14 xaka joined #mojo
18:19 dpetrov_ joined #mojo
18:22 arpadszasz joined #mojo
18:30 sri jberger__: yes, hypnotoad protects pretty well against the attack
18:31 sri it's just other deployments that might be at risk, like PSGI servers or the normal daemon
18:35 sri it's good we expect all web apps to leak :)
18:35 jberger__ sri: hmmm, see my non-webdev side just showed I think
18:35 jberger__ I don't think of memory leaks as attack vectors
18:35 jberger__ which I guess they are
18:36 sri of course they are
18:36 sri DoS is a very valid form of attack
18:36 jberger__ right, but I forget that a memory leak makes DoS attack easier
18:36 jberger__ read faster
18:37 * jberger__ doesn't have a malicious bone in his body (except when it comes to the Detroit Red Wings)
18:37 jberger__ :-)
18:38 * sri thinks that sounds like a regional dish
18:39 dhg joined #mojo
18:40 * sri is hungry now
18:40 jberger__ sri: so your debate is the common one for security vulnerablilities: if you publicize the problem (so people upgrade) do you increase the likelihood of attackers using the problem
18:40 jberger__ haha
18:40 jberger__ actually the food associated with Red Wings fans is actually octopus
18:41 jberger__ but thats a story for another day
18:41 sri :o
18:42 sri it's not just mojolicious, catalyst is also affected, and there are prolly a lot more
18:42 jberger__ right
18:43 jberger__ so you can't just whisper into the ear of every dev community, there are too many
18:43 jberger__ I don't know how security policy like this should act
18:44 sri i've notified some, like i do every time
18:45 sri my last big leak was in HTTP::Headers and affected basically every web app under the sun :)
18:45 jberger__ yikes
18:45 jberger__ on another note: http://pastie.org/6405926
18:46 jberger__ ack, theres a typo too
18:46 jberger__ $plugin->$attr( delete $conf->{$key} );
18:46 sri decamelize() supports :: already
18:46 sri becomes -
18:47 jberger__ but I just want the last name
18:47 sri oh, you just want the last part
18:47 jberger__ and you can't have helpers with names like -
18:48 jberger__ that name becomes the helper that holds the instance
18:49 sri looks like the Encode fix will be in the upcoming security release of perl 5.8 - 5.16
18:49 jberger__ good
18:49 jberger__ sri++
18:50 jberger__ nice find sir (yes that's sir)
18:50 sri everybody will have to upgrade for the rehashing flaw anyway
18:50 sri http://www.xray.mpe.mpg.de/mailing-lis​ts/perl5-porters/2013-03/msg00160.html
18:50 * jberger__ reads
18:53 jberger__ and the encode fix will go out in the same release you say?
18:53 sri hopefully
18:54 jberger__ cool
18:56 Kovensky joined #mojo
19:03 marcus sri: hey
19:04 marcus sri: $collection->insert($data) modifies $data ? (inserts _id)
19:05 sri that's how all mongodb drivers work
19:08 sri https://github.com/kraih/mango/blob/m​aster/lib/Mango/BSON/ObjectID.pm#L21
19:08 sri that's where the id is generated, there are specific rules for it
19:09 sri the server can actullt insert a _id for you too, but then you have no way of knowing it
19:09 sri so all drivers handle it client side
19:11 sri marcus: how is your coding dojo going?
19:13 sri if there are any questions, forward them to irc, i'll be around :)
19:21 marcus sri: It's ok. But you also return the id from the insert call?
19:22 marcus so why does it need to modify the hashref you pass in?
19:27 sri marcus: i guess that part is arguable, it's just how it works in the ruby and python drivers
19:27 yakudza joined #mojo
19:33 nour joined #mojo
19:43 sri https://speakerdeck.com/jmikola/​mongodb-whats-new-in-aggregation # nice slides about the aggregation pipeline btw
19:46 jberger__ sri: you could localize the _id field before sending to the server, dynamic scoping is useful tool we have that at least python (and ruby?) dont have
19:47 sri jberger__: it's not so much about the how, but about the why ;)
19:49 jberger__ I haven't used Mango/Mongo much (yet!) but I would be confused if I suddenly had more keys in a data structure after an insert
19:50 sri node.js driver does it too
19:51 sri i believe all existing drivers do it
19:51 jberger__ but do they only do it because they would either have to clone the structure to do so?
19:51 jberger__ *to NOT do so
19:52 * jberger__ is horrified at the terrible sentance he just sent
19:52 * jberger__ needs more coffee and soon
19:52 * sri shrugs
19:53 sri guess i'll just keep an eye on it, easy to change if people stumble over it
19:57 jberger__ how do I run the mango test suite?
19:58 sri all of it?
19:58 sri do you have a mongodb running?
19:59 jberger__ yeah
19:59 sri TEST_ONLINE=mongodb://<user>:​<pass>@<host>:<port>/<dbname>
19:59 sri otherwise the usual make test
20:03 sri i usually run it against a mongohq sandbox :)
20:04 jberger__ hmmmm
20:04 jberger__ not working for me
20:04 jberger__ I'll tinker some more
20:11 stephan48 joined #mojo
20:11 jberger__ I keep getting this, more or less: am I doing something obviously wrong?
20:12 jberger__ http://pastie.org/6406458
20:13 sri odd, but the connection handling code is not very good yet
20:13 sri i'm rewriting all of it atm
20:13 sri what mongodb version anyway?
20:14 * sri is only testing against 2.2 and 2.4
20:14 * jberger__ checks
20:14 jberger__ looks like 2.0
20:15 jberger__ Installed: 1:2.0.4-1ubuntu2
20:15 sri ok, i don't care about 2.0 ;p
20:15 jberger__ fair enough
20:15 * jberger__ looks for a ppi
20:15 jberger__ ppa
20:15 sri get a free mongohq sandbox, then you know if it's platform specific
20:15 Akron joined #mojo
20:21 Akron sri: How about making the recent Encode version a prereq in the Makefile of Mojolicious for some times?
20:23 sri Akron: haha, that would make backcompat hardliners go crazy
20:24 sri Y U NO WORK ON DEBIAN!!!
20:24 jberger__ SRI: WHY MANGO NO WORK ON UBUNUTUTNU
20:25 jberger__ hehe
20:25 jberger__ I installed 2.2.3 and I'm still getting similar results
20:25 Adura Because you should be using Gentoo.
20:25 sri not even sure how linux distributions are going to fix it, they might just patch the issue and keep shipping an older version of Encode
20:25 jberger__ :-(
20:25 Akron :) "The leak is part of my workflow!"
20:25 sri ;p
20:28 sri also not sure how it's going to get patched in core, they might keep shipping the patched old version too
20:29 Akron Hm. True.
20:29 sri at least i've seen BinGOs testing that with older perls
20:30 sri in the end it's not an urgent problem for us, i've only been able to leak about 5mb per hypnotoad worker before it got restarted
20:32 ObseLeTe joined #mojo
20:32 Akron I guess I never made a web app leaking less. ;)
20:32 sri :D
20:34 btyler fi
20:34 btyler damn, wrong window, sorry.
20:34 btyler the hazards of terminal-based irc
20:35 vel joined #mojo
20:42 jberger__ ok, so tests work connecting to MongoHQ
20:42 jberger__ but not to a local instance
20:45 jberger__ sri: all that goes to show that this passes the tests: http://pastie.org/6406737
20:46 jberger__ now to add some new tests!
20:47 sri jberger__: don't put too much effort into it, i won't be applying patches anytime soon
20:47 hesperaux_ joined #mojo
20:47 sri i want to spend more time thinking about the whole design first
20:48 jberger__ I'm not
20:48 jberger__ just a curiousity more than anything
20:50 sri then knock yourself out :)
20:54 Caelum for a lite app, is it better to just define subs in the file or use helpers for utility functions?
20:57 Caelum obsession over backcompat is stupid, calcifying broken interfaces is stupid, people can fix their fucking code
21:03 jpn joined #mojo
21:14 jberger__ looks like you can't localize in a loop like I expected
21:14 jberger__ oh well
21:16 basiliscos1 joined #mojo
21:18 Caelum jberger__: I've done local $hash->{key} = $hash->{key} before, it works fine
21:19 asarch joined #mojo
21:19 Caelum jberger__: however, a postfix loop is its own scope
21:20 jberger__ Caelum: yeah, thats what I'm finding
21:21 jberger__ obviously a regular loop has its own scope, but I thought I could cheat with the postfix
21:34 jberger__ ok, yep, I think it can't be done
21:34 jberger__ (might be the first time I've said that about a Perl construct)
21:36 jberger__ Caelum: the answer to your question is: if only that controller needs the method then it should be a method
21:37 jberger__ otherwise, if say all the controllers might need it, or you need it in a template, then you want a helper
21:44 Caelum jberger__: how do I make a controller method in a lite app?
21:47 Caelum well I guess you can't really
21:47 Caelum so you either do my_helper($c) or make a helper
21:59 vel1 joined #mojo
22:03 ObseLeTe joined #mojo
22:14 BeDa joined #mojo
22:15 ObseLeTe joined #mojo
22:23 jpn joined #mojo
22:29 mire joined #mojo
22:47 jberger__ Caelum: you don't really have "controllers" in a lite app, just "callbacks" that do the work that they would
22:57 Meiermann joined #mojo
23:03 ka2u joined #mojo

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