The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2014-08-19

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

All times shown according to UTC.

Time Nick Message
00:00 s1037989 joined #mojo
00:38 disputin joined #mojo
00:40 jberger I'm here
00:40 jberger working and cooking
00:40 jberger I'm actually really confused
00:40 jberger does your warmup actually fix things?
00:41 woz joined #mojo
00:45 neilhwatson joined #mojo
00:48 jberger I'm trying with some simple cases and I'm having trouble
00:50 sujithm joined #mojo
00:53 jberger Tried making a script that does fork and tell and it does not fail as i would expect
00:56 sri jberger: if you comment out this line you'll see it fail again https://github.com/kraih/mojo/blob/master/lib/Mojolicious.pm#L193
00:57 sri my warmup moves all interactions with DATA to the parent process
00:59 sri that's why it's also good for memory usage, stuff gets loaded upfront, and can be shared by all forked processes
01:05 laouji joined #mojo
01:13 woz joined #mojo
01:20 preaction joined #mojo
01:29 jberger sri: so why doesn't this fail: http://pastie.org/9484551
01:29 jberger I was trying to make a failing test and I can't
01:31 sri i only ever managed to make that one failing test case :)
01:32 jberger I thought this was going to work:
01:32 jberger IO::File->new->fdopen(POSIX::dup($fh), 'r')
01:33 jberger with some appropriate checking
01:34 sri a) POSIX is not portable, and b) i don't think the dup() syscall behaves any different than what Perl does currently
01:35 jberger well, not only do I now think I was wrong, I can't make a failing case for the seek pointer
01:35 sri in fact, i'm almost certain the shared seek pointer comes from the operating system
01:35 jberger I tend to agree at this point
01:36 sri "Note that file descriptors created by dup(2) or fork(2) share the current file position pointer, so seeking on such files may be subject to race conditions."
01:36 sri http://man7.org/linux/man-pages/man2/lseek.2.html
01:37 disputin joined #mojo
01:39 sujithm joined #mojo
01:40 klapperl_ joined #mojo
01:42 jberger ok, ok, ok, I give
01:47 ilbot2 joined #mojo
01:47 Topic for #mojo is now ūüźĮ hear me roar | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
01:48 jberger do you think it restores the seek pointer to where the other process thought it was, unless you happen to hit it during the read?
01:48 sri no clue what it is
01:49 sri it doesn't work
01:49 purl It's a Y2K error!  Panic!  Sue!
01:49 * sri panics
01:49 * jberger panics
01:49 * jberger sets tianon on fire
01:50 * sri pours some kerosene into the fire
01:50 * jberger throws purl on the fire, for good measure
01:55 crab joined #mojo
01:55 * jberger throws crab on the fire too
01:56 * jberger turns tianon, he's starting to cook unevenly
01:59 * tianon is thankful
01:59 * tianon appreciates being evenly cooked
01:59 jberger care for a glaze?
02:10 hesco joined #mojo
02:12 jnbek lol
02:23 woz joined #mojo
02:46 noganex_ joined #mojo
03:01 sri jberger: btw. you got an opinion on routes to helpers?
03:05 sri the idea was to make code reuse easier, inspired a bit by action composition in play
03:12 tianon jberger: ooh, a glaze would be divine :D
03:12 tianon probably makes the meat more tender too
03:23 woz joined #mojo
03:24 jberger sri: I think I have to let that one soak in the grey matterh
03:24 jberger I think something like it would be helpful, but I have to think about structure
03:26 jberger this is my use-case: https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L203-L229
03:32 jberger make that: https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L203-L225
03:37 sri jberger: of course, i need to think some more about it as well
03:39 jberger I keep making my auth bridges simpler :s
03:39 jberger https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L203-L223
03:41 sri i have another url_for optimization btw. https://gist.github.com/anonymous/986cf5c77ac1766baa4d
03:42 sri https://gist.github.com/anonymous/995394e6e6212297bb5c # not so radical results this time, but might still be worth it
03:43 sri payoff gets bigger the more slash separated elements you have
03:43 sri basically, only routes with a placeholder need to be rendered anymore
03:43 * sri pokes marcus too
03:44 jberger I haven't followed these optimizations as closely
03:44 sri "/foo/bar/baz" = no rendering, "/foo/:bar" = rendering
03:44 jberger is there a downside?
03:44 sri more complexity
03:45 jberger wait, without a placeholder what doesn't get rendered?
03:46 sri https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Routes/Pattern.pm#L67
03:46 sri that code rebuilds every route
03:46 sri from an AST
03:47 sri my patch makes it use a cached copy of the original route if there are no placeholders, since those paths never look different
03:47 jberger hmmmmm
03:47 jberger I guess I haven't looked at this before
03:50 jberger does seem silly to continually rebuild a thing which cannot be changed
03:56 preaction_ joined #mojo
04:05 Averna joined #mojo
04:24 woz joined #mojo
04:31 mr-foobar joined #mojo
04:31 zivester joined #mojo
04:32 hesco joined #mojo
05:02 irq joined #mojo
05:04 jwang joined #mojo
05:25 preaction_ joined #mojo
05:25 woz joined #mojo
05:41 basiliscos joined #mojo
06:04 denis_boyun joined #mojo
06:26 woz joined #mojo
06:41 KCL_ joined #mojo
07:04 dvinciguerra joined #mojo
07:09 fhelmber_ joined #mojo
07:11 rawler joined #mojo
07:27 woz joined #mojo
07:39 Vandal joined #mojo
07:39 dexteruk joined #mojo
07:48 woz joined #mojo
08:21 noganex_ mh... that's odd. i'm setting a session attribute in a controller and it is available in every controller, but not via $self->app->session
08:28 noganex_ https://gist.github.com/anonymous/f9d276754dc7cb75bfc0
08:33 Eke- joined #mojo
08:40 arthas joined #mojo
08:48 batman noganex_: that's not strange. app() is not connection specific
08:48 noganex_ oh
08:48 batman connection / transaction / request / ...
08:48 batman app() is shared between all the requests
08:48 batman you should not modify app() from a controller, unless you're absolutely sure what you do.
08:52 noganex_ mh... ok. thanks batman.
09:01 marcus hey.
09:02 marcus sri: Looked at your patch now, I think it's a nice win.
09:04 batman noganex_: does that code actually do anything..? doesn't it die?
09:04 batman i was not aware that you could call controller methods on the application
09:05 batman noganex_: also, why did you think you were supposed to call that method on app() ?
09:05 batman the reason i ask, is to figure out if there's some basic thing that you might have missed out on...
09:05 noganex_ batman: that's what i get: https://gist.github.com/anonymous/53c8d6f7f845309f8a79
09:06 batman it's rather important to not do anything with app from an action --- except fetching config() data, logging, ...
09:06 noganex_ it makes sense to me now. :)
09:07 batman noganex_: which mojo version do you have?
09:07 noganex_ 5.27
09:09 batman have you add some helper or plugin which provide the session() method?
09:09 batman or have you added it yourself to Narf.pm ?
09:09 noganex_ no
09:09 noganex_ i just called mojo generate app Narf and edited the controller
09:09 batman ok
09:10 batman can someone explain to me how it's possible to call session() on app() ? :(
09:11 marcus batman: note what his dump shows.
09:11 marcus app has a  Mojolicious::Sessions object
09:12 noganex_ marcus: sorry. that was just some tinkering
09:12 batman marcus: yeah, but it's stored under sessions()
09:13 noganex_ i'll upload the complete code and output
09:14 batman oh. session is a helper
09:14 noganex_ https://gist.github.com/anonymous/0245bd4bfed5963c7261
09:14 batman of course it is :(
09:14 marcus ;)
09:15 * batman hides
09:15 batman noganex_: are you familar with helpers?
09:15 noganex_ yes
09:16 chansen joined #mojo
09:16 batman ok. so helpers are available as methods on both $app and $controller, so but when you call them as a method on $app, a new controller object is created and not the current
09:17 batman that makes sense, since you can't have the current controller object messing around with $app :)
09:17 * batman need to get some lunch
09:18 marcus https://github.com/Nordaaker/convos/issues/129
09:21 irq joined #mojo
09:24 marcus oi, wrong channel.
09:27 lb could've been worse
09:30 marcus lb: I put on my robe and wizard hat.
09:46 tianon I'm the mightiest sorcerer of the lands.
10:07 D4RK-PH0ENiX joined #mojo
10:12 bc547 joined #mojo
10:31 d4rkie joined #mojo
10:38 batman joined #mojo
10:38 jberger_ joined #mojo
10:39 marcus joined #mojo
10:39 batman jberger: i see the bug with missing [ in nick as well now :(
10:42 batman jberger: will fix it now
10:59 neilhwatson joined #mojo
11:00 batman jberger: i've fixed it in master now, but not restarted demo.convos.by
11:39 jberger batman++
11:48 mishantil So what is the rational way to check (in tests) if a certain session-variable has been set after a request?
11:48 mishantil My doc-fu is not helping me. :-/
11:50 sri marcus: i actually found an even simpler optimization :) https://gist.github.com/anonymous/d5c226f5f42f5f9b1b1f
11:51 sri that one combines "text slash text" into one op in the AST
11:51 sri for about the same performance gain
12:04 good_news_everyon joined #mojo
12:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lvvGLg
12:04 good_news_everyon mojo/master 8e12216 Sebastian Riedel: optimize static path rendering
12:04 good_news_everyon left #mojo
12:06 sri all kinds of routes with static parts benefit from that one actually
12:16 Kripton joined #mojo
12:21 irq joined #mojo
12:26 dvinciguerra joined #mojo
12:31 cpan_mojo Mojo-Redis2 0.05 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojo-Redis2-0.05
12:38 mr-foobar joined #mojo
12:45 sujithm joined #mojo
13:02 basiliscos joined #mojo
13:05 zivester joined #mojo
13:12 marcus sri: sweet
13:19 s1037989 joined #mojo
13:24 dexteruk_ joined #mojo
13:24 dexteruk__ joined #mojo
13:25 * sri wonders if we should advertise the fact that mojolicious is so small (just 9000 lines)
13:25 nicomen_ hm, did you ever try FatPacking it?
13:29 hesco joined #mojo
13:42 sh4 joined #mojo
14:00 irq_ joined #mojo
14:02 ladnaV joined #mojo
14:02 good_news_everyon joined #mojo
14:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/gp1oCQ
14:02 good_news_everyon mojo/master 62c3e1f Sebastian Riedel: mention that controller values get decamelized
14:02 good_news_everyon left #mojo
14:29 ryozi joined #mojo
14:43 good_news_everyon joined #mojo
14:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/yNUUzg
14:43 good_news_everyon mojo/master 4de64f7 Sebastian Riedel: text is more common now
14:43 good_news_everyon left #mojo
14:47 sri btw. routes to helpers are still up for discussion
14:48 sri as in formalizing $r->route('/')->to(cb => $app->renderer->helpers->{foo})
14:48 sri with something like this patch https://gist.github.com/anonymous/4e1944be44244056e89f
14:49 sri which does basically the same for $r->route('/')->to(cb => 'foo'), but also gives us useful log messages
14:50 sri of course it's only a primitive
14:50 sri there could be wrappers around this like my $bridge = $r->steps(qw(foo bar baz));
14:51 sri which is equal to my $bridge = $r->bridge('/')->to(cb => 'foo')->bridge('/')->to(cb => 'bar')->bridge('/')->to(cb => 'baz');
14:52 sri the idea is to make code reuse easier, put reusable authentication steps on cpan
14:53 sri $app->plugin('MySuperAuthStuff'); my $auth = $r->steps('super_auth', 'more_auth'); $auth->get(...);
14:54 sri or of course with nested helpers :D
14:54 sri my $auth = $r->steps('super_auth.basics', 'super_auth.more');
14:55 sri jberger, batman, tempire, marcus, crab: don't say anything yet, just think about it
14:55 * marcus just lost the game.
14:56 moritz OH NOEZ, you losted it!
14:56 sri :O
14:56 marcus sri made me think of it.
14:57 sri play framework has this fun concept of composable actions https://www.playframework.com/documentation/2.0/ScalaActionsComposition
14:57 sri (ignoring how ugly scala can actually be)
14:59 sri but seriously... this stuff puts perl to shame! "def LoggingAction[A](bp: BodyParser[A])(f: Request[A] => Result): Action[A] = {"
15:00 marcus wow that's ugly
15:01 cpan_mojo AnyEvent-WebSocket-Client 0.26 by PLICEASE - http://metacpan.org/release/PLICEASE/AnyEvent-WebSocket-Client-0.26 (depends on Mojolicious)
15:11 preaction joined #mojo
15:12 kbenson joined #mojo
15:12 basiliscos joined #mojo
15:26 disputin joined #mojo
15:38 basiliscos joined #mojo
15:39 Akron joined #mojo
15:42 Akron Regarding route helpers: Isn't this already possible with shortcuts? I mean - nicely packaged route plugins.
15:42 sri absolutely, like i mentioned above ;p
15:43 sri that patch is for nice log messages
15:43 sri ""[16:48:29]  <@sri> as in formalizing $r->route('/')->to(cb => $app->renderer->helpers->{foo})"
15:43 Akron Ah ... sorry. okay.
15:44 sri currently you'd just see "Routing to a callback." in the logs
15:44 sri instead of "Routing to helper "foo"."
15:48 sri i guess more important is the question of what we do about higher level abstraction if we do it
15:49 sri like $r->steps(qw(auth_helper do_stash_stuff make_coffee))
15:50 Akron Well, this can be released as a default shortcut, as far as I can see - so no need to change anything in core, right?
15:51 sri unless you want to include something in the lite dsl too
15:51 Akron Ah - that's true.
15:52 basiliscos joined #mojo
15:52 * Akron would like better integration of shortcuts in the Lite DSL all the way, but is lacking a working proposal.
15:53 sri https://gist.github.com/kraih/4351674
15:53 sri been there :)
15:54 sri biggest problem is that stuff has to happen at compile time
15:54 sri so you can't put new dsl functions into plugins
15:54 sri plugins are loaded too late
15:55 Akron Yeah - I remember. And plugins are too dynamic.
15:55 sri BEGIN { plugin 'Foo' } works, but... ugly
15:58 marcus I'm not sure I understand why we need route helpers.
15:59 marcus (Selfishly, I've never needed them). Are they for plugin authors?
16:02 sri ye
16:02 marcus So like, my Oauth2 plugin could provide a routing bridge helper?
16:02 * sri nods
16:03 marcus I guess that makes some sense.
16:03 sri oh well, i'm not fighting for it, maybe it's unnecessary
16:07 marcus To the thunderdome!
16:15 nishttal2 joined #mojo
16:16 nishttal2 how do I access POST data which was not part of a form (I'm posting a JSON string using jQuery AJAX)
16:17 nishttal2 here is how I am posting from the browser .. http://pastebin.com/Ur0qiWT1
16:39 s1037989 joined #mojo
16:51 good_news_everyon joined #mojo
16:51 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/jh3SzA
16:51 good_news_everyon mojo/master 7bba516 Sebastian Riedel: more consistent generator commands
16:51 good_news_everyon left #mojo
16:52 _eugen joined #mojo
16:53 _eugen joined #mojo
16:57 dvinciguerra joined #mojo
17:38 basiliscos joined #mojo
17:38 br_hadrian joined #mojo
17:39 good_news_everyon joined #mojo
17:39 good_news_everyon [mojo] kraih tagged v5.31 at 0ea817e: http://git.io/0RGEZQ
17:39 good_news_everyon left #mojo
17:41 good_news_everyon joined #mojo
17:41 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/Yw5S-w
17:41 good_news_everyon mojo/master ddacae1 Sebastian Riedel: bump version
17:41 good_news_everyon left #mojo
17:41 cpan_mojo Mojolicious 5.31 by Sebastian Riedel - http://metacpan.org/release/SRI/Mojolicious-5.31
17:48 TitanOfOld joined #mojo
17:49 dvinciguerra joined #mojo
17:56 woz Hi Sri, any plans to implement a redis backend for Minion?
17:56 sri none at all
17:56 woz Bum :(
17:57 woz But thanks for the honest answer :-)
17:57 sri of course you're welcome to do it, there's support for 3rd party backends
17:57 woz I wish I could - corporate policy makes it really really frickin hard to work on any open source projects
18:00 davido_ ...and yet it's fine to rely on them.  vampiric policy-- ;)
18:02 woz Oh I am very well aware of that. Hate it.
18:03 davido_ Yeah, I wasn't digging at you... just silly policies. :)
18:04 woz It's not impossible to get authorisation to work on open source projects, but it's very close
18:04 davido_ (seemingly not well thought out, but perhaps they are)
18:04 woz Yeah I know - didn't take it as a dig!
18:14 Wim joined #mojo
18:21 Eke- joined #mojo
18:41 meshl joined #mojo
18:41 KCL joined #mojo
19:05 bobkare joined #mojo
19:11 marty joined #mojo
19:14 disputin joined #mojo
19:23 GabrielVieira joined #mojo
19:51 GabrielVieira joined #mojo
19:52 s1037989 joined #mojo
20:04 meshl joined #mojo
20:06 nic_ joined #mojo
20:08 nic__ joined #mojo
20:09 purl joined #mojo
20:11 nic__ joined #mojo
20:16 preaction joined #mojo
20:17 davido__ joined #mojo
20:19 davido_ joined #mojo
20:19 cpan_mojo Clustericious-Admin 0.24 by PLICEASE - http://metacpan.org/release/PLICEASE/Clustericious-Admin-0.24 (depends on Mojolicious)
20:23 marcus woz: Make it in your spare time? It shouldn't be hard
20:24 woz Yeah, but even then I can't contribute it back as open source
20:24 woz Not without going through an incredibly tedious approval process.
20:25 marcus Wow. Your job sounds nefarious
20:25 woz Investment Bank. Nuff said
20:25 marcus ya
20:26 davido_ That sort of thing isn't unheard of.  I know tilly went through a period of time when he wasn't even able to blog or contribute to q/a sites.
20:26 davido_ It's just unfortunate, and a little short-sighted.
20:27 genio I have to go through insane red tape to contribute to anything as well
20:27 genio it's... annoying
20:28 davido_ The companies that make such policies probably ought to find *some* way to contribute back to Open Source.  If they don't allow community / code support (or make it nearly impossible), perhaps financial support is an acceptable tack for them to take.
20:30 woz We do contribute to some open source projects, but they are very specific, and very controlled.
20:30 woz On the whole though, the rule is no open source contribution.
20:31 woz We have to be careful with blogs etc too.
20:52 sri it's actually the law in many parts of the us
20:52 sri even the stuff you make in your free time belomgs to your employer, it's crazy
21:02 * marcus is looking at Clustericious
21:02 Adura joined #mojo
21:05 btyler_ I've never heard of that sort of thing as law, rather clauses in employment contracts, few of which have been legally tested
21:06 btyler_ and I think defeated in some parts of the country, like california
21:24 meshl joined #mojo
21:41 nicomen_ are Mojo objects non-trivial to serialize?
22:26 disputin joined #mojo
22:52 bodgix joined #mojo
22:59 sujithm joined #mojo
23:43 d4rkie joined #mojo

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