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

IRC log for #mojo, 2014-08-08

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

All times shown according to UTC.

Time Nick Message
00:06 Averna joined #mojo
00:08 neyasov___ joined #mojo
00:09 d4rkie joined #mojo
00:16 jwang joined #mojo
00:23 hotsnow joined #mojo
00:27 woz joined #mojo
00:33 sri actually i lied
00:33 sri i have a halfway decent implementation
00:36 good_news_everyon joined #mojo
00:36 good_news_everyon [mojo] kraih created nested_helpers (+1 new commit): http://git.io/d8hCIg
00:36 good_news_everyon mojo/nested_helpers cb7f414 Sebastian Riedel: basic support for nested helpers
00:36 good_news_everyon left #mojo
00:39 good_news_everyon joined #mojo
00:39 good_news_everyon [mojo] kraih pushed 1 new commit to nested_helpers: http://git.io/HUTZMA
00:39 good_news_everyon mojo/nested_helpers bc434db Sebastian Riedel: added tests for nested helpers
00:39 good_news_everyon left #mojo
00:40 sri https://github.com/kraih/mojo/compare/nested_helpers
00:41 * sri pokes tempire, jberger, batman, marcus and crab
00:46 crab sorry, i can't review this change because there's no documentation.
00:46 * crab hides
00:46 crab will scrollback explain what it's about?
00:47 sri that's a defintive maybe
00:47 crab <sri> $app->helpers('foo'); $app->foo->add_helper(bar => sub {...}); $c->foo->bar()
00:47 crab is that basically the idea?
00:48 sri not anymore
00:48 sri https://github.com/kraih/mojo/compare/nested_helpers#diff-a772748a41b097aa50ef51ccfc2a4d9eR41
00:51 crab ok, got it.
00:51 crab i don't really see the motivation
00:55 sri :c
01:03 laouji joined #mojo
01:13 neyasov___ joined #mojo
01:30 woz joined #mojo
01:32 klapperl_ joined #mojo
01:49 good_news_everyon joined #mojo
01:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/xi3HAQ
01:49 good_news_everyon mojo/master aa3b11d Sebastian Riedel: we are checking the freshness of the request
01:49 good_news_everyon left #mojo
01:52 * genio wonders if sri sleeps
01:53 sri had you been at mojoconf you would know i'm a robot and don't sleep
01:53 KCL joined #mojo
01:56 genio It's turning into quite the evening.  The fiance is out of the house for a few days.  I have whisky, freshly cooked spicy sausage, tv, and an internet connection
01:59 sri oh shit.. i just discovered this issue had 1300 unique visitors :O https://github.com/kraih/mojo/issues/656
02:01 sri repo had 12k views in the last two weeks, not too bad
02:05 sri enjoy your whiskey... i need to... recharge batteries
02:05 sri Zzz
02:05 genio have a good one
02:09 miked joined #mojo
02:11 HtbaaPi joined #mojo
02:13 woz joined #mojo
02:13 miked joined #mojo
02:16 hesco joined #mojo
02:20 tempire crab: the motivation is separation of helpers
02:20 tempire instead of 10s and 100s of helpers munged together with ugly names
02:21 dvinciguerra joined #mojo
02:22 tempire +1
02:22 purl 1
02:23 tempire This will be a good practice, particularly for n00bs who aren't familiar with separation of concerns.
02:23 neyasov___ joined #mojo
03:00 noganex joined #mojo
03:12 basic6_ joined #mojo
03:17 woz joined #mojo
03:24 neyasov___ joined #mojo
03:32 jnbek joined #mojo
03:56 irq joined #mojo
04:12 zackiv31 joined #mojo
04:21 woz joined #mojo
04:25 neyasov___ joined #mojo
05:25 woz joined #mojo
05:25 neyasov___ joined #mojo
05:35 Vandal joined #mojo
06:11 denis_boyun joined #mojo
06:26 neyasov___ joined #mojo
06:27 woz joined #mojo
06:38 dexteruk_ joined #mojo
06:44 gatitskiy joined #mojo
06:45 dod joined #mojo
06:47 dod joined #mojo
06:50 gatitskiy joined #mojo
06:55 gatitski_ joined #mojo
06:55 basiliscos joined #mojo
06:56 gatitskiy joined #mojo
07:02 gatitski_ joined #mojo
07:02 batman tempire: i don't get how that "controller" attribute can work when you do non-blocking. wouldn't it be overwritten in another callback..?
07:07 batman i also don't get nested helpers. sorry, i can't vote until i know more :/
07:12 gatitskiy joined #mojo
07:26 basiliscos joined #mojo
07:27 neyasov___ joined #mojo
07:28 woz joined #mojo
07:28 Jonis morning woz
07:35 trone joined #mojo
08:07 woz joined #mojo
08:28 neyasov___ joined #mojo
08:33 fhelmber_ joined #mojo
08:36 neyasov___ joined #mojo
08:38 irq joined #mojo
08:44 camelo joined #mojo
08:44 camelo hi
08:44 purl hola, camelo.
08:48 arpadszasz joined #mojo
08:52 Dandre left #mojo
08:52 gatitskiy joined #mojo
08:53 neyasov___ joined #mojo
09:00 Dandre joined #mojo
09:00 mr-foobar joined #mojo
09:11 Dandre joined #mojo
09:20 gatitskiy joined #mojo
10:05 neyasov___ joined #mojo
10:07 batman sri: https://gist.github.com/jhthorsen/873c12f43640ec5fe11c <-- do you have an example on how to avoid tons of callback variables?
10:07 batman example / idea / something...
10:10 batman was it the bulk thing..?
10:11 * batman starts to remember something...
10:34 Dandre left #mojo
10:42 odc batman, I guess it would be nicer to check for errors on a large number or results using reduce()
10:42 batman how would you do that?
10:42 odc $b would contain the error
10:42 odc oh
10:42 odc maybe not
10:42 batman by the way: i'm creating support for bulk ops now.
10:43 odc :)
10:43 batman or rather... *trying*
10:44 Dandre joined #mojo
10:48 gatitskiy joined #mojo
10:48 gatitskiy joined #mojo
10:48 odc another idea : my ($delay, @results) = @_;  my @errors = List::Utill::pairkeys @results;
10:51 batman not sure how that helps :/
10:52 odc it's better than "$get_err || $incr_err || $smembers_err" if you have a lot of results
10:52 batman i agree :)
10:53 odc but yeah, I don't think there's gonna be a one-liner for this :/
10:54 odc unless you would provide a sub that would look for errors in an array of results ;)
10:54 batman Mojo::Collection might help me...
10:56 odc adding pairmap() to M::Collection might be a good idea
11:04 batman odc: https://github.com/jhthorsen/mojo-redis2/pull/1/files#diff-67ad6ab0e9f3ad8ea5f2d6d8168aed02R1
11:05 batman care to give me feedback?
11:05 batman it's not the final design, but it's where i got so far...
11:05 batman pretty sure there will be changes.
11:10 odc one $err and one $res, i like it
11:10 odc why returning $err as a M::Collection instead of just an arrayref?
11:11 odc oh nvm
11:12 odc please don't use die()
11:13 odc oh but you need it for IOLoop->delay ?
11:15 batman i don't get "don't use die" and the last question
11:16 odc bulk.pm line 102
11:16 batman yeah, but why not?
11:16 ichesnokov joined #mojo
11:16 odc i don't want my app to crash because of a db error
11:17 batman right. i can change that...
11:17 batman what about the question?
11:18 odc i think i remember that you need to call die() in IOLoop->delay for the error to get catched by catch()
11:18 odc i was wondering if you used die on purpose
11:18 batman that's true
11:18 ichesnokov Hi. Could someone please tell me how to properly specify that ':job_id' in route must be an integer? I tried the following: $a->get( '/job/:job_id/approve', job_id => qr/^\d+$/ )->to('admin-job#approve') - but it didn't work... ($a is a bridge to admin authentication)
11:19 batman odc: i updated the SYNOPSIS now
11:20 batman ichesnokov: try get('/job/:job_id/approve', [ job_id => qr/^\d+$/ ])
11:20 moritz ichesnokov: I think you must drop the ^ and $ from the regex
11:20 ichesnokov Although it's working when I specify regex without "qr" - but issues warnings about using uninitialized value in pattern match.
11:20 batman ichesnokov: yeah, and what moritz said :)
11:20 ichesnokov moritz, why? that sounds a bit strange because I don't want to accept any job_id which occasionally contain numbers
11:21 moritz ichesnokov: I guess the routing code embeds your regex into another regex
11:21 moritz ichesnokov: and that other bigger regex matches against the whole request path
11:21 ichesnokov Ah, that could well be a reason
11:22 odc batman, thanks! Another question : aren't all errors supposed to be catchable with $redis->on(error => sub {}) ?
11:23 odc but i don't see any event emitted
11:23 batman odc: not anymore. only connection errors will be catched by on(error => ...)
11:23 odc oh ok
11:23 batman or... actions not related to an operation will be caught by on(error => ...)
11:24 onur joined #mojo
11:24 odc good! so i could use this event to try to reconnect on error
11:25 batman there's no connect or reconnect, so not sure how you would do that.
11:25 batman Mojo::Redis2 reconnects on it's own if the connection is dropped
11:25 neilhwatson joined #mojo
11:25 batman its
11:25 onur Hi guys. How can I replace newlines with <br /> and show xml escaped variable in my template?
11:26 odc batman, ok, i'm just thinking about what would be needed to support a pool of redis servers
11:26 odc but that won't be easy
11:26 batman like sentinel...?
11:26 odc yup
11:27 batman sentinel connection error won't be visible in on(error => ...) unless all sentinels fail
11:27 batman at least that's the plan
11:27 odc onur, with a regex and Mojo::Util::xml_escape
11:28 odc batman, that would make things easier
11:28 batman :)
11:29 ichesnokov moritz, batman, yeah, adding square brackets and removing ^$ helped, thanks a lot - this made me a headache for a rather long time, just didn't have a time to ask / properly fix it :)
11:29 batman ichesnokov: good! :)
11:29 batman sri: could you add an example of how $results look like here: https://metacpan.org/pod/Mango::Bulk ?
11:30 batman odc: i'm considering adding $bulk->stop_on_error($bool)... but i think i will wait until i figure out *why* that would be a good idea
11:31 batman sri: i would also really like to get feedback on https://github.com/jhthorsen/mojo-redis2/pull/1/files
11:33 odc batman, what's the difference between a Bulk and a Transaction?
11:34 batman Bulk is just a way of grouping results, while Transaction use http://redis.io/commands#transactions (MULTI, ..., EXEC)
11:34 batman Bulk operations are not inside a transaction
11:35 odc hmm, then why would I use a bulk over a transaction?
11:36 odc to get a lot of results fast maybe...
11:36 batman no. to avoid my ($delay, $e1, $r1, $e2, $r2, $e3, ....)
11:36 d4rkie joined #mojo
11:39 odc hm, i guess stop_on_error() is kinda useless. Transactions should be used for critical operations
11:39 odc anyway, food time, brb
11:41 batman odc: i really don't get transactions in redis :/ it's not at all as in mysql and friends...
11:46 sh4 joined #mojo
12:02 sri tempire: doesn't look like nested helpers would pass a vote
12:10 sri batman: to my knowledge nested helpers have no limitations regarding non-blocking
12:10 batman sri: no, i was thinking about the code tempire posted: a plugin with "has controller => ...."
12:11 sri tempires example never could have worked, we are now talking about this branch! https://github.com/kraih/mojo/compare/nested_helpers
12:12 sri batman: mongodb bulk operations are explained here http://docs.mongodb.org/manual/reference/method/Bulk.execute/#Bulk.execute
12:24 batman ok. thanks (bulk)
12:24 batman and i did comment on tempire's code AND that branch. i guess i'm -1, since i don't get the use :/
12:26 hesco joined #mojo
12:31 sri batman: http://irclog.perlgeek.de/mojo/2014-08-08#i_9152506
12:34 sri tempire: i'm not going to overrule the votes on this though, it has to pass... so far i believe we have -1 from batman, -1 from crab, and +1 from tempire, with only jberger and marcus left
12:37 Dandre joined #mojo
12:38 ichesnokov left #mojo
12:42 GabrielVieira joined #mojo
12:43 sri hmm, i just realized i have no clue what the fatal log level is actually for :o
12:46 moritz when writing the log triggers a kernel or hardware bug, and your machine crashes, you have a fatal log :-)
12:46 sri i mean in Mojo::Log
12:47 zackiv31 joined #mojo
12:47 odc sri, because every other log system has fatal too
12:49 Kripton joined #mojo
12:53 jainmj joined #mojo
13:02 sri odc: right, that's cargo culting
13:04 moritz maybe "fatal" is for internal errors that stop the whole process, not just the current request?
13:05 odc sri, yup, but in the end that's a good thing because all the libs compatible between them. Btw, in my apps, $log->fatal is like log fatal except it also send the message by email
13:05 odc like log->error *
13:06 sri i would expect those two to be warn and error
13:06 sri where only errors trigger an email
13:07 sri if it's not important enough for a notification, it's prolly just a warning ;)
13:08 odc it should be like this indeed, but, you know...
13:11 dvinciguerra joined #mojo
13:28 batman tempire: i think the reason i don't get it, is because i always do $self->my_plugin(plugin_method => @args); and i'm quite happy with that
13:28 batman s/$self/$c/
13:30 sri wtf? that looks terrible!
13:31 batman sri: how do you do it?
13:31 sri nobody makes me flip flop with my vote more than batman :)
13:32 sri batman: $c->some_very_specific_helper_name(@args)
13:35 batman i don't think it looks terrible... https://metacpan.org/pod/Mojolicious::Plugin::PayPal#SYNOPSIS
13:39 Jonis anyone had issues with Devel::Cover seemingly holding on to DB objects between each test?
13:40 Jonis I seem to be running out of DB connections and have been scratching my head for the last few hours
13:49 Mikey we have lots of helpers, and i'd probably refactor into nested helpers honestly.. as the number of helpers increases their name lengths increase out of paranoia
13:50 Mikey we haven't had a collision yet, though.
13:50 Mikey at least not one that's hit the repository
13:53 KCL_ joined #mojo
13:54 fhelmbe__ joined #mojo
14:07 sri batman: i really don't like that api
14:08 zivester joined #mojo
14:12 sri only downside of nested helpers is that they are 3 times slower than normal helpers
14:13 sri helper bar => sub { "works!" }; can be called 100k times as $c->bar in 0.81s
14:14 sri helper "foo.bar" => sub { "works!" }; can be called 100k times as $c->foo->bar in 2.44s
14:14 * sri pokes tempire
14:15 sri after all, there's an obejct instantiated and another AUTOLOAD called
14:16 sri called like my $foo = $c->foo; $foo->bar for 1 .. 100000; the time goes down to 1.01s
14:16 sri i guess that's fair
14:20 ryozi joined #mojo
14:43 sugar joined #mojo
14:47 dvinciguerra joined #mojo
14:48 Dandre left #mojo
15:00 gatitskiy joined #mojo
15:03 dvinciguerra joined #mojo
15:43 jainmj joined #mojo
15:49 Dandre joined #mojo
15:49 oetiker I have been working on my proxy project
15:50 oetiker and it seems that the $c->u maintains persistent connections
15:51 oetiker is this correct?
15:51 oetiker interestingly enough it seems todo that across controller
15:52 oetiker so if I need something from website 'x' in one request and then something else from website 'x' in another request, the $c->ua seems to use the same connection to run both requests.
15:52 oetiker this is nice for performance
15:53 oetiker but I guess I should not do this in a proxy
15:54 oetiker as multiple users would talk to the server over the same http connection which the server might consider as a single user.
15:55 oetiker could I get mojo to have multiple ua instances running to keep multiple connections open ?
15:55 stephan48 you will probably want to disable keep alive in the UA
15:56 oetiker :-(
15:56 oetiker yes
15:58 stephan48 also the server should handle seperate requests seperately when they come over one keep alive connection
15:58 stephan48 at least so did i understand the spec
15:58 oetiker well zimbra does not
15:58 stephan48 oh okey
15:58 oetiker it was interesting
15:58 oetiker I had written all this code to handle the cookeis
15:59 oetiker and it worked
15:59 purl Of course it worked
15:59 odc hah!
15:59 oetiker and then I removed the cookie
15:59 oetiker in the browser
15:59 stephan48 and boom?
15:59 purl boom is the battery exploding.
15:59 oetiker and was able to continue working
15:59 stephan48 okey
15:59 oetiker so I looked at the requests
16:00 oetiker to see if maybe the zimbra client had somehow stored a key and was shipping it in each request
16:00 oetiker but no
16:00 stephan48 so you logged out?
16:00 oetiker yea that worked
16:00 oetiker but no
16:00 oetiker I did not ...
16:00 oetiker I stopped my mojo proxy app
16:00 oetiker and started it again
16:00 oetiker and boom
16:00 oetiker now zimbra did not like me anymore
16:01 Dandre joined #mojo
16:01 stephan48 strnage
16:01 oetiker so it seems zimbra considers all traffic coming over a keepalive connection to be from a single user
16:01 oetiker at least when running in https mode
16:01 oetiker which one could consider a fair assumption
16:02 oetiker unless someone like me writes an evil proxy :)
16:02 stephan48 yea
16:03 oetiker do you know if the mojo ua can be forced to open a second connection ?
16:03 oetiker because my proxy knows who is talking to it
16:19 gatitskiy joined #mojo
16:21 gatitskiy joined #mojo
16:29 tempire 3 times slower every time?
16:29 denis_boyun joined #mojo
16:30 sri tempire: keep reading
16:31 oetiker hmmm it gets stranger by the minute
16:31 oetiker even with persistent connections disabled, zimbra does not require me to have a valid cookie ...
16:32 oetiker UNTIL i restart my proxy ...
16:32 good_news_everyon joined #mojo
16:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/uCvKcg
16:32 good_news_everyon mojo/master 5c958f2 Sebastian Riedel: fixed proxy exception handling bug in Mojo::UserAgent
16:32 good_news_everyon left #mojo
16:32 oetiker I guess I need to sleep and look at it again ...
16:33 tempire interesting.
16:34 tempire I wonder if dots are the right syntax
16:34 sujithm joined #mojo
16:36 tempire $app->helpers(foo => {bar => sub {}, baz => sub {}})
16:40 sri tempire: looks messy when you fill in the actual code and requires more changes to renderers that automatically pick up helpers
16:40 sri the dot is already used to hide stuff in the stash
16:41 tempire Yeah, you'd have to generate the subs elsewhere, which is too much to ask beginners.
16:41 sri s/hide/namespace/
16:41 sri dots are a concept we already have
16:42 sri note how i didn't have to make any changes to the .ep renderer
16:43 sri invalid identifier chars like the dot were already filtered out
16:43 sri only downside i see is that you have to quote the name in "helper 'foo.bar' => sub {...}"
16:58 denis_boyun_ joined #mojo
17:39 dvinciguerra joined #mojo
17:52 sri tempire: anyway, the votes don't look good
17:53 tempire indeed
17:53 tempire Which is strange to me.
17:53 tempire helper namespaces seem like such an obvious thing.
17:54 * sri pokes jberger and marcus
17:54 sri it's all up to you two now!
17:56 tempire I really love Mojo::Home
17:56 tempire so useful
17:59 sri so rare we get to discuss stuff with the whole team present anymore, now it's always endless poking and running after people :S
18:00 sjn perhaps because of vacation?
18:00 tempire The nature of increasing numbers, I think.
18:12 denis_boyun joined #mojo
18:12 basiliscos joined #mojo
18:31 denis_boyun_ joined #mojo
18:36 rj11 Can I force link_to to print the label as-is so I can include HTML in it?
18:38 rj11 %==, %= b link_to, %= link_to b(''), nothing works.
18:40 irq joined #mojo
18:43 komodo joined #mojo
18:50 denis_boyun joined #mojo
18:51 good_news_everyon joined #mojo
18:51 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ohTNIA
18:51 good_news_everyon mojo/master 922e957 Sebastian Riedel: test failed TLS handshake through proxy
18:51 good_news_everyon left #mojo
18:52 sri simple code, but conceptually really complicated
19:03 sh4 joined #mojo
19:45 cosimo joined #mojo
19:52 sri i've posted the nested helper proposal to the list https://groups.google.com/forum/#!topic/mojolicious/Pn0FkpBzO4I
19:52 sri maybe that will help decide
19:53 woz joined #mojo
20:27 woz joined #mojo
20:34 sri i have a feeling jberger will vote +1 and marcus may be undecided or +1-ish
20:34 jberger_ Oddly, I'm not sure that I'm for this one. I'm still on the fence
20:35 sri :O
20:35 sri that's really not good
20:36 jberger_ I prefer my pattern of the helper returning an object, the only thing that this buys is passing the controller instance forward
20:36 sri yea, that's the whole point
20:36 sri you have *real* helpers
20:36 jberger_ Hmmmmmm
20:37 sri interesting you brought up your own little pattern, like batman
20:37 sri (and a different pattern)
20:38 sri crab: do you have your own pattern for organizing helpers too?
20:38 voegelas joined #mojo
20:38 tempire It's an indication that this is needed. At least in some form. You eventually get to this point, and have to solve it.
20:39 sri jberger's pattern is not going away, i will keep using it in minion for example, but i do believe it solves a different problem really
20:39 sri but it is very interesting you all have your go to pattern for organizing helpers
20:40 sri actually... i'm in the club too, but i'm not liking mine :)
20:40 basiliscos joined #mojo
20:40 sri (my pattern was very_specific_helper_names())
20:40 tempire Yeah. I did that originally. But it feels...
20:41 sri well, in ruby very long method names are a trend ;p
20:41 tempire I'm ok with very long method names. In a lispy fashion, but when "very_specific" is used 100 times, you start pining for namespacing.
20:42 sri http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words_to_now # hehe
20:42 tempire *names, in a lispy fasion
20:43 sri "def make_person_an_outside_subscriber_if_all_accesses_revoked" comes to mind :) https://signalvnoise.com/posts/3250-clarity-over-brevity-in-variable-and-method-names
20:50 dexteruk joined #mojo
20:51 Adurah_ It'd be less characters but more bytes in Chinese, probably.
21:02 woz joined #mojo
21:24 * sri is collecting all information in the list thread https://groups.google.com/forum/#!topic/mojolicious/Pn0FkpBzO4I
21:24 sri tempire: it starts to look a bit better imo
21:51 woz joined #mojo
22:20 batman sri: i have an idea that I want to try out tomorrow morning, regarding the foo.bar pattern.
22:20 batman I hope you will not be too hasty. But I've been out, so I can't do it now :/
22:21 batman I'm thinking split and call at once, instead of the proxy (helpers) object
22:21 batman Be back in 8 hours...
22:26 woz joined #mojo
22:28 woz_ joined #mojo
22:29 sri batman: that sentence made no sense...
22:34 * sri wants to release nested helpers now just to mess with batman :D
22:36 sri but seriously... if your solution is that redispatch garbage ($c->helper('foo.bar', @args)) i'm gonna yell at you!
22:37 miked joined #mojo
22:42 preaction joined #mojo
22:44 dexteruk joined #mojo
23:09 crab i do not have my own pattern for organising helpers
23:13 sri crab: then how do you prevent clutter?
23:15 sri hahahaha... i bet batmans proposal will be $c->foo(bar => @args)
23:15 sri *yelling intensifies*
23:23 sugar joined #mojo
23:34 komodo_ joined #mojo
23:35 komodo__ joined #mojo

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