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

IRC log for #mojo, 2017-05-18

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

All times shown according to UTC.

Time Nick Message
00:08 dustinm joined #mojo
01:18 aborazmeh joined #mojo
01:32 itaipu joined #mojo
01:54 marty joined #mojo
01:54 stryx` joined #mojo
02:08 noganex_ joined #mojo
02:37 gizmomathboy joined #mojo
03:13 punter joined #mojo
03:48 tchaves joined #mojo
04:04 dboehmer joined #mojo
04:21 punter What is cheaper (faster) on a master process? Writing a line to Mojo::Log, or forking and having the fork write to the log? I only want to write to the log once per minute, but the master process is extremely busy with its job and shouldn't waste time on other things.
04:23 Grinnz try both and find out?
04:23 Grinnz forking is going to be a nonzero amount of work for the master probably
04:24 punter It's hard to measure, Grinnz
04:24 punter maybe with Time::HiRes I can check how long the forking took
05:24 inokenty-w joined #mojo
05:49 eseyman joined #mojo
05:49 dod joined #mojo
05:55 dod joined #mojo
05:58 dod joined #mojo
06:51 Vandal joined #mojo
07:01 karjala_ joined #mojo
07:06 trone joined #mojo
07:07 AndrewIsh joined #mojo
07:08 dod joined #mojo
07:08 prg joined #mojo
08:54 marty joined #mojo
09:04 foursixnine joined #mojo
09:19 karjala_ joined #mojo
09:38 itaipu joined #mojo
09:40 rshadow joined #mojo
09:47 foursixnine joined #mojo
10:18 aborazmeh joined #mojo
10:40 aborazmeh joined #mojo
11:16 dotan_convos joined #mojo
11:23 tchaves joined #mojo
11:31 stryx` joined #mojo
12:24 dotan_convos joined #mojo
12:50 Pyritic joined #mojo
12:57 gryphon joined #mojo
12:58 Lee joined #mojo
13:16 sri CHYC: output_formatters is really ugly :S
13:18 sri i thought first/las/all would fit into the filter pattern
13:18 sri *+t
13:19 CHYC That was my first attempt. It ended up uglier. I thought I'd be cute and do my %filters = ( $_ => $_ ) @filters;, but then you lose the ordering of the filters
13:19 sri afraid i don't see myself giving that a +1 :(
13:19 CHYC There is the partition function in List::MoreUtils, but that's an external dependency where I felt it didn't warrant it.
13:20 CHYC Fair enough.
13:20 sri it's actually really confusing that you store formatters separate from filters, but define them together
13:21 sri i could have accepted formatters as kinda magical built in filters with a good explanation in the docs, but this now is just confusing
13:22 CHYC I suppose $validation->require(foo => {as => 'list'}) would sidestep the issue.
13:22 sri does anyone here actually understand what's going on? https://github.com/kraih/mojo/pull/1096/files
13:23 CHYC Filters work per element. By the time you allow filters the ability to work on the set rather than individually you're not too far off the PR.
13:24 sri there has to be a clean solution
13:24 gizmomathboy joined #mojo
13:24 sri we really can't afford to make validation more complicated
13:25 CHYC This is the discussion I was hoping for. If anything, I'd appreciate a look at the tests to see if that's actually what people want.
13:27 sri well, i don't close pull requests anymore, so we'll see what people think
13:27 CHYC As the requestor, I wouldn't take offence if you did.
13:41 stryx` joined #mojo
13:51 aborazmeh joined #mojo
13:53 batman sri: i think the code is very confusing.
14:15 PryMar56 joined #mojo
14:16 marty joined #mojo
14:23 itaipu joined #mojo
14:25 tchaves joined #mojo
14:27 jberger CHYC has been pretty clear about saying this is a starting point for discussion
14:31 rshadow joined #mojo
15:01 karjala_ How do we capture & handle signals in the Mojo::IOLoop event loop?
15:01 karjala_ I'd like to respond to SIGHUP
15:02 karjala_ is this the way? https://metacpan.org/pod/Mojo::IOLoop::Signal
15:02 pink_mist register a signal handler using %SIG
15:05 karjala_ pink_mist, isn't it true that those sig handlers (registered using %SIG) interrupt your program even in the middle of a subroutine that's running?
15:06 pink_mist obviously. when else would they do it?
15:06 pink_mist when no subroutine is running?
15:06 pink_mist then you've already exited
15:06 karjala_ ok, I meant, they could get executed when it's their turn in the event loop
15:07 stryx` joined #mojo
15:09 karjala_ I'll do $SIG{HUP} = sub { Mojo::IOLoop->next_tick(\&handler) }
15:09 karjala_ it's important
15:10 karjala_ does that sound ok to you? (I don't know much about signal handling in perl/mojo)
15:11 pink_mist makes sense
15:11 karjala_ Thanks
15:18 marty joined #mojo
15:18 karjala_ I wonder what so much code contained in Mojo::IOLoop::Signal does
15:19 jberger signal trapping in an ioloop scares me for some reason
15:20 jberger it always seems to be much more bug-prone
15:20 dod joined #mojo
15:21 disputin joined #mojo
15:29 mcsnolte joined #mojo
15:35 batman signal handling? maybe this could be interesting: https://metacpan.org/source/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.23/lib/Mojo/IOLoop/ReadWriteFork.pm#L219-235
15:37 jberger didn't we determine that the EV signal watcher was generally evil
15:37 jberger I thought that was the end result of something
15:44 karjala_ A daemon (and I'm making one) needs to know when to reload its configuration file - with SIGHUP
15:45 karjala_ Is there another way out?
15:45 karjala_ another way to achieve this?
15:45 Grinnz what you said sounds fine, though I don't know why it matters if it interrupts a subroutine
15:46 karjala_ Grinnz, the start of that subroutine might do stuff that depends on the OLD configurations, and then the end of that same subroutine will complete its work with the NEW configuration it just read during SIGHUP. That's why I didn't want to have it run right in the middle
15:47 CHYC If you're adamant that the config reload has to happen at a particular stage in a loop, just have the $SIG{HUP} set a flag, then put a check for the flag at the place you want the reread to occur.
15:47 Grinnz karjala_: ok, sure
15:48 karjala_ CHYC, is that better than running Mojo::IOLoop->next_tick inside $SIG{HUP} ?
15:48 karjala_ is it safer?
15:49 karjala_ less bug-prone?
15:49 jberger the problem is of course that Mojo::IOLoop doesn't guarantee the order of callbacks inside of each loop tick
15:52 pink_mist I don't see how a flag would work better than a ->next_tick ... checking the flag isn't something you can do in the event loop without adding a recurring timer or something, and then you get issues with latency because of that
15:52 pink_mist next_tick sounds much better than a flag to me
15:53 Grinnz you could check the flag when retrieving the config
15:53 Grinnz assuming you access it through a method of some sort
15:53 pink_mist depends on the config I'd say - some configs should "take effect" immediately, not "the next time it's checked"
15:53 CHYC karjala_: I cannot comment on the safety of using next_tick as I never have used it directly. I've set flags before, the advantage for me being I didn't require an IOLoop but YMMV.
15:54 Grinnz the difference between those seems irrelevant
15:54 Grinnz if you don't check the config how would you know it changed
15:55 pink_mist Grinnz: take for example an irc client's config, if that changes it might want to connect to a different server all of a sudden - that's something that should happen when the config gets reloaded, not when you at some arbitrary point in the future happen to check the config for something
15:55 Grinnz well that means you have to write something that not only reloads the config but acts on the reloaded config
15:55 pink_mist yes
15:55 Grinnz so that's a whole other matter
15:56 pink_mist my point was that it depends
16:03 itaipu joined #mojo
16:05 kyclark joined #mojo
16:06 dod joined #mojo
16:26 karjala_ This is weird: On one script, I execute this and it blocks forever (while outside event loops), and on another I execute it and it doesn't block at all (also while outside event loops): open my $fh, "-|", "./my-command.pl"l;
16:26 karjala_ without the l
16:26 karjala_ my-command produces infinite output
16:28 karjala_ sorry it didn't block, my mistake
16:28 karjala_ :-)
16:57 stryx` joined #mojo
17:00 dod1 joined #mojo
17:24 stryx` joined #mojo
17:33 marty joined #mojo
17:51 tchaves joined #mojo
18:07 rshadow joined #mojo
18:38 Bloke joined #mojo
18:42 punter joined #mojo
19:32 gryphon joined #mojo
19:49 skech1080 joined #mojo
20:48 litwol Hello
20:48 purl hola, litwol.
21:20 good_news_everyon joined #mojo
21:20 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vHeKe
21:20 good_news_everyon mojo/master 4718745 Sebastian Riedel: no need to create an extra object
21:20 good_news_everyon left #mojo
21:30 stryx` joined #mojo
21:36 jberger zomg, it had been almost a month since a non-documentation commit :o
21:36 jberger when I joined the project, it was rare that we'd go three days without a RELEASE!
21:38 nic well nobody votes up my PRs.  Like the one for the router to play a different note for each path so that you could debug your app by listening to it
21:52 * jberger remembers happy times of shelling into remote boxes and running cat * > /dev/dsp
21:52 jberger preferably in some large directory of binary files
21:56 nic back in the day you could do cat * > /dev/mouse   but then it was deemed too cruel
21:57 nic crumbs, that just gave me a flashback to the amount of time it would take to get /dev/mouse working on a new build
22:03 marty joined #mojo
22:03 jberger I can't even imagine
22:03 stryx` joined #mojo
22:05 nic jberger: I rediscovered where I stumbled in the letsencrypt construction...
22:06 nic I think it would help a lot of the port config was made explicit in the notes
22:06 jberger the fun part of Mojo::ACME it seems is bug reports every 3 months :-P
22:06 Grinnz haha
22:08 nic plugin ACME => {challenge_url => 'http://127.0.0.1:1234'}; as a prominent example
22:10 Bloke Why wouldn't you just point LE at a directory that nginx serves?
22:10 Bloke Also, what's the deal with MojoX, is that some historical nonsense from before there were ::Plugins or something?
22:10 nic that's one approach
22:11 nic you can construct a file on the fly and drop it as a static file, but I prefer what the plugin does
22:11 Bloke it sure is.
22:11 nic MojoX is just a namespace
22:12 Bloke It is.
22:12 nic some of the content is old, some recent, you need to check the dates on each package
22:12 Bloke but why are people putting things there?
22:12 Bloke What does it mean to be an X when there are ::Plugins?
22:13 nic Not everything in life is a plugin :D
22:13 Bloke that's what /she/ said.
22:13 Grinnz FooX is a common namespace for modules in the ecosystem of Foo but not developed by the core team of Foo
22:13 * Bloke checks the CoC... "they" said.
22:13 Grinnz see Moose for example
22:13 Bloke Sure.
22:13 Grinnz Mojo takes an approach where as long as you don't conflict with a name the core might want to use, you can use Mojo/Mojolicious::
22:14 nic and you find that out by asking here
22:15 Bloke "will anyone lose their minds if I upload a Mojo-Thinger-* dist?"?
22:15 Grinnz Mojolicious::Plugin is a specific concept, for mojolicious application plugins, and doesn't apply to everything in the Mojo/Mojolicious ecosystem
22:16 Bloke yeah, I have some fairly "this really doesn't fit in here" looking plugins...
22:18 Bloke nic, do you run your app behind an nginx/haproxy/envoy, or are you just raw sockets on the internet?
22:20 jberger Bloke: your module probably isn't actually Mojo-Thinger ... what is it?
22:20 jberger the general rule of thumb is not to use namespaces we might need
22:20 Grinnz i think that was just an example question
22:21 jberger though if you are worried, there is no reason not to use MojoX that I'm aware of
22:21 jberger if you want a plugin or command to be available by default then you do need  to use Mojolicious::(Plugin|Command):: but other than that it doesn't matter
22:22 Grinnz or set namespaces
22:22 pink_mist (well, I'm personally less inclined to look at MojoX:: stuff because that namespace feels outdated - like the thing was made back when that namespace was mandated, which must have been a very long time ago)
22:23 jberger Grinnz: that's why I said "by default"
22:23 jberger pink_mist: yes, there has been a back-and-forth on its state of recommendation
22:23 Grinnz oh i misinterpreted
22:23 jberger np
22:26 Bloke Oh, so it just goes out of fashion some times and then someone does something cool there and people are all "I wanna be like MojoX-Thinger"
22:55 gizmomathboy joined #mojo
23:13 punter joined #mojo
23:45 Pyritic joined #mojo

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