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

IRC log for #mojo, 2018-02-11

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

All times shown according to UTC.

Time Nick Message
00:54 nefarious joined #mojo
01:19 nefarious joined #mojo
01:27 good_news_everyon joined #mojo
01:27 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAtzj
01:27 good_news_everyon mojo/master 9e30e69 Sebastian Riedel: rename start to begin and add more examples
01:27 good_news_everyon left #mojo
01:29 marty joined #mojo
01:33 Leffe joined #mojo
01:48 polettix joined #mojo
02:05 marty joined #mojo
02:32 genioweb reaching the end of altered carbon. there's some bad acting and writing in places, but overall enjoyable
02:50 nefarious joined #mojo
03:19 gordonfish joined #mojo
03:24 nefarious joined #mojo
03:35 Leffe joined #mojo
04:06 marty joined #mojo
04:39 nefarious joined #mojo
05:04 dboehmer joined #mojo
05:26 nefarious joined #mojo
05:29 Leffe joined #mojo
06:58 Leffe joined #mojo
07:24 nefarious joined #mojo
07:44 polettix joined #mojo
08:10 Leffe joined #mojo
08:14 Leffe joined #mojo
08:16 Leffe joined #mojo
08:23 Vandal joined #mojo
08:24 berov joined #mojo
08:34 mib_cahmf5 joined #mojo
08:51 Leffe joined #mojo
09:28 nefarious joined #mojo
09:30 Leffe joined #mojo
10:39 Leffe joined #mojo
10:45 nefarious joined #mojo
10:49 trone joined #mojo
10:59 stryx` joined #mojo
11:08 jpsalvesen joined #mojo
11:11 berov joined #mojo
11:36 nefarious joined #mojo
11:47 mohawk what do people think about plugins generally returning themselves from their "register" call?
11:47 mohawk it's my understanding that currently they don't
11:53 mishanti1 What would be the "correct" way of setting userinfo for all calls done in tests? Setting it for each and every call seems somewhat unelegant, and I'm struggling to find a pretty way of doing it.
12:18 mishanti1 Guess I can monkeypatch Mojo::UserAgent::Transactor
12:18 mishanti1 Ugly though.
12:22 marty joined #mojo
12:38 sri mishanti1: start event
12:38 mohawk sri, do you have an opinion on the plugin point?
12:51 nefarious joined #mojo
13:12 mohawk it seems to me it would be quite useful to make it be standard that a plugin's "register" method is specified as returning the plugin object
13:13 mishanti1 sri: Doh! Should have though to manipulate it there indeed. Especially since I already have a handler for that. :p Thanks.
13:13 mohawk as batman's excellent Mojolicious::Plugin::OpenAPI now does
13:20 good_news_everyon joined #mojo
13:20 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAtFt
13:20 good_news_everyon mojo/master 5d39cd6 Sebastian Riedel: add EXPERIMENTAL timing->rps helper
13:20 good_news_everyon left #mojo
13:21 sri not entirely sure about timing->rps, it's so short, maybe it should just be an idiom in the docs
13:22 sri my $rps = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed;
13:22 * sri shrigs
13:22 sri s/i/u/
13:24 sri really glad we have appveyor, it's good to know that kind of test works cross platform https://ci.appveyor.com/project/kraih/mojo
13:30 polettix joined #mojo
13:43 sri genio: it's more annoying when you know the book, which is much more coherent
14:14 jberger mohawk it isn't formalized but some plugins do and some don't, I'm not sure what your question is?
14:18 jberger I guess part of it is that many plugin classes aren't anything more than their register method
14:19 jberger until you have more in it, it doesn't really help to do so
14:19 genioweb joined #mojo
14:21 mohawk my thought was that it would be a good idea to recommend doing that in the docs
14:25 polettix joined #mojo
14:35 jberger but I don't think that it is settled that it is
14:36 jberger a plugin might primarily load some other module and instantiate it with data from the app, in which case that is probably the best thing to do
14:37 jberger a module might just install some helpers in which case there might be some other return that is better or not care what its return value is
14:38 jberger certainly returning the plugin instance is a possible choice but part of the power of the mojo plugin system is that it is very simple and thus flexible
14:39 mohawk what about in the simple case, where an object (that has attributes and suchlike) is constructed, that it be recommended to return it
14:39 sh14 joined #mojo
14:40 jberger is it the plugin class itself that has the attributes? if so then sure, but I don't think people do that all that commonly
14:40 jberger I have of course, but most of my plugins don't
14:42 jberger part of the problem is that the plugin loader doesn't pass any arguments to the plugin class's constructor
14:42 jberger $app->plugin($name, $conf) doesn't translate to $name->new($conf)->register($app) but rather to $name->new->register($app, $conf)
14:42 jberger so attributes aren't quite as easily used
14:43 jberger you can of course but you have to unpack the arguments in the register method
14:43 Leffe joined #mojo
14:46 polettix something like this: https://github.com/polettix/Bot-ChatBots/blob/master/lib/Bot/ChatBots/MojoPlugin.pm#L27
14:46 polettix (although it’s more “has-a” than “is-a” in that case)
14:47 polettix (probably more “has-some” than “has-a”)
14:47 jberger polettix: yes, as I said I've done it too, I'm just saying that we aren't going to recommend something that isn't the standard usage but rather is just one of many possible options
14:48 polettix yes, sorry I jumped in the middle of a conversation and was a bit overenthusiastic of having been there :)
14:53 sri jberger: useful enough for a helper? http://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#timing-rps
14:53 mohawk clearly there are other uses for plugins so "recommend" would be too strong
14:53 sri (it's so easy to go overboard with tiny helpers now that they cost nothing :S)
14:54 mohawk i do think that "suggest where there is an object" might be a good prompt to make plugins a bit more reusable
14:54 nefarious joined #mojo
14:56 jberger sri my concern is if people were to think that it was aggregating data over multiple requests, even though clearly your doc should dispel that mistake
14:57 jberger I don't mind having small helpers
14:58 good_news_everyon joined #mojo
14:58 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAtp3
14:58 good_news_everyon mojo/master 2bfdba6 Sebastian Riedel: fix link in description
14:58 good_news_everyon left #mojo
15:08 polettix joined #mojo
15:12 Leffe joined #mojo
15:12 good_news_everyon joined #mojo
15:12 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAthU
15:12 good_news_everyon mojo/master 1a65c1f Sebastian Riedel: make timing->* helpers a little less magical for now
15:12 good_news_everyon left #mojo
15:17 sri i think if calling ->elapsed manually will become too annying with ->server_timing we'll just make timing->begin('db'); ...; timing->server_timing_for('db');
15:17 sri :p
15:19 sri i have a feeling Server-Timing will become very popular for signaling all sorts of stuff to browser dev tools, so better to keep things as versatile as possible for now
15:21 sh14 joined #mojo
15:32 sri looks like firefox is also working on support https://bugzilla.mozilla.org/show_bug.cgi?id=1430713
15:35 sri things get really interesting when intermediaries start adding their own server-timing stats, like a cdn
15:35 Leffe joined #mojo
15:35 sri or even information about which data centers requests were routed through
15:48 djk joined #mojo
15:54 karjala_ joined #mojo
15:56 good_news_everyon joined #mojo
15:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAqvz
15:56 good_news_everyon mojo/master f509d10 Sebastian Riedel: a few more timing tests
15:56 good_news_everyon left #mojo
15:57 good_news_everyon joined #mojo
15:57 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAqvo
15:57 good_news_everyon mojo/master 182e672 Sebastian Riedel: we call it timing now
15:57 good_news_everyon left #mojo
16:00 batman sri: why doesn't rps take a name as the other helpers?
16:03 sri batman: server_timing doesn't either
16:03 sri and the reason is that values would then be incorrect
16:04 sri elapsed would not match rps anymore, since time passed
16:05 batman ah, right
16:05 Leffe joined #mojo
16:15 djk I am looking at Mojo::IOLoop::TLS to upgrade an incoming stream that has indicated that it wants to STARTTLS. I am getting a little confused as to what one gets as a result from upgrading and negotiating and then what one does about reading and writing noting the comment in Mojo::IOLoop::write =   # IO::Socket::SSL will corrupt data with the wrong internal representation
16:17 zivester joined #mojo
16:19 polettix joined #mojo
16:20 djk I am considering writing an SMTP MTA "proxy" or "front end", thereby avoiding using the various spam/malware scanners via the actual MTA - which seem rather fragile if anything errors or goes away (for example when clamav updates its database)
16:22 sri djk: the XS parts of IO::Socket::SSL get confused when perl strings have the wrong internal representation
16:23 sri so utf8::downgrade is needed
16:23 sri it's a complicated issue
16:24 sri don't worry if you don't understand it
16:25 marty joined #mojo
16:32 Leffe joined #mojo
16:57 nefarious joined #mojo
16:59 marty joined #mojo
17:04 ChmEarl joined #mojo
17:14 jamesaxl joined #mojo
17:14 ghenry joined #mojo
17:15 marty joined #mojo
17:31 karjala_ joined #mojo
17:45 marty joined #mojo
18:42 sh14|2 joined #mojo
18:43 ghenry joined #mojo
19:11 hesco1 A couple of years ago I wrote an api Bar.  Now I am writing an api Foo.  Foo is answering to routes like /v1/app/foo_feature.  I now want to attach the old Bar api to my Foo listener, so that /v1/app/bar_feature, or perhaps /v1/app/bar/feature will be responded to by the Bar code I wrote a couple of years ago.  Is there an elegant way of doing this short of refactoring all of Bar as a part of Foo?
19:14 pink_mist check out the Mount plugin
19:20 hesco1 thanks pink_mist, doing so now
19:23 hesco1 nice, ready to test!
19:54 marty joined #mojo
20:00 nefarious joined #mojo
20:02 hesco1 thinking more about how to integrate Mojolicious::Plugins::Mount, . . .
20:02 hesco1 Given the sample code below, I have this question:  (1) will /v1/app/foo/add route be protected by the user_sessions#logged_in authentication of the parent application?
20:02 hesco1 https://gist.github.com/hesco/c615cfd9cb0376cdd57f2fa6418d8035
20:04 Grinnz don't think so
20:05 Grinnz to nest routes, it needs to be nested in the actual route object
20:11 pink_mist neither http://mojolicious.org/perldoc/Mojo/IOLoop#client or http://mojolicious.org/perldoc/Mojo/IOLoop/Client seem to make any mention of Mojo::IOLoop::Stream - I'd like to suggest that a link to that module be added
20:11 pink_mist similar for ->server and ::Server
20:14 pink_mist would a PR for that be useful?
20:16 sri pink_mist: they are not connected
20:17 pink_mist you get one in the callback, at least for ->client and ->server
20:17 sri i mean Mojo::IOLoop::Client
20:18 sri Mojo::IOLoop->client, sure, if you find a nice way to phrase it
20:18 pink_mist alright, I'll try my hand at it =)
20:18 pink_mist Mojo::IOLoop->server too?
20:18 sri yes
20:19 sri "Open a TCP/IP or UNIX domain socket connection with Mojo::IOLoop::Client to create a Mojo::IOLoop::Stream" maybe
20:20 sri +object
20:20 sri "Accept TCP/IP and UNIX domain socket connections with Mojo::IOLoop::Server to create Mojo::IOLoop::Stream objects"
20:20 pink_mist I was thinking of just putting underneath the examples, "The C<$stream> passed to the callback is a L<Mojo::IOLoop::Stream>."
20:20 sri s/to/and/
20:21 sri that would seem inconsistent
20:21 pink_mist ah
20:21 sri i'm not opposed to having a convention for documenting arguments and return values, but it would have to be applied everywhere
20:22 sri in fact i've asked for such a convention many times
20:22 sri "Accept TCP/IP and UNIX domain socket connections with Mojo::IOLoop::Server and create Mojo::IOLoop::Stream objects"
20:22 sri yea, i want that
20:22 pink_mist right
20:27 pink_mist https://github.com/kraih/mojo/pull/1191
20:28 good_news_everyon joined #mojo
20:28 good_news_everyon [mojo] kraih pushed 2 new commits to master: https://git.io/vAqZ9
20:28 good_news_everyon mojo/master f2e12ee Andreas Guldstrand: Mojo::IOLoop: Document that ->client and ->server make Mojo::IOLoop::Stream objects
20:28 good_news_everyon mojo/master a19b1cc Sebastian Riedel: Merge pull request #1191 from pink-mist/master...
20:28 good_news_everyon left #mojo
20:29 pink_mist yay =)
20:30 good_news_everyon joined #mojo
20:30 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAqZd
20:30 good_news_everyon mojo/master 47e2556 Sebastian Riedel: only one Mojo::IOLoop::Stream object is created
20:30 good_news_everyon left #mojo
20:31 pink_mist d'oh, of course
20:31 sri pink_mist++
20:37 genioweb joined #mojo
20:56 nefarious joined #mojo
21:35 polettix joined #mojo
21:55 good_news_everyon joined #mojo
21:55 good_news_everyon [mojo] kraih tagged v7.65 at ce7eb04: https://git.io/vAqlN
21:55 good_news_everyon left #mojo
22:54 jberger pink_mist++
23:03 nefarious joined #mojo
23:05 nefarious joined #mojo

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