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

IRC log for #mojo, 2017-11-14

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

All times shown according to UTC.

Time Nick Message
00:28 kiwiroy joined #mojo
00:46 pink_mist <Grinnz> latest ideas on the signatures front: https://www.nntp.perl.org/group/perl.perl5.porters/2017/11/msg247237.html
00:47 pink_mist imo a horrible idea
00:50 kiwiroy joined #mojo
01:00 aborazmeh joined #mojo
01:36 dugword joined #mojo
02:07 Grinnz https://metacpan.org/pod/release/DBOOK/Mojo-Collection-Role-UtilsBy-0.001/lib/Mojo/Collection/Role/UtilsBy.pm
03:11 jberger are people really confusing them with prototypes?
03:11 jberger prototypes became an attribute
03:11 jberger that isn't hard
03:13 Grinnz jberger: yes, I see it a lot with people new to perl
03:14 noganex_ joined #mojo
03:14 Grinnz though that suggestion won't necessarily help that
03:15 jberger definitely not
03:16 jberger yet another reason to need a breaking version number for Perl (5)
03:16 * jberger stews
03:16 Grinnz if only...
04:20 inokenty-w joined #mojo
05:04 dboehmer joined #mojo
06:24 dod joined #mojo
06:26 dod joined #mojo
06:31 dod joined #mojo
06:31 dugword joined #mojo
06:48 Vandal joined #mojo
07:21 geospeck joined #mojo
07:28 ghenry joined #mojo
07:30 dugword joined #mojo
07:37 AndrewIsh joined #mojo
08:21 Vandal joined #mojo
08:22 kaare_ joined #mojo
08:27 trone joined #mojo
08:53 dod joined #mojo
08:57 dugword joined #mojo
09:02 trone joined #mojo
09:03 bobkare joined #mojo
09:41 dotan_convos joined #mojo
09:52 sri pink_mist: yea, horrible
10:10 foursixnine joined #mojo
10:14 sri wonder why nobody has built this with mojolicious before :o https://github.com/esphen/wsta
10:20 marcus god, I hate those signature suggestions
10:21 marcus also that'd postpone signatures another x years for no gain.
10:21 marcus :'(
10:23 nadya joined #mojo
10:23 sri tell Zefram
10:24 sri he needs to see that those confused are a tiny minority
10:24 sri and that if anything it's a documentation problem
10:24 sri (i already told him)
10:31 batman +1 square brackets looks awful
10:32 dod joined #mojo
10:34 nadya please tell me that  right behavior on recursive Mojo::DOM replacement: https://ssl.thorsen.pm/paste/268195c37e2d
10:36 sri script tags can't be nested
10:38 nadya i wanna sanitize all script tags and show content
10:39 sri we can only give you the content of the outer script tag, Mojo::DOM can't parse the content
10:39 sri that's beyond the html5 spec
10:41 nadya ok
10:44 tchaves joined #mojo
11:31 sri somehow i missed how ubiquitous moment.js has become
11:58 gregf_ joined #mojo
12:08 geospeck joined #mojo
12:15 AirDisa joined #mojo
12:48 PsimanX1 joined #mojo
13:22 hrupp joined #mojo
13:23 good_news_everyon joined #mojo
13:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vF6XF
13:23 good_news_everyon mojo/master 420cfcf Sebastian Riedel: added num check to Mojolicious::Validator::Validation
13:23 good_news_everyon left #mojo
13:26 sri i've written ->like(qr/^\d+$/) way too many times -.-
13:27 AirDisa joined #mojo
13:30 CandyAngel Shouldn't it be "int", because it won't match 3.14, which is a number..?
13:31 sri maybe
13:31 AirDisa joined #mojo
13:37 sri more opinions welcome
13:41 sri btw. anyone notice the new syntax highlighting theme on http://mojolicious.org?
13:43 maschine I saw the commit but TBH i can't remember what it looked like before..
13:49 perlpilot joined #mojo
13:50 sri CandyAngel: ->int kinda sucks because of the perl built-in int()
13:51 sri and i'm not sure there is actually a need for float validation
13:51 sri i don't remember coming across float form values, like ever
13:52 sri btw. i'm still mostly following laravel with validation https://laravel.com/docs/5.5/validation#available-validation-rules
13:53 sri hard to find better implementations of form validators
13:55 sri if you ignore the ones that keep form validation on the model layer
13:56 maschine I have lots of float form values in both of my apps - just the nature of the beast
13:56 maschine I use use Scalar::Util qw(looks_like_number)
13:59 maschine I'll end up with signed floats too as if to make things extra difficult
13:59 sri maschine: perl -MScalar::Util=looks_like_number -E 'say looks_like_number "0 but true"'
13:59 gryphon joined #mojo
13:59 sri not for validation
14:03 CandyAngel Well, I can think of a float right off the top of my head.. money :P
14:03 CandyAngel Donate [10.50] [Submit]
14:04 CandyAngel It's not the end of the world, because 'like' still exists
14:04 CandyAngel Just expecting confusion because it says it matches numbers, but only integer numbers
14:04 CandyAngel ->wholenum
14:05 CandyAngel Actually, wholenum would be more accurate, because /\d+/ doesn't match negatives, which integers can be
14:05 sri ->num and ->float wouldn't be the end of the world either
14:05 CandyAngel But whole numbers are always positive non-fractional
14:06 sri and the description of ->num just says "whole numeric values"
14:07 CandyAngel Not in the Validator docs..
14:08 sri hypothetical
14:08 purl hmmm... hypothetical is not an answer.
14:09 CandyAngel Ohh
14:10 good_news_everyon joined #mojo
14:10 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vF6Qq
14:10 good_news_everyon mojo/master ea55b7c Sebastian Riedel: just say it is a non-fractional number
14:10 good_news_everyon left #mojo
14:10 sri ok, not hypothetical nymore :p
14:10 CandyAngel :P
14:17 gizmomathboy joined #mojo
14:22 karjala_ joined #mojo
14:31 AirDisa_ joined #mojo
14:58 sri hmm, new minion api problem
14:59 sri for pagination i'd like to include the total number of results here http://mojolicious.org/perldoc/Minion/Backend/Pg#list_jobs
15:01 sri the solution in postgres seems pretty simple
15:01 sri but how do i include the total count in the resulting data structure
15:02 sri easiest solution would be for every row to include a total_count field
15:03 sri but it's not really related to the job
15:05 sri in case anyone is wondering, you can do "select *, count(*) over() as total" in postgres to get the number of results before limit/offset
15:05 sri i guess i could name the field creatively
15:06 sri similar_jobs => 2800
15:06 sri Number of jobs satisfying the same search criteria.
15:07 sri my ($num, $batch) = $backend->list_jobs(...) is kinda ugly
15:08 CandyAngel Oh
15:08 sri maybe my $results = $backend->list_jobs(...); $results->{batch}; $results->{total};
15:09 sri there are breaking changes in the backend anyway and next release is 8.0
15:09 CandyAngel With the Minion UI, is it just going to be reporting state, or will you be able to force jobs to finish or retry etc?
15:09 sri retry 100%
15:09 sri force finish maybe
15:10 sri it's not hard since it already works from the command line
15:11 sri i had planned retry and remove
15:11 sri but, first i have to finish pagination
15:11 jberger I've almost written something like wsta a couple times
15:11 sri but that means i have to fix the list_jobs api
15:11 sri so, which version to you want?
15:12 jberger but that is a really simple interface, like, I'm sorry I didn't think of it, very unixy
15:12 Pyritic joined #mojo
15:12 sri a) $batch->[0]{similar_jobs} b) my ($num, $batch) = ... c) $result->{total}
15:12 jberger it could almost be a switch on the get command :-P
15:15 sri if nobody has a preference i guess i'll go with c
15:15 sri since it's the most future proof
15:15 jberger having it on the result would be most like elasticsearch
15:16 jberger e.g. metacpan
15:16 sri you mean a?
15:16 CandyAngel The reason I ask is because I am thinking of using Minion as a super simple workflow system where the 'workers' are actual people :P
15:17 jberger sri: no I mean c (I think), perhaps I don't understand (a)
15:17 sri right now the result is [{job1}, {job2},...]
15:18 jberger making that more like { total => N, jobs => [ ... ] } is more elasticsearch-y
15:18 sri c would be {total => 123, batch => [{job1}, {job2}, ...]}
15:18 sri ok
15:19 jberger which I'm cool with (if that didn't come through)
15:19 sri i mean, this is backend api, so there's another layer always separating it from the user
15:19 jberger sure
15:20 jberger https://fastapi.metacpan.org/v1/distribution/_search
15:21 sri Grinnz: do you know if sqlite can do total results for paging?
15:22 sri i've actually done performance tests with and without count(*) over(), and for the minion queries it's totally meh
15:22 sri like 2-3 rps less at 300 rps
15:22 sri so, i kinda want to do it
15:24 jberger sqlite could always do two queries
15:24 sri right now we could only do [previous] [next]
15:24 sri true
15:24 jberger it isn't like there is network latency to think about
15:30 Pyritic joined #mojo
15:46 ChmEarl joined #mojo
15:54 anon joined #mojo
15:57 Grinnz sri: will look at the pagination thing in a bit, but use [0-9] not \d for validation
15:58 sri oh, right, unicode numbers
15:59 good_news_everyon joined #mojo
15:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFikM
15:59 good_news_everyon mojo/master 38a7cad Sebastian Riedel: validate numbers more strictly
15:59 good_news_everyon left #mojo
16:00 sri how annoying, that was almost a security issue
16:00 Grinnz and yeah looks_like_number won't validate floats, it will match lots of other things, best bet is to build a regexp or use Regexp::Common or Types::Common::Numeric
16:03 Grinnz different applications may or may not want to allow e## syntax, etc
16:05 Grinnz I'd also use \z instead of $ so there's no trailing newline allowed
16:05 gryphon joined #mojo
16:10 sri Grinnz: btw. i'm going with {total => 123, jobs => [{job1}, {job2}, ...]}
16:11 sri worst case you need two queries
16:12 jberger a quick implementation of wsta (ish) as a separate command https://gist.github.com/jberger/fad291f897f641040da9ab0a36e452ca
16:12 mohawk wsta?
16:13 mohawk websocket...?
16:13 purl i heard websocket was only connected the ioloop via ::Daemon
16:14 jberger mohawk: https://irclog.perlgeek.de/mojo/2017-11-14#i_15446392
16:17 jberger :o
16:17 jberger so yesterday I saw this go across on twitter and I LOLed https://github.com/jessfraz/systemd-butts
16:17 jberger today I look a little more closely because I've never done a chrome extension and I thought "actually that would be a tidy little example
16:17 jberger "
16:17 jberger https://github.com/jessfraz/systemd-butts/graphs/contributors
16:18 jberger tianon! you don't even get set on fire!
16:20 mohawk jberger, aha!
16:24 dugword joined #mojo
16:29 mohawk tianon, 216 repos? holy cow
16:30 jberger heh, I remember what I wrote
16:30 jberger https://gist.github.com/jberger/17049eaa14069d19c84aca7bc93e5f71
16:30 jberger wscat.pl
16:31 mohawk ha, two bites at the cherry? greedy ;-)
16:32 jberger btw, I have 169 repos and most are my own :-P
16:32 jberger (ie not forks)
16:32 jberger and that doesn't include several of mine that are now in separate orgs
16:34 mohawk show-off
16:35 mohawk i have ~40, having recently ruthlessly purged a bunch of forks where my PRs had been merged (yay)
16:36 mohawk boy, there's still a lot of forks
16:36 mohawk must have a deeper cleanout
16:42 dod joined #mojo
16:48 jberger there actually were more than I expected too, I should clean those up
16:50 mohawk won't someone think of the children?
16:53 AirDisa joined #mojo
16:55 Grinnz sri: yeah looks like sqlite will need two queries for the total count
16:55 Grinnz or a subquery, but i doubt it makes much difference
17:04 kgoess joined #mojo
17:06 disputin joined #mojo
17:10 kgoess we're seeing tons of these in our logs, anybody know any reason why that would be? Argument "" isn't numeric in subroutine entry at /usr/share/perl5/vendor_perl/Mojo/Reactor/Poll.pm line 53,
17:10 kgoess that's this code
17:10 kgoess # This may break in the future, but is worth it for performance
17:10 kgoess if (IO::Poll::_poll($timeout, @poll) > 0) {
17:10 mohawk a betting man would suggest $timeout was ''
17:10 mohawk while what's expected is a number
17:10 purl My number?  Just call 555-JERK-IT or fairly simple
17:11 mohawk purl, forget number
17:11 purl mohawk: I forgot number
17:12 mohawk kgoess, does that help?
17:12 kgoess looking forther at Mojo/Reactor/Poll.pm...
17:13 kgoess since $timeout is all calculated by mojo internals...
17:13 maschine probably its initialized as my $number, so it doesn't have a value
17:14 maschine that line should still work but perl gives you a warning
17:14 mohawk shurely that would give "uninitialised value" warning instead?
17:15 maschine not if that warning is disabled
17:16 mohawk this feels to me like one of those times where being a bit rigorous about inputs and outputs would avoid errors
17:16 Grinnz uninitialized value warnings are for the value undef, we are talking about the value ""
17:16 mohawk agreed
17:17 mohawk i read maschine's thought as "my $number", which would be undef until otherwise initialised
17:17 mohawk possibly i am wrong
17:17 Grinnz i don't know what that has to do with anything
17:18 Grinnz also, it's impossible for $timeout to not be a number at that juncture
17:18 Grinnz the code is very simple
17:18 mohawk in that case, kgoess can't be seeing that error
17:18 kgoess that's the conclusion I'm reaching too
17:18 * kgoess vanishes in a puff of logic
17:18 Grinnz no, it's from a different argument
17:18 maschine yeah you're right, that many "''"s is hard to read :p
17:19 Grinnz @poll consists of file descriptors (numbers) and mode masks (numbers)
17:20 Grinnz if either of those ends up as '' you will see that error
17:21 kgoess here's the immediately preceding warnings logged, followed by a couple thousand of those first ones
17:21 kgoess Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mojo/Reactor/Poll.pm line 17, <GEN15189> line 15.
17:21 kgoess Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mojo/Reactor/Poll.pm line 109, <GEN15189> line 15.
17:21 kgoess Use of uninitialized value in hash element at /usr/share/perl5/vendor_perl/Mojo/Reactor/Poll.pm line 109, <GEN15189> line 15.
17:21 Grinnz the first one is https://metacpan.org/source/SRI/Mojolicious-7.55/lib/Mojo/Reactor/Poll.pm#L17 which says to me that fileno($handle) on one of your handles is returning undef
17:21 Grinnz causing it to set a key of '' in the hash, which is later passed to @poll
17:22 Grinnz "Returns the file descriptor for a filehandle, or undefined if the filehandle is not open."
17:22 Grinnz so something is telling the reactor to watch a closed handle
17:23 mohawk ah, nice
17:23 kgoess another preceeding warning:
17:23 kgoess ojo::Reactor::EV: Timer failed: illegal file descriptor or filehandle (either no attached file descriptor or illegal value):  at /u
17:23 kgoess 4656 sr/share/perl5/vendor_perl/Mojo/Reactor/EV.pm line 51
17:23 mohawk that's pretty unambiguous
17:24 mohawk to double down on my previous thought, that probably ought to be a bit more fatal than it currently is, in this context
17:24 kgoess yes, but what does it *mean* ?
17:25 mohawk you passed a filehandle that was closed, as Grinnz said
17:25 mohawk if it were my code, i'd be making sure it wasn't my code that closed it
17:25 mohawk OR, you opened a file and didn't check it succeeded
17:26 Grinnz (more likely a socket than a file)
17:26 mohawk agreed
17:26 kgoess yes, almost certainly a socket, I'm seeing timeouts on some outgoing internal connects here too
17:26 kgoess would a timeout on a connection cause that sort of thing?
17:27 Grinnz those warnings occur when the socket is initially added to the reactor for watching. the timeout would likely happen later
17:27 mohawk if that's other than a success, i think yes?
17:28 mohawk i will now watch and learn, since my low-level sockets knowledge is faded (having done network stuff with gimp-perl's net mode back in early '14 and not since)
17:30 mohawk kgoess, before you pass your sockets (etc) in, can you add some instrumentation to see they're valid at that point? i think fileno() would work
17:31 kgoess I can look at doing that. still not sure how $timeout becomes '' there, based on that code
17:31 kgoess seems like the worst it could be is 0
17:31 mohawk i was wrong about that before
17:31 mohawk the problem will be as Grinnz said, the contents of @poll
17:32 kgoess oh, ah
17:32 kgoess ok, I'll look at my sockets, thanks!
17:32 mohawk welcome
17:32 mohawk let us know what it was :-)
17:32 sri we should maybe do something like fileno($socket) || croak "..."
17:32 AirDisa_ joined #mojo
17:32 mohawk i definitely agree with that
17:32 sri it wouldn't cost much i guess
17:32 Grinnz sri: would help with debugging if nothing else
17:33 Grinnz sri: // not ||, 0 is a valid fileno isn't it :P
17:33 * tianon gives jberger some matches to rectify the non-fire situation
17:33 mohawk ha ha, so it is
17:33 sri technically
17:33 purl i guess technically is NCPDP D.0 but that could be anything
17:33 sri but you'd never add 0 to an event loop
17:34 Grinnz undef is the only value that indicates a problem anyway
17:34 mohawk it could happen
17:34 sri yea, whatever is more correct
17:34 tianon mohawk: if you filter me down to non-forks it's only something like 78
17:34 mohawk tianon, i wouldn't presume ;-)
17:35 tianon :)
17:37 good_news_everyon joined #mojo
17:37 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vFiWm
17:37 good_news_everyon mojo/master f7554d7 Sebastian Riedel: be a little more defensive regarding closed handles
17:37 good_news_everyon left #mojo
17:39 Oleg joined #mojo
17:39 mohawk mojolicious is 5.10+?
17:40 sri for years
17:40 mohawk so it is
17:40 mohawk great
17:40 Oleg Hmm, what the hack is this? https://metacpan.org/source/Mojo::IOLoop::TLS#L13  I have 1.965 and this produces error inside IO::Socket::SSL
17:41 jberger we even had someone maintain a 5.8 fork for a long while, and then when he abandoned it that wasn't noticed for some time
17:41 sri Oleg: yea, my thoughts exactly when i had to add it
17:41 jberger that's part of the reason that I think the calls to keep 5.6 or even 5.8 compatibility are silly
17:42 sri Oleg: there may be side effects, no clue
17:42 sri supporting older versions of IO::Socket::SSL sucks
17:42 sri because of all the breakage
17:42 Oleg let me try to update it
17:43 Oleg btw, I am on windows 10 bash :D
17:43 mohawk jberger, sadly toolchain stuff is still 5.8, and 5.6 patches accepted
17:44 mohawk "no // for you"
17:44 sri we fixed so many bugs with //
17:45 jberger mohawk: yeah, I know
17:46 jberger that doesn't mean it isn't silly (though less silly I suppose)
17:47 mohawk i guess "unavoidable" can still also be "silly" ;-)
17:47 jamesaxl joined #mojo
17:49 Oleg sri: works with latest IO::Socket::SSL, so requirement of 1.965 may be wrong
17:49 sri we tested it when it was added
17:49 sri not on windows though
17:49 sri who knows, maybe some platform differences
17:50 Oleg ok
17:50 mohawk sri, what's your thought re appveyor for mojo?
17:50 sri it helps a lot
17:51 mohawk oh, it's enabled now?
17:51 mohawk doh
17:51 sri has been before you joined the channel
17:51 Grinnz 12:47:15 <mohawk> i guess "unavoidable" can still also be "silly" ;-)
17:52 Grinnz mohawk: that is all of toolchain :P
17:52 mohawk Grinnz, indeed!
17:52 mohawk especially the terrifying EUMM
17:52 disputin joined #mojo
17:55 Oleg Oh, this IOLoop::Delay changes broke all my stuff. Can we return it back? :D
17:57 Oleg time to fork
17:58 dugword joined #mojo
17:58 mohawk the f-bomb
17:59 ChmEarl joined #mojo
17:59 mohawk oh no he didn't, etc
17:59 genio Oleg: You could always just install the version of Mojo before the changes. Working towards upgrading could take place later and less effort than forking
18:01 Oleg This is cpan module, Mojo::SMTP::Client, it uses remained, catch, finish event, which all were deprecated or changed
18:02 mohawk PR an update on that, then?
18:02 Oleg PR is welcome
18:03 Seth joined #mojo
18:04 sri Oleg: on the plus side, now you can have a cool $smtp->send_p(...) method
18:04 Oleg what will it do?
18:05 sri http://mojolicious.org/perldoc/Mojo/UserAgent#get_p
18:05 sri promises
18:05 purl i heard promises was http://i.imgur.com/7aTdI.jpg
18:05 sri we went all in with promises
18:05 sri Mojo::UserAgent and Mojo::Pg now natively generate promises
18:06 sri so you can compose all that stuff super elegantly
18:06 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-non-blocking-operations
18:07 Oleg Ok, I need to learn more about promises and how they works
18:08 sri worth it, the basic concept is pretty simple, just when you try to understand how they work internally things get complicated
18:09 a6502 there's no Mojo::IOLoop->timer_p yet?
18:10 sri also no ->next_tick_p
18:10 sri didn't want to add those yet
18:11 sri so far promise generating methods are limited to the highest level modules
18:11 a6502 the timer_p would have been useful yesterday.. now i did it the old fashioned way
18:12 sri can't quite say why yet, but making promise versions of event loop primitives doesn't quite feel right
18:13 a6502 in this case i use a timer to do a timeout of a call to a remote api, using delay and multiple callbacks
18:14 a6502 it works but i think it would be cleaner with promises
18:14 Grinnz a6502: thats what ->race is made for
18:14 sri yea, that's a good case for race
18:15 a6502 if i had a timer promise ;)
18:15 sri :S
18:15 Grinnz you can make a promise yourself pretty easily
18:15 Grinnz then Mojo::IOLoop->timer($s, sub { $promise->reject('Timed out') });
18:16 sri interesting, that's even a case against ->timer_p
18:16 sri which would ->resolve without a message i imagine
18:17 Grinnz oh yeah, thats why IO::Async::Future has both delay_future and timeout_future, and i added new_timeout to Future::Mojo
18:17 Grinnz the 'timeout' use case usually works better with a rejection
18:17 Grinnz but other use cases for timers work better with resolve
19:56 gryphon joined #mojo
20:17 disputin joined #mojo
20:34 sri pagination turned out to be really annoying, i didn't have a bootstrap ep template prepared either :/
20:42 geospeck joined #mojo
20:45 jabberwok joined #mojo
20:55 kgoess so it looks like I've having a file descriptor starvation problem. half-closed sockets are persisting across the zero-downtime restarts, and they seem to be being shared by all the children
20:55 kgoess [kgoess@api3a ~]$ sudo lsof -p 8860 -p 8861 -p 8862 -p 8863 | grep -E 'COMMAND|984676002'
20:55 kgoess COMMAND    PID      USER   FD   TYPE     DEVICE SIZE/OFF       NODE NAME
20:55 kgoess /usr/loca 8860 processor  580u  sock        0,6      0t0  984676002 can't identify protocol
20:55 kgoess /usr/loca 8861 processor  580u  sock        0,6      0t0  984676002 can't identify protocol
20:55 kgoess /usr/loca 8862 processor  580u  sock        0,6      0t0  984676002 can't identify protocol
20:56 kgoess four of my mojo workers, each have that half-closed socket
20:56 kgoess it takes a full stop-and-start to get rid of them
20:56 kgoess anybody seen that before?
20:58 sri please don't paste into the channel
20:59 kgoess oh, sorry
21:02 Seth joined #mojo
21:37 marty joined #mojo
22:20 circ-user-ryl12 joined #mojo
22:29 disputin joined #mojo
22:55 Pyritic joined #mojo
23:49 disputin joined #mojo

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