Camelia, the Perl 6 bug

IRC log for #mojo, 2013-07-16

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

All times shown according to UTC.

Time Nick Message
00:01 dbr joined #mojo
00:15 shmuel joined #mojo
00:37 egopro joined #mojo
00:54 Foxcool joined #mojo
01:08 marcus_ sri++
01:09 russum joined #mojo
01:10 russum left #mojo
01:14 Foxcool joined #mojo
01:20 marty sri+++
01:20 btyler joined #mojo
01:45 Foxcool joined #mojo
01:48 abra joined #mojo
01:55 d4rkie joined #mojo
02:13 rem_lex| joined #mojo
02:16 tianon joined #mojo
02:24 bowtie joined #mojo
02:33 mrphilov joined #mojo
02:56 asarch joined #mojo
03:00 shmuel It there a recommended way to implement user notifications?
03:01 shmuel right now I keep an array inside the user object, and use a helper to fetch all notifications from the template
03:03 shmuel I think that it the best to do using template helper, as this is the point that I'm sure that the user is getting a page, and not redirected to somewhere else.
03:04 tianon if they only need to span a single request, they can be stored in the flash, or just in some custom session variables (which get stored in cookies)
03:04 tianon otherwise they'd need to be stored server-side as it sounds like you're already doing
03:05 shmuel the the flash?
03:05 shmuel I'm not familiar the term.
03:08 shmuel hm. it is part of the controller, and is actually stored in the session object
03:12 tianon yes, but it automatically only lives for the next request
03:13 tianon so, it's great for "Login successful" and the like
03:16 jberger shmuel, if I may self promote: check out Mojolicious::Plugin::Humane
03:16 jberger which provides humane.js
03:27 jberger btw the flash is used for presenting a message on the next request, usually this means after a redirect
03:45 shmuel jberger: thanks, but.
03:45 shmuel is flash available also to Lite apps?
03:49 shmuel it seen that it is.
03:53 jberger Lite is a very thin wrapper on full apps
03:53 jberger everything is available, with only slight changes in syntax
04:00 D4RK-PH0ENiX joined #mojo
04:21 yakudza joined #mojo
04:45 egopro joined #mojo
04:51 egopro_ joined #mojo
04:57 rem_lex|pivo joined #mojo
05:21 xablor joined #mojo
05:21 xablor Oh, cool, that worked first try. H1
05:21 xablor *Hi!
05:22 amirite joined #mojo
05:24 xablor So I'm trying to be clever and I'm not sure how to do it in Mojo. Specifically my schema has Projects, which have many Tasks, and I already have a Task controller set up to return JSON giving a list of all tasks in the system.
05:24 Britzel joined #mojo
05:26 xablor What I'd like to do is to have either the router or a sub in my Project controller set a 'source' value in the stash, with that being a DBIC resultset with all the conditions applied and then dispatch to the existing Task controller. Then if there's a source element in the stash, it uses that; otherwise it just gets its own resultset.
05:26 xablor So... how dumb is this idea? In terms of code reuse it seems good, also in terms of separation of concerns.
05:27 xablor But I'm new to both Perl and Mojo, and I'm not sure how to express it to the system, or even if it can be expressed like that.
05:27 xablor What's the room think?
05:40 mrphilov joined #mojo
06:25 yakudza joined #mojo
06:30 Mike-PerlRecruiter_ joined #mojo
06:46 russum joined #mojo
06:46 russum left #mojo
06:48 KindTwo joined #mojo
06:53 Vandal joined #mojo
06:59 nicolaas joined #mojo
07:07 KindTwo joined #mojo
07:09 dod joined #mojo
07:12 dotandimet joined #mojo
07:21 kamu joined #mojo
07:24 dpetrov_ joined #mojo
07:29 dod joined #mojo
07:36 russum joined #mojo
07:38 russum left #mojo
07:39 arthas joined #mojo
07:41 trone joined #mojo
07:54 kealan joined #mojo
08:01 fhelmber_ joined #mojo
08:33 maxhq joined #mojo
08:35 kealan joined #mojo
08:39 jzawodn joined #mojo
08:45 dod joined #mojo
08:58 kealan joined #mojo
09:01 moltar joined #mojo
09:18 batman sounds clever enough, but i would probably add a helper some_source => sub { $_[0]->stash->{some_source} ||= $DEFAULT_SOURCE };
09:30 jpn joined #mojo
09:38 ralesk_ Let's say I have a multiline text in a database, how do I present it in Mojo with line breaks? If I s/\n/<br>/ I'll end up with the < and > escaped if I print it with %=; if I print it with %== I'll have to manually fiddle with every other possible HTML thing myself
09:38 ralesk_ is there an easier way? :)
09:39 Vandal use <pre> tag
09:43 cosmincx joined #mojo
09:49 batman Ralesk: maybe you could do use Mojo::ByteStream 'b'; use Mojo::Util 'xml_escape'; %= b(xml_escape($str) =~ s/\n/<br>/gr);
09:50 batman though i'm not sure if i'm too big a fan of <br>
09:51 Ralesk yeah, me neither, but it's much simpler than <p>'ing :)
09:51 batman ;)
09:51 Vandal O_o
09:51 batman what-ever-floats-your-boat
09:52 Vandal why are you such perverts? there is a special tag for this shing - <pre>
09:52 Vandal *thing
10:09 Ralesk :D
10:11 sri heading towards 1.0... https://github.com/kraih/mango/commit/8​e76269dab93f6f96886ce2cf5ad96d17e8bebdd
10:24 sri GridFS is pretty usable now, think i might leave it like that for 0.06 https://github.com/kraih/mango/commit/8​dbc14ecc834b9e888c3a884f10e0c9027dc74ac
10:30 dod joined #mojo
10:32 ilyuhan joined #mojo
10:59 batman sri: did you see my plugin-cgi module? wanna comment? https://metacpan.org/modul​e/Mojolicious::Plugin::CGI
11:14 bpmedley joined #mojo
11:17 yakudza joined #mojo
11:31 whitebook joined #mojo
11:39 ver joined #mojo
11:44 avkhozov_ joined #mojo
11:48 punter joined #mojo
12:00 dotan joined #mojo
12:01 logioniz joined #mojo
12:09 logioniz is it possible to do asynchronous bridge in mojolicious app? Example:  I have this  "my $api = $r->bridge('/api')->to('api#auth');" in startup function. In auth function i have this:  $db->collection('user')->find_one({_id => $uid} => sub {...});
12:11 shmuel joined #mojo
12:11 dod joined #mojo
12:14 bowtie joined #mojo
12:15 dod joined #mojo
12:37 batman logioniz: i don't think so. what i do is this inside my controller action: Mojo::IOLoop->begin($self->some_auth_helper, sub { my($delay) = @_; do_logged_in_stuff() }, sub {...});
12:38 batman logioniz: some_auth_helper() return sub { my($delay) = @_; $self->db->colection... }, sub { my($delay, $authenticated) = @_; return $self->render('login') unless $authenticated; $delay->begin->(1); }
12:38 batman or something like that
12:40 dod1 joined #mojo
12:45 logioniz thanks, understand.
12:52 russum joined #mojo
12:55 russum left #mojo
13:16 batman np
13:21 bowtie joined #mojo
13:24 russum joined #mojo
13:24 russum left #mojo
13:32 bluescreen joined #mojo
13:38 moltar_ joined #mojo
13:39 gryphon joined #mojo
13:41 abra joined #mojo
13:48 bowtie joined #mojo
13:53 arthas joined #mojo
14:02 bd can I tell a mojo app using daemon to reload if a file changes. morbo does that by itself but i can not use ioloop with morbo
14:07 asarch joined #mojo
14:08 mrphilov joined #mojo
14:08 btyler joined #mojo
14:12 hrupp_ joined #mojo
14:18 sh4 joined #mojo
14:18 bowtie joined #mojo
14:29 batman "i can not use ioloop with morbo" <-- what do you mean about that?
14:30 batman all the mojo daemons use Mojo::IOLoop (except of the parent process keeping the children alive)
14:31 dod joined #mojo
14:32 anielsen joined #mojo
14:36 nic bd: If you're using hypnotoad, restarts are easy by monitoring via inotify
14:37 nic (if you're using bare daemon, then I'm confused why you can't use morbo)
14:39 bowtie joined #mojo
14:47 cosmincx joined #mojo
14:48 bowtie_ joined #mojo
14:52 bd nic: morbo doesn't support IOLoop and I need to do stuff in the background
14:56 nic bd: morbo is just daemon with the addition of inotify-equivalent
14:57 bowtie joined #mojo
14:58 crab "morbo doesn't support IOLoop"?
14:58 nic I'm guessing you mean you need multi-process (hypnotoad)
14:58 crab nic: it's not inotify, it's just a loop with a whole bunch of stat calls
14:58 crab well, you did say equivalent
14:58 nic indeed
14:59 crab nic: have you built something using inotify to reload hypnotoad, btw? i'd be interested in a copy
14:59 batman bd: morbo = two processes: the parent does inotify-stuff and restarts the child. the child is process running ioloop - that is Mojo::IOLoop
14:59 nic (I meant equivalent in aim, not implementation)
14:59 crab it sounds like only a few lines of code, but nice.
14:59 bd hm, let me test somethign and get back to you guys
15:00 batman crab: i did that. i think it's a really bad idea :P
15:00 batman crab: ended up with https://metacpan.org/modul​e/Toadfarm::Plugin::Reload instead :)
15:01 nic inotify is wonderful, but not portable
15:02 nic crab: sorry, didn't see your question.  Nope, I use inotify to re-run unit tests; restarting hypnotoad would be as easy or easier
15:04 nic http://larig.wordpress.com/category/pkg/inotify is where I scribbled some notes
15:04 crab thanks.
15:04 bowtie_ joined #mojo
15:05 * crab peruses Toadfarm
15:08 bd aww man, I completely mixed up my ioloop problem with an inotify one
15:08 bd nic: morbo works fine
15:08 nic \o/
15:09 bd because morbo and l::inotify2 won't work together: http://bc-bd.org/blog/mojoliciou​s/mojolicious-and-linuxinotify2
15:13 nic bd: What happens when you try that example with morbo?
15:14 nic I can see that it wouldn't work if you did "morbo -w /tmp/foo /tmp/i.pl" but if you're not watching the same file, what happens?
15:16 bd nic: honestly I don't remember. i should have written that down ;)
15:16 nic :)
15:17 bd nic: what happens is, no inotifies are delivered
15:20 bd and the code desn't work (anymore). it's not my day.
15:34 bd nic: ok fixed it, the code runs now with daemon, but morbo still eats inotify events
15:36 bowtie joined #mojo
15:38 nic bd: Your link to Linux::Inotify2 is bad -- directing browsers to a site of poor reputation
15:40 bowtie_ joined #mojo
15:40 delias joined #mojo
15:41 bd nic: thx. also EV now points to a 404
15:43 jpn joined #mojo
15:44 delias joined #mojo
15:48 delias joined #mojo
15:49 bobkare joined #mojo
15:50 kealan joined #mojo
15:55 d4rkie joined #mojo
16:08 denisboyun joined #mojo
16:09 bluescreen joined #mojo
16:11 Britzel_ joined #mojo
16:13 prk joined #mojo
16:17 russum joined #mojo
16:18 russum left #mojo
16:19 dod joined #mojo
16:36 ilyuhan joined #mojo
16:58 mtths joined #mojo
17:01 yakudza joined #mojo
17:02 mtths joined #mojo
17:03 russum joined #mojo
17:03 russum left #mojo
17:17 bowtie joined #mojo
17:17 bowtie_ joined #mojo
17:27 bowtie joined #mojo
17:34 bowtie_ joined #mojo
17:42 xablor left #mojo
17:42 kealan joined #mojo
17:54 btyler joined #mojo
18:04 bowtie joined #mojo
18:08 trone joined #mojo
18:12 bowtie_ joined #mojo
18:13 ilyuhan joined #mojo
18:22 good_news_everyone joined #mojo
18:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/HU1cbw
18:22 good_news_everyone mojo/master dd5b9e4 Sebastian Riedel: explain how numeric values are detected in Mojo::JSON
18:22 good_news_everyone left #mojo
18:26 sri can't think of a better example :S
18:27 batman any idea on how to write this prettier: https://gist.github.com/jhthorsen/6011255
18:28 sri my $end = $delay->begin; ... => sub { $end->(pop, $foos) }
18:30 Mike-PerlRecruiter_ joined #mojo
18:30 batman sri: https://gist.github.com/jhtho​rsen/6011255#file-foos-pl-L25 ?
18:31 sri oh right, that's another way :)
18:31 sri mine was less pretty
18:31 sri you could even do $delay->begin->($foos);
18:32 sri oops
18:32 batman no, because that will trigger the next sub{} before $db has been able to be ready
18:32 sri $delay->begin(1)->($foos)
18:32 sri *after* the ->get
18:32 batman begin(1) ?
18:32 * batman checking the docs
18:32 sri argh
18:32 sri not my day
18:33 sri $delay->begin(0)->($foos)
18:33 sri still after the ->get call
18:33 sri actually, i don't think order matters
18:34 batman okey. what's the difference between begin(0), begin() and begin(1) ? i don't get the docs :(
18:34 batman order does matter
18:34 sri i remember changing logic to prevent the next event from firing right away
18:34 batman at least if i just do $delay->begin->(undef, $foos);
18:34 batman in which version?
18:34 sri 4.x?
18:34 * sri shrugs
18:35 batman okidoki. then i'm probably wrong :)
18:35 sri it should trigger a zero timer which delays the next closure
18:35 batman suggestion: would you mind adding $delay->stash(key => $value) ?
18:35 sri yes i would mind
18:36 batman what about $delay->heap(key => $value) ...?
18:36 batman :D
18:36 sri -.-
18:37 batman https://metacpan.org/source/SRI/Mojolic​ious-4.18/lib/Mojo/IOLoop/Delay.pm#L42 # <-- me like
18:37 batman makes my day
18:38 batman about the begin(0) doc: "...the first argument will be ignored by default." <-- i don't get that "0" means don't ignore it
18:39 sri that's why there's an example below
18:39 batman hm... ok. guess it's just me.
18:40 batman what would be so bad about stash() ?
18:41 preflex_ joined #mojo
18:43 whitebook joined #mojo
18:46 good_news_everyone joined #mojo
18:46 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/tgEfOg
18:46 good_news_everyone mojo/master 2a3b3a4 Sebastian Riedel: documentation tweaks
18:46 good_news_everyone left #mojo
18:48 Moataz-E guys has anybody encountered issues with using Validate::Tiny in Mojolicious?
18:50 denisboyun joined #mojo
18:55 prk joined #mojo
19:00 abra_ joined #mojo
19:42 met joined #mojo
19:46 denisboyun joined #mojo
19:48 rafl joined #mojo
19:55 dji joined #mojo
20:01 rem_lex joined #mojo
20:04 bowtie joined #mojo
20:11 bowtie_ joined #mojo
20:13 dod joined #mojo
20:14 Moataz-E joined #mojo
20:16 dotandimet joined #mojo
20:21 ColonelPanic001 left #mojo
20:25 crab sri?
20:25 sri crab?
20:25 crab at one time i used to think you were too quick to close pull requests/bug reports, but now i have seen the light
20:25 sri :)
20:27 crab it costs little for someone to take $feedback and reopen another request, but the costs of taking a less proactive approach (e.g. saying "you should submit tests" and leaving the request open) are non-zero, and actually _rise_ with time because then you have more open items to deal with (and that in turn may lead to people thinking "oh, they have so many open pull requests")
20:27 crab i think you've said all of those things in pieces at various times, but i never quite put it all together until #514
20:29 bowtie joined #mojo
20:32 bowtie_ joined #mojo
20:45 sri yea
21:11 espent joined #mojo
21:12 abra joined #mojo
21:23 whitebook joined #mojo
21:24 moltar joined #mojo
21:31 lukep joined #mojo
21:41 BeDa joined #mojo
21:45 punter joined #mojo
22:02 russum joined #mojo
22:02 russum left #mojo
22:26 marty The most awesome thing in the world is mojo/mango/mongo interfacing with a javascript editing grid and editing nested mongodb objects as table data.   Sooooo flexible, and no joins!
22:27 omf_ left #mojo
22:29 bowtie_ joined #mojo
22:29 bowtie joined #mojo
22:43 * sri thinks he'll release 0.06 tomorrow, unless there are any complaints about the api
22:45 sri mango is now at 1212 lines of code, not bad for a whole mongodb driver :)
22:56 marty That's pretty amazing actually.   You could tac a few zero's on there if I wrote it.  :)
22:56 marty mango has been very stable here.   \o/
22:58 * marty complains that the api does not write his code for him and make coffe..... ALL GLORY TO THE HYPNOTOAD
23:04 bowtie joined #mojo
23:05 sri ALL GLORY TO THE HYPNOTOAD!
23:12 tianon we've been using Mango very successfully for a while now here, loving the new GridFS additions
23:13 tianon sri++
23:16 StinkfooT joined #mojo
23:22 amirite_ joined #mojo
23:42 bowtie joined #mojo
23:43 bowtie_ joined #mojo

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