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

IRC log for #mojo, 2017-11-04

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

All times shown according to UTC.

Time Nick Message
00:11 marty joined #mojo
00:25 EvanCarroll joined #mojo
00:42 rickbol joined #mojo
00:48 good_news_everyon joined #mojo
00:48 good_news_everyon [mojo] kraih pushed 2 new commits to master: https://git.io/vFcbx
00:48 good_news_everyon mojo/master fd24751 cpansprout: ojo_signatures.t: Suppress proxies...
00:48 good_news_everyon mojo/master 1fe171e Sebastian Riedel: Merge pull request #1149 from cpansprout/patch-1...
00:48 good_news_everyon left #mojo
00:50 good_news_everyon joined #mojo
00:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFcNU
00:50 good_news_everyon mojo/master 90cf59e Sebastian Riedel: more consistent order
00:50 good_news_everyon left #mojo
00:56 rickbol_ joined #mojo
01:42 rickbol joined #mojo
01:54 aborazmeh joined #mojo
03:00 EvanCarroll joined #mojo
03:04 rickbol joined #mojo
03:25 noganex_ joined #mojo
03:27 disputin joined #mojo
04:39 marty joined #mojo
05:04 dboehmer joined #mojo
06:16 mib_lg03ks joined #mojo
07:32 dod joined #mojo
07:48 Vandal joined #mojo
07:59 sh14 joined #mojo
08:02 dod joined #mojo
09:04 kiwiroy joined #mojo
09:21 rshadow joined #mojo
09:31 kiwiroy joined #mojo
10:06 kermie joined #mojo
10:10 kiwiroy joined #mojo
10:22 mib_h2lluh joined #mojo
10:22 rshadow joined #mojo
10:22 mib_h2lluh Hi
10:22 purl hello, mib_h2lluh.
10:23 mib_h2lluh I'm trying to test an app following example in documentation
10:23 mib_h2lluh but it does not run unless I include lib in @INC
10:24 mib_h2lluh I don't know if this is a bug in documentation or if I'm doing something wrong
10:24 mib_h2lluh these are the steps to reproduce problem
10:24 mib_h2lluh $mojo generate app MyApp
10:24 mib_h2lluh cd my_app
10:24 mib_h2lluh prove
10:24 mib_h2lluh and you get this
10:25 mib_h2lluh t/basic.t .. Can't find application class "MyApp" in @INC. (/Users/danielblanchbataller/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0/darwin-2level /Users/danielblanchbataller/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0 /Users/danielblanchbataller/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0/darwin-2level /Users/danielblanchbataller/perl5/per
10:27 mib_h2lluh unless you include this in test file t/basic.t BEGIN { unshift @INC, 'lib' }, that is you put lib in perl's library path
10:30 kiwiroy joined #mojo
10:32 mib_h2lluh definitely I was doing something wrong. I forgot to include the -l switch in prove
10:33 mib_h2lluh you have to call prove -l to make it work. -l switch includes path to lib. :p. sorry!
10:52 kiwiroy joined #mojo
10:55 geospeck joined #mojo
11:13 kiwiroy joined #mojo
11:34 kiwiroy joined #mojo
11:46 marcus re all, yesterday I did shift(@promises)->all(@promises)->then, but didn't feel super elegant. Not sure if worse than Mojo::IOLoop::Delay::all(@promises) tho
11:55 kiwiroy joined #mojo
11:56 trone joined #mojo
12:16 kiwiroy joined #mojo
12:21 aborazmeh joined #mojo
12:37 kiwiroy joined #mojo
12:58 kiwiroy joined #mojo
12:59 sri what else could we do to make ->all nicer to use?
13:19 kiwiroy joined #mojo
13:23 sri i suppose Mojo::IOLoop->all(@promises) would be a little weird
13:25 sri yea, i don't like that
13:37 marcus yeah, that's a bit weird too
13:37 marcus sri: How do you do the equivalent of pass with promises?
13:38 sri $promise->resolve(...)?
13:38 sri or you mean callback return values
13:40 kiwiroy joined #mojo
13:40 marcus so I'm doing an 'all, and I want to include some metadata into the then.
13:41 sri you can't
13:41 sri not how promises work
13:42 marcus Guess I can just create another array into the loop that creates the promises and iterate over the response with a c style for loop to get the index.
13:42 marcus Or use Mojo::Collection even
13:52 thowe joined #mojo
14:01 kiwiroy joined #mojo
14:11 marcus sri:  perl -Mojo -E'my $ua=Mojo::UserAgent->new();$ua->get_p("vg.no")->all($ua->get_p("db.no"))->then(sub { warn ref $_[0] })->wait;'
14:12 marcus this is a bit surprising to me. I would have expected then to get an array of responses, not an arrayref
14:13 sri two arrayrefs technically
14:13 marcus what makes them be wrapped into arrayrefs?
14:14 sri ->all
14:14 sri works the same in javascript
14:14 marcus I see.
14:17 sri Mojo::IOLoop::Delay->all($ua->get_p("vg.no"), $ua->get_p("db.no"))->then(...)
14:17 sri the long class name really makes that suck
14:18 sri Mojo::Promise->all($ua->get_p("vg.no"), $ua->get_p("db.no"))->then(...)
14:18 marcus I guess I can use ->flatten to simplify this
14:18 sri would have been better
14:18 marcus c(@_)->flatten->each(sub { ... });
14:19 marcus sri: Yeah, I agree.
14:21 sri suppose Mojo::IOLoop::Delay could be a subclass of Mojo::Promise that adds ->begin/pass/steps
14:21 kiwiroy joined #mojo
14:22 sri problem is we have to wait until the next major release with that
14:23 marcus sri: I was wondering if it would make sense to add a promise helper like the delay helper, to turn off rendering. Maybe it could also be used for this?
14:23 marcus Probably not tho, it should probably return a new promise
14:24 sri makes no sense imo
14:24 AndrewIsh joined #mojo
14:25 marcus It could also add a default catch block to render a 500 and log the error.
14:25 sri ok, important reminder then
14:25 sri DO NOT USE Mojo::IOLoop::Delay::all(...)
14:25 sri that will break
14:25 sri it's only documented as a method
14:25 sri respect that
14:26 sri Grinnz: ^^^
14:26 sri if we add Mojo::Promise using it as a function would break
14:27 sri jberger: you too
14:28 sri i don't want any complaints later
14:28 sri only $foo->all($bar) is valid for now
14:30 marcus sri: is ->catch(sub { $promise->reject(@_) } ) a reasonable approach to bubbling exceptions?
14:30 sri i suppose theoretically we could add Mojo::Promise now if we used multiple inheritance in Mojo::IOLoop::Delay for the deprecation period
14:31 marcus eck
14:34 sri yeam works
14:34 sri s/m/,/
14:41 sri there also are documentation advantages
14:41 sri promise methods and flow-control methods are cleanly separated that way
14:41 sri the separation was already very clean in the code
14:43 kiwiroy joined #mojo
14:45 sh14 joined #mojo
14:47 kes joined #mojo
15:03 dod joined #mojo
15:04 kiwiroy joined #mojo
15:05 thowe joined #mojo
15:06 marcus That's a big plus, makes things more clear
15:11 jberger I won't care as much about breaking changes to the promises bits for a little while
15:11 sri nothing breaks
15:11 jberger with delays it has been our recommended pattern for years and was essentially the only way to make things sane in complex non blocking code, which is confusing enough
15:12 jberger that's why I was being super up-tight about it
15:13 jberger ok I see what you mean, but even so, that's what I am/was talking about
15:17 good_news_everyon joined #mojo
15:17 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFC0J
15:17 good_news_everyon mojo/master 1330231 Sebastian Riedel: add module Mojo::Promise
15:17 good_news_everyon left #mojo
15:17 sri it was really simple
15:18 sri but, now everything looks very correct
15:18 ChmEarl joined #mojo
15:18 sri yes, i made sure all the old delay promise tests work
15:21 marcus sri: I think I will postpone a writeup until I can use Mojo::Promise then
15:21 sri i'll release it in an hour or so :)
15:24 good_news_everyon joined #mojo
15:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFC0H
15:24 good_news_everyon mojo/master d7be7d0 Sebastian Riedel: bump version
15:24 good_news_everyon left #mojo
15:24 sri actually, i'm feeling lucky today :p
15:24 good_news_everyon joined #mojo
15:24 good_news_everyon [mojo] kraih tagged v7.53 at 3510af1: https://git.io/vFC0Q
15:24 good_news_everyon left #mojo
15:24 Grinnz sri: Mojo::Promise->all(@promises) works now?
15:24 kiwiroy joined #mojo
15:25 sri yes
15:25 Grinnz sounds good
15:27 elderling joined #mojo
15:28 Grinnz i also like the separation of documentation
15:30 good_news_everyon joined #mojo
15:30 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFCEt
15:30 good_news_everyon mojo/master e0c08e0 Sebastian Riedel: use the class method in examples
15:30 good_news_everyon left #mojo
15:30 marcus hmm, I have a weird problem now, where ->then is called after ->catch :(
15:30 sri me too
15:30 sri catch is a then
15:34 EvanCarroll joined #mojo
15:38 marcus can't reproduce in an oneliner, so I guess I'm doing something wrong.
15:46 kiwiroy joined #mojo
15:56 brunoramos joined #mojo
15:59 nicomen isn't catch supposed to restore the chain if handled?
15:59 nicomen (does not do that in a one-liner indeed)
16:01 rshadow joined #mojo
16:06 sri nicomen: where in the spec does it say that?
16:07 kiwiroy joined #mojo
16:21 dod joined #mojo
16:26 marcus When rejected, a promise:
16:26 marcus must not transition to any other state.
16:28 kiwiroy joined #mojo
16:40 sri contradicting nicomen
16:44 marcus Yea
16:49 kiwiroy joined #mojo
17:10 kiwiroy joined #mojo
17:18 good_news_everyon joined #mojo
17:18 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFCVO
17:18 good_news_everyon mojo/master 540f7d3 Sebastian Riedel: use more complete examples
17:18 good_news_everyon left #mojo
17:28 karjala_ joined #mojo
17:31 kiwiroy joined #mojo
17:32 good_news_everyon joined #mojo
17:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFCwq
17:32 good_news_everyon mojo/master 43777bf Sebastian Riedel: no need to mention what Mojo::Promise objects are used for
17:32 good_news_everyon left #mojo
17:43 Zoffix joined #mojo
17:44 good_news_everyon joined #mojo
17:44 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFCw7
17:44 good_news_everyon mojo/master e6b17ae Sebastian Riedel: fix typo in example
17:44 good_news_everyon left #mojo
17:44 Zoffix \o Does Minion have a throttle mechanism? I need to send emails, but the email server has a rate limiter, so I need to send them at most, say, oncee per second.
17:45 sri http://mojolicious.org/perldoc/Minion#lock
17:46 Zoffix Thanks!
17:52 kiwiroy joined #mojo
17:52 disputin joined #mojo
17:53 preaction Zoffix: you could also throttle that at your SMTP server probably
17:54 Zoffix I don't have direct access to tweak its settings. This works like a charm tho: https://gist.github.com/zoffixznet/ee3262193129cae94c5750a84919b55d
17:56 Zoffix Don't know if it matters, but I notice if I kill the script mid-run, it kinda "corrupts" the database. The lock is left in the SQL field and since the lock limit is reached no jobs ever get run when I re-run the script and the script exists.
17:58 Zoffix $minion->reset; fixes that up.
17:58 Zoffix Thanks for the help \o
18:13 kiwiroy joined #mojo
18:34 kiwiroy joined #mojo
18:45 sri Mojo::EventEmitter could also have a ->once_p(...) method
18:47 sri hmm
18:49 sri so, has anyone played with async/await and our promises yet?
18:55 kiwiroy joined #mojo
19:00 sri looks like leonerd pulled an mlehmann
19:01 sri all tied to Future and hardly usable outside that eco system
19:06 pink_mist I would expect him to be open to make it usable for other things too
19:17 Zoffix joined #mojo
19:18 Zoffix Does Minion work at all on Windows? It dies with an message about needing fork.
19:18 Zoffix I don't have the option of Ubuntu-on-Windows
19:20 sri my experiment https://gist.github.com/anonymous/9e1f4858d7aa4e2ddb858147f4f6798f
19:22 sri allright, leonerd says it's not really meant to be used anywhere and still just a huge experiment
19:22 sri and he wouldn't mind help
19:27 CandyAngel Zoffix: With WSL or maybe cygwin.. doesn't work "natively"
19:27 Zoffix Too bad :( A note in the docs would be helpful. I grepped for "Windows" and not seeing anything assumed it worked.
19:28 CandyAngel I'm going to look at making a forkless worker so I can use Minion at work at some point :P
19:42 sri new data point, async/await seems to kinda work with the Poll reactor, it's just EV that borks it
19:45 sri anyway, async/await is definitely not usable in production
20:55 geospeck joined #mojo
20:57 EvanCarroll joined #mojo
22:02 jberger joined #mojo
22:14 nicomen sri: sorry, I just looked at this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch and it seems like it should continue, I might have understood
22:22 sri nicomen: actually, i think you might be right
22:28 sri shit, i misunderstood the spec and only nicomen caught it
22:29 sri you can't actually chain ->catch
22:29 sri a successful ->catch is supposed to result in fulfilled followup promises
22:32 pink_mist from the linked page:
22:32 pink_mist Examples
22:32 pink_mist Edit
22:32 purl rumour has it Examples is http://shorl.com/bynygruhofrebru
22:32 pink_mist Using and chaining the catch method
22:32 pink_mist seems to imply it in fact can be chained
22:32 pink_mist but maybe that's just in perl?
22:35 jberger sri: I was about to start fixing my cpan modules again, is this likely to affect me (ie should I wait)?
22:37 sri odds are there's many more bugs we need to fix first
22:37 sri we don't know since nobody reviews
22:38 good_news_everyon joined #mojo
22:38 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFCQo
22:38 good_news_everyon mojo/master b09d55a Sebastian Riedel: fix a bug in Mojo::Promise where chains could not recover from rejections
22:38 good_news_everyon left #mojo
22:40 sri i've been reading the spec wrong
22:41 sri of course, the promise resolution procedure is called for both, fulfilled and rejected in the same way
22:41 sri it literal of course, with the same results
22:41 sri *is
22:42 sri no matter which one it is, if it succeeds the followup promise is fulfilled
22:43 sri the rejection callback is meant as a recovery mechanism, not for reporting a failure on different layers
22:47 jberger that seems like a strange choice, are recoveries usually possible?
22:47 jberger I guess maybe if you think retrying will have a different response
22:48 good_news_everyon joined #mojo
22:48 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFC7f
22:48 good_news_everyon mojo/master e6df642 Sebastian Riedel: more complete promise example
22:48 good_news_everyon left #mojo
22:50 Grinnz if i'm reading right, that seems consistent with how Future works, though the ->catch callback there has to return a Future so the sequence resolves however that Future resolves
22:50 good_news_everyon joined #mojo
22:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFC7L
22:50 good_news_everyon mojo/master d14a762 Sebastian Riedel: bump version
22:50 good_news_everyon left #mojo
22:51 Grinnz i guess if the ->catch callback dies that would still propagate a rejection
22:51 sri correct
22:52 sri return value recovers and fulfills followup, throw propagates rejection
22:53 sri a promise as return value is not required though
22:53 Grinnz but you could do it that way too, return a promise that then rejects
22:54 sri yes
23:27 jberger joined #mojo

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