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

IRC log for #mojo, 2016-03-08

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

All times shown according to UTC.

Time Nick Message
00:11 Janos joined #mojo
00:16 Janos hey there, looking for advice, building a small REST service with mojo, using DBIx::Class for database access. I was wondering if there was something that allowed me to define my validation rules in a single place hopefully in my model class
00:17 Janos or maybe the recommendation is to just manually validate with mojo
00:17 Janos what do you think ?
00:30 jberger Janos: Mojolicious' built-in validation system is probably more geared for form validation than REST service
00:30 jberger of course you can validate manually
00:31 jberger I'd probably have you look at Mojolicious::Plugin::Swagger2 for a full validation suite
00:42 Janos jberger, thanks a lot, been looking at the swagger2 plugin and it does look promising, but it does binds me to use the swagger way, I was hoping for something I could pass validation rules and get errors out, much like mojo validation but using a hash instead of having to call methods one by one
00:43 disputin joined #mojo
00:45 jberger https://metacpan.org/pod/Validation::Class perhaps
00:45 jberger ?
00:45 jberger I don't know I haven't used it but it seems that I've heard it spoken well of
00:46 Janos thanks again, will check it out
00:47 jberger do check out the mojo built-in one too though
00:48 * jberger really should familiarize myself with validation recommendations
00:48 jberger :s
00:51 dvinciguerra joined #mojo
00:54 Janos lol all good, i do know the mojo validation and it's great, the one thing that it's cumbersome in this specific case is that validation is done like $validation->input('age: 20'); $validation->required('age') etc
00:56 Janos I was looking for something I could pass a hash like {fields => {age => {required => 1, min => 15}}}, so that validation rules are written more like configuration than actual code
01:00 jontaylor joined #mojo
01:21 vicash Janos I use Mojo::Validation::Validator
01:22 vicash it works well for form validation, and allows me to do rendering of error messages nicely.
01:23 vicash Janos: sorry Mojolicious::Validator and Mojolicious::Validator::Validation. I also created my own custom validation functions that this validator can load.
02:23 asarch joined #mojo
03:03 genio jberger: did you ever get perl.io or whatever the domain was?
03:17 jberger genio: not yet :p
03:29 s1037989 With the latest Mojo::Template update, what's the best way to make methods from a class available to a template?
03:29 s1037989 perl -MMojo::Template -E 'sub abc { shift } say Mojo::Template->new(vars => 1)->render(q(<%= $foo->(123) %>), {foo => *abc});'
03:30 s1037989 Is there a sugary way to allow something like: perl -MMojo::Template -E 'say Mojo::Template->new(vars => 1)->render(q(<%= abc 123 %>));'
03:33 jberger Either pass code references as vars or else use a namespace
03:34 jberger If they are methods you might actually want to wrap in an invocant
03:34 jberger Try the curry module
03:38 s1037989 perl -MMojo::Template -E 'package Mojo::Template::SandBox; sub abc { shift } package main; say Mojo::Template->new(vars => 1)->render(q(<%= abc 123 %>));'
03:38 s1037989 Nifty!!  Thanks, jberger
03:39 s1037989 Also, MST's "curry" or "Sub::Curry"?
03:40 jberger mst
03:41 jberger Also I'd suggest changing the template's namespace rather than importing into the default one
03:42 s1037989 Yep!  Just a quick demo to show that it works.  I think I like that mechanism the best.  Thanks again!!
03:42 jberger np
03:43 jberger Btw that's how helpers are actually done
03:43 s1037989 Good!  That's validation to me that it's the "right" way to do it!
03:44 jberger Yep
03:45 noganex_ joined #mojo
04:17 zivester joined #mojo
04:27 anparker joined #mojo
04:28 bwf joined #mojo
06:19 Vandal joined #mojo
06:36 * sri is not sure what to do about https://github.com/kraih/mojo/pull/930
06:53 moltar joined #mojo
07:03 dod joined #mojo
07:09 dod joined #mojo
07:15 * Lee is for that change, we have that problem with morbo (hadn't got around to looking at it yet)
07:15 Lee needs tests obv, don't think it needs doc updates
07:15 sri it's a breaking change
07:16 Lee oh, it breaks stuff?
07:16 sri http://mojolicious.org/perldoc/Mojo/Server/Morbo#check
07:16 sri it's documented and tested that it only returns one file
07:16 Lee ah!
07:17 sri seems very unlikely that anyone would use that method, but we have to follow the rules
07:20 Lee could probably make that back compat, don't know if there's much value though
07:20 sri value in making it backcompat you mean?
07:20 Lee yeah
07:21 sri agreed, big waste of time for the sake of rules, but we don't really have a choice
07:27 sri this change sucks differently... https://github.com/kraih/mojo/pull/930#issuecomment-193643147
07:28 sri whole reason i made ->check public was for testing
07:29 Lee maybe a ->check_all method, with ->check just being a shim around it?
07:29 sri the check can just be deprecated
07:30 Lee yeah
07:30 sri would work i guess
07:31 sri check_all is a shitty name though if it's the only one remaining ;p
07:31 Lee :)
07:32 Lee ->changes, ->files_changed ?
07:32 * sri nods
07:33 sri something like that is better
07:33 moltar left #mojo
07:34 sri Lee: you want to work on it?
07:34 Lee sure, i'll have a look this morning sometime
07:34 sri test should be trivial too, since i've recently added directory watching checks to t/mojo/morbo.t
07:34 sri just have the directory test create two files
07:35 sri https://github.com/kraih/mojo/blob/master/t/mojo/morbo.t#L117
07:36 sri just create two files and your've got it covered
07:43 AndrewIsh joined #mojo
08:27 mdom What are you using for good_news_everyon?
08:34 trone joined #mojo
08:35 Lee sri: https://github.com/kraih/mojo/compare/master...leejo:gh/930_handle_multiple_files_morbo_restart_SQUASHED # i've squashed it to attribute the original author and prevent test failures in a single commit
08:50 ashimema #930 gets my +1 :)
08:50 ashimema once it's 'right' of course ;)
09:00 nugged joined #mojo
09:05 sri Lee: little sloppy with the docs
09:05 Lee what else needs to go in there?
09:05 sri "Check if files from L</"watch"> has been modified"
09:05 sri "my $file = $morbo->files_changed;"
09:06 sri deprecated methods also get no tests
09:06 Lee ah, ok wasn't sure about that, will fix
09:07 sri nugged: Lee has an almost working patch
09:07 Lee fixed (force pushed)
09:08 nugged great
09:09 sri Lee: that comment doesn't look like good english either
09:09 Lee reads ok to me?
09:10 Lee oh, the original comment in the code?
09:10 sri not that it matters, i'll remove it anyway ;p
09:10 Lee yeah, it doesn't add much now
09:10 sri undef return value doesn't seem to add much either
09:10 nugged just want to append about your, Sebastian proposal with `return $files[0];`, that it still talk about first in list of changed files, but not gives full picture. Though I am a little behind of conversation, though :).
09:11 sri empty array ref would be better
09:11 * nugged reading Lee's link from github comment.
09:12 sri does't ->changed_files read better than ->files_changed?
09:13 sri or even ->modified_files
09:15 sri Lee: and in Changes, you added a method, not an option ;p
09:18 sri Lee: open a pull request please
09:18 Lee done, with above changes
09:18 nugged also parallel but related topic from my experience -- this line: `my $stats = $cache->{$file} ||= [$^T, $size];` -- why it not stores '$mtime'?
09:19 nugged I also want to propose something like this: `[$^T >= $mtime ? $^T : $mtime, $size]` because if you have some files with future dates for some reason morbo restart itself just after start
09:20 sri nugged: have you tried running the tests with that change applied?
09:22 good_news_everyon joined #mojo
09:22 good_news_everyon [mojo] kraih pushed 2 new commits to master: https://git.io/vavaS
09:22 good_news_everyon mojo/master 3cf43ad Lee Johnson: add ->modified_files, deprecate ->check...
09:22 good_news_everyon mojo/master 4cdc302 Sebastian Riedel: Merge pull request #931 from leejo/gh/930_handle_multiple_files_morbo_restart_SQUASHED...
09:22 good_news_everyon left #mojo
09:24 Lee nugged: i've had that too, but the issue was to fix ntp :)
09:26 nugged sri: (no, but will if you order) -- I asking, because what to know the reason why $^T stored there, maybe some secrets I don't know
09:26 sri nugged: my guess would be portability problems
09:27 sri i think batman asked the same recently
09:45 good_news_everyon joined #mojo
09:45 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vavKE
09:45 good_news_everyon mojo/master 1a1f107 Sebastian Riedel: fix a few more issues with the deprecation of Mojo::Server::Morbo::check
09:45 good_news_everyon left #mojo
09:46 sri you forgot a few more small things
09:46 sri for next time :)
09:48 nugged joined #mojo
09:49 Lee in modified_files, why not just return [ grep ... map ]; ?
09:50 sri perltidy indents it weird
09:52 sri Lee, nugged: for the record, using $mtime instead of $^T breaks tests here
09:52 sri os x 10.11
09:57 vanHoesel joined #mojo
10:00 sri actually i screwed up merging the pull request, sorry about that
10:00 sri i shouldn't have done it since it failed the pod coverage test
10:01 sri that's gonna set a bad precedent :(
10:01 Lee that's my bad, should have run *all* the developer tests
10:02 sri so, for future reference, i screwed up, we should not repeat that!
10:02 Lee is there a trivial way to run all dev tests, other than setting all the env vars?
10:02 sri the tests run automatically in travis though, i just didn't wait for them to finish
10:02 jontaylor joined #mojo
10:03 sri just morbo.t, hypnotoad.t and the ipv6 tests don't run on travis
10:03 sri because they are not 100% reliable in the case of morbo.t/hypnotoad.t
10:04 sri and unsupported in the case of ipv6
10:05 sri oh, also prefork and online... ok, that's a lot not running :S
10:05 sri afraid you have to set all env vars
10:05 sri make clean; perl Makefile.PL; TEST_POD=1 TEST_HYPNOTOAD=1 TEST_MORBO=1 TEST_PREFORK=1 TEST_EV=1 TEST_ONLINE=1 TEST_IPV6=1 TEST_TLS=1 TEST_SOCKS=1 HARNESS_OPTIONS=j9 make test
10:05 Lee i get "Mojo::Reactor::EV: requiring 'Mojo::Reactor::EV' failed" for t/pod_coverage.t in master - optional module missing?
10:06 sri EV
10:07 sri sadly there is no alternative for super high performance yet
10:16 osfabibisi joined #mojo
10:16 osfabibisi joined #mojo
10:17 sri we sure have a lot of deprecations recently
10:24 good_news_everyon joined #mojo
10:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vavD9
10:24 good_news_everyon mojo/master 715d528 Sebastian Riedel: fix formatting of Morbo output
10:24 good_news_everyon left #mojo
10:38 kriztw I'm using jberger's Mojo::Phantom library, and I get a lot of warnings from Mojo::IOLoop because MOJO_REUSE is undef when DESTROY is called without listen being called first
10:38 kriztw is that a bug in Mojo::Phantom or in Mojo::IOLoop?
10:39 kriztw or, alternatively, in my code? :D
10:51 pink_mist maybe you can show us your code so we can tell? :P
10:54 CandyAngel Mojo is so coooool :P
10:55 CandyAngel I want to return the all the data my controller has collated and show it in a particular format
10:55 CandyAngel Add a link to "respond_to", done
10:55 CandyAngel Line*
10:56 CandyAngel Oh wait.. do I even need to do that..
10:57 CandyAngel Ha, no I don't. I just create a new template and it uses it :P
10:59 pink_mist \magic/
11:00 CandyAngel I lost a script I wrote a while ago to help me download games and stuff I bought
11:00 CandyAngel I just reimplemented it in like.. an hour?
11:01 kriztw pink_mist: our codebase is pretty large, so it's nontrivial to show enough to give context
11:02 pink_mist alright, try mocking up a tiny script that exhibits your issue
11:02 kriztw pink_mist: https://github.com/kraih/mojo/blob/master/lib/Mojo/IOLoop/Server.pm#L29
11:03 kriztw MOJO_REUSE can be undef here, and usually it is set when listen is called
11:04 kriztw so my question is, is the error that listen is required to be called (in which case phantom should be fixed), or isn't it, in which case it should probably have '' as a default value
11:05 CandyAngel Now, if only DownThemAll didn't mangle filenames because Win32
11:06 kriztw I can probably mock up a script, but that will take some time, and I feel like the logic is pretty clear - I just don't know where to place the blame for the environment variable being undef
11:06 kriztw it can be fixed wherever though
11:10 vanHoesel joined #mojo
11:13 dvinciguerra joined #mojo
11:19 nugged joined #mojo
11:20 nugged joined #mojo
11:23 sri kriztw: i don't see an error
11:23 sri perl -Ilib -Mojo -E 'Mojo::IOLoop::Server->new'
11:27 sri is your mojolicious version old?
11:28 kriztw sri: we're at v6.50
11:29 kriztw I'm pretty sure it's an interaction between https://github.com/jberger/Mojo-Phantom and Mojo, but not entirely sure why it happens
11:30 kriztw we get a ton of WARN IOLoop/Server.pm line 29: Use of uninitialized value in substitution (s///) at /home/perlrepo/ubuntu/perl-5.16.3/lib/site_perl/5.16.3/Mojo/IOLoop/Server.pm line 29 during global destruction.
11:30 kriztw when we run tests
11:30 kriztw at the end
11:31 kriztw oh, it might be a difference in warning levels?
11:32 sri well, we can just change it to "($ENV{MOJO_REUSE} //= '')", but i'd want to know why exactly
11:32 sri the "if $self->{reuse}" should already be enough
11:32 kriztw if I put in a debug print I get an undef warning, but I get no warning from the regex replace
11:34 kriztw sri: $ENV{MOJO_REUSE} is undef, you just don't get warnings for it per default
11:34 kriztw but we do in our test suite because we set extra warnings
11:34 sri that doesn't matter
11:35 sri $self->{reuse} should not be set if $ENV{MOJO_REUSE} is undef
11:48 kriztw sri: ok, that makes sense, then it's probably us or Mojo::Phantom that has the error
11:48 asarch joined #mojo
11:53 pink_mist I doubt it's Mojo::Phantom, which is why I suggested creating a tiny mocked test case to try to reproduce the issue; I expected that in the course of getting it reproduced you'd realise what you were doing wrong and thus be able to fix it on your end
12:16 vanHoesel1 joined #mojo
12:22 jberger kriztw: I wouldn't even know where to start looking
12:26 kriztw jberger: it might be a problem on our end, I'm bisecting it now
12:27 kriztw It just looked like something from upstream, which is why I asked
12:28 HtbaaPi joined #mojo
12:31 jberger Well if you narrow it down please let me know
12:31 jberger Hopefully phantom had been useful to you
12:32 jberger s/had/has/
12:33 kriztw jberger: it's very useful, thanks for your work
12:35 cosimo joined #mojo
12:39 jberger I'm so glad to hear it!
12:57 taichi joined #mojo
13:06 McA joined #mojo
13:07 taichi joined #mojo
13:24 sri wat? https://github.com/kraih/mojo/issues/932
13:42 batman sri: does chy-causer mean that "id" should be set to the same value as "name" ?
13:42 * batman has been on vacation
13:42 sri batman: if i knew i wouldn't ask
13:43 batman i don't think that "id" should be the same value as "name", since "id" is unique for the whole page, while name is only unique for the current form (iirc)
13:44 CHYC batman: "name" and "id" need not necessarily be the same, but "for" and "id" need to be.
13:45 batman i often do stuff like <%= label_for "form_name" %> and <%= text_field "name", id => "form_name" %>
13:46 neilhwatson joined #mojo
13:47 batman CHYC: i don't understand what you want to accomplish. i don't think the mojolicious documentation should act as a HTML tutorial
13:48 CHYC batman: Perhaps not, but the examples are invalid HTML.
13:48 sri yea, communicate your intention
13:48 sri that issue is super vague
13:48 batman CHYC: what is invalid...?
13:49 CHYC <label for="foo"> with no matching <input id="foo"> is invalid.
13:50 batman are you sure..? either way, how do you suggest mojolicious fix that..?
13:50 nic Are we just talking about tweaking the example(s)?
13:51 kaare joined #mojo
13:51 batman CHYC: are you talking about the examples at http://mojolicious.org/perldoc/Mojolicious/Plugin/TagHelpers#label_for ?
13:52 CHYC batman: The examples there do not show a corresponding input tag, so their validity is undefined.
13:53 csson batman: yes, confirmed with https://html5.validator.nu/: "The for attribute of the label element must refer to a non-hidden form control."
13:53 CHYC THe rendering guides do show the input tags, so they are invalid:
13:53 CHYC http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering
13:53 batman CHYC: but the label_for() helper does not create an input tag
13:53 good_news_everyon joined #mojo
13:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vafBR
13:53 good_news_everyon mojo/master 48c1531 Sebastian Riedel: use id attributes in form examples (closes #932)
13:53 good_news_everyon left #mojo
13:53 batman csson: right. i read the spec again, and i agree on the spec.
13:54 CHYC sri: Thank you :)
13:54 zivester joined #mojo
13:54 ramortegui joined #mojo
14:06 jberger kriztw: is this from you? https://github.com/jberger/Mojo-Phantom/pull/1
14:07 kriztw jberger: oh, that's from one of my coworkers who didn't tell me he send it in
14:07 kriztw I hadn't seen it either
14:08 jberger seemed unlikely to get two unrelated inquiries on the same day
14:08 jberger anyway, I'll respond formally there, but I'm not very keen on the idea
14:12 jberger kriztw: https://github.com/jberger/Mojo-Phantom/pull/1#issuecomment-193798231
14:13 kriztw jberger: thanks, I pinged him for you :P
14:36 Zx3 joined #mojo
14:40 perlpilot joined #mojo
14:41 sri razer makes really good looking laptops
14:41 sri wonder if they run linux well
14:41 * sri drools http://assets.razerzone.com/eeimages/products/23914/razer-blade-standout-performance.png
14:45 genio That is a nice looking laptop.  My only concern would be the trackpad.  I can't live without the usability of Apple's trackpad
14:46 genio If that thing can come close, I might consider one
14:48 sri that external graphics thingy is a fun idea too http://www.razerzone.com/gaming-systems/razer-blade-stealth
14:48 * neilhwatson still likes his Thinkpad, the Volvo of laptops.
14:49 sri neilhwatson: enjoy your superfish!
14:49 sri lenovo is dead for me
14:49 neilhwatson Wiped it first.
14:50 sri well, then enjoy your bios malware ;p
14:50 sri http://www.theregister.co.uk/2015/08/12/lenovo_firmware_nasty/
14:51 sri never gonna trust that company again
14:51 genio I think that was only on a few select (more geared towards individual use) series of the ThinkPad brand.  None of ours were in that group here at work
14:52 genio But I agree, Lenovo as a company went way down in the trusted companies list for me
14:55 neilhwatson Even the legit software factory loaded on laptops could be considered maleware. Wipe them all and start again.
14:56 genio can't really wipe the bios
14:56 neilhwatson Yeah, that sucks.
15:03 Adura Melt down the hardware into its base elements.
15:04 sri really too bad the linux laptop market just doesn't improve
15:05 sri aside from dell there isn't much
15:05 cfedde system76 is mostly basic hardware.
15:06 sri think i've seen someone take apart a system76 and it was some super cheap chinese garbage inside
15:06 sri like, really badly built
15:08 asarch If I send with JavaScript: var req = new XMLHttpRequest(); ... req.send("foo");, how can I "capture" that value in the controller?
15:08 cfedde but their website is so pretty.
15:08 sri this seems to be the baseline now http://www.dell.com/us/business/p/xps-13-linux/pd
15:08 cfedde I own an older version of that dell with ubuntu on it.  I had a few UI issues early on but it's held up pretty well so far.
15:09 cfedde and it updates cleanly from the ubuntu servers.
15:10 cfedde I also have an old System76 netbook.  It is a pretty high spec machine for it's age.  I've never tried to update the os on it.
15:10 cfedde or rather I tried once. Had to take it to their office here to get it to work again.
15:11 Grinnz hrm. that XPS doesn't look like much for $900
15:11 Grinnz my laptop was $900 and has an i7 and a gpu
15:12 Grinnz unfortunately, it has optimus, but that's the state of mobile gpus :/
15:12 mcsnolte joined #mojo
15:13 Grinnz the size and display of that one does look nice though
15:13 cfedde I bought the next bump up XPS-13 almost two years ago.  fit and finish are quite nice.  Better than a high spec plastic box.
15:13 Grinnz difficult to find good laptops smaller than 15.7" screens these days
15:14 cfedde touchscreen on a laptop is pretty useless.
15:14 Grinnz never cared much about that
15:14 kriztw jberger: I found the warning stuff, we had a reference cycle in some of our test initialization code
15:15 kriztw which was added around the same time as we began using your module
15:15 Grinnz oh, is that a touchscreen? that explains the price
15:16 sri that carbon fiber doesn't look cheap either
15:17 Grinnz if i could get one of those with a nvidia maxwell gpu that's *not* optimus, and no touchscreen, then i'd think about it :P
15:17 vanHoesel joined #mojo
15:19 vanHoesel1 joined #mojo
15:20 dod joined #mojo
15:24 jberger kriztw: ah, good that's settled then
15:32 dod joined #mojo
15:37 sri can a file not have an mtime?
15:38 * sri just stumbled over "return undef unless defined $mtime;" in Morbo.pm and has no clue if that does anything
15:38 jberger maybe certain file systems?
15:38 jberger but yeah, no idea
15:43 acamari joined #mojo
15:50 good_news_everyon joined #mojo
15:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vafxj
15:50 good_news_everyon mojo/master 55e1427 Sebastian Riedel: small optimizations
15:50 good_news_everyon left #mojo
15:50 sri i guess we'll see
15:53 zivester joined #mojo
16:04 good_news_everyon joined #mojo
16:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaJfs
16:04 good_news_everyon mojo/master 4e5419c Sebastian Riedel: no need for an extra function
16:04 good_news_everyon left #mojo
16:15 nugged joined #mojo
16:25 dvinciguerra joined #mojo
16:31 lluad joined #mojo
16:35 bradjm joined #mojo
16:41 disputin joined #mojo
16:49 good_news_everyon joined #mojo
16:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaJsV
16:49 good_news_everyon mojo/master cf21545 Sebastian Riedel: slightly better descriptions
16:49 good_news_everyon left #mojo
16:49 punter joined #mojo
16:56 jberger sri++ # cf21545
16:57 pink_mist haha yes, nice :P
16:58 Adura Next perl web framework will be Rick and Morty themed.
17:12 odc will the framework be drunk all the time?
17:18 * genio points to the clinking beer mugs in the topic.
17:21 jberger 🍻
17:21 jberger we do already have the usually-drunk bender
17:21 dod joined #mojo
17:27 sri :)
17:28 PryMar56 joined #mojo
17:29 jberger http://weknowmemes.com/generator/uploads/generated/g1365486955923810759.jpg
17:43 vanHoesel joined #mojo
17:47 irqq joined #mojo
17:53 punter joined #mojo
18:00 trone joined #mojo
18:12 good_news_everyon joined #mojo
18:12 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaJK8
18:12 good_news_everyon mojo/master b7a08c3 Sebastian Riedel: the default handlers do not serve a purpose
18:12 good_news_everyon left #mojo
18:18 preaction jberger: in Mojo::JWT is there a recommended way i should use it for doing authentication, or is there room for a Mojolicious::Plugin::JWT or something?
18:44 ichi joined #mojo
18:53 jberger preaction: jwt doesn't really have anything to do with authentication, just message integrity
18:54 preaction right, i get that, except jwt.io/introduction explicitly has a thing about using "Authentication: Bearer <token>" to do authentication. so there's a recommended way to do it apparently
18:54 preaction sorry, Authorization: Bearer <token>
18:55 preaction and then having it just magically show up in the context could be nice
18:56 jberger Hmmmmm
18:56 jberger Yeah that might be nice
18:57 jberger I don't remember what riche's plugin does
18:59 preaction i think it's for Google-specific token or something
18:59 preaction and then doing $c->jwt( claims => ... ) would create a new token and automatically set up the secret and the settings i want
18:59 preaction but just $c->jwt would look in Authorization for the current token and return it
19:00 preaction if we agree, i can put together a patch for Mojo::JWT to add it, or i could do it as its own thing, whichever you think is best
19:01 preaction ... and now i also think i need a Test::Mojo::Role::JWT to automatically add a JWT auth token to each request...
19:02 jberger preaction: you're welcome to work something up
19:03 jberger I guess I wish riche's plugin was a little more generic than that
19:03 preaction he's been responsive when i've had previous dealings, we might be able to nudge him a bit
19:49 mspo what's the best way to do long polling these days?
19:51 preaction cry
19:52 mspo a websocket or just refreshing an api call, I guess?
19:52 preaction websockets would be the best way to push data from the server to the client. if you can do that, then it's fine
19:53 irqq joined #mojo
19:53 mspo http://caniuse.com/#feat=eventsource  IE--
19:54 jberger zomg eventsource is less supported than websocket :-P
19:55 Grinnz yeah, websockets will work on basically anything other than IE before 10
19:55 mspo maybe just meta refresh :)
19:55 mspo less js for me
19:55 Grinnz or old android browsers
20:10 CandyAngel Hm.. I don't suppose anyone has seen anything for doing notify-send over the network. might make something in Mojolicious if not
20:12 CandyAngel Should be nice and easy to do in one app. Starting it as daemon runs the server, then 'mojo-notify $address "message"'
20:13 CandyAngel Or mojo-notify send <address> :P
20:14 jberger CandyAngel: that could be a fairly trivial addition to preaction's Mercury
20:14 Adura Is there some sort of... "standard" for that?
20:14 preaction is it a websocket thing?
20:15 CandyAngel I just have a lot of VMs and screen sessions running and I really need something to pop up on my screen when commands have finished running
20:15 jberger oh nm, I didn't realize notify-send was a specific thing
20:15 CandyAngel It doesn' thave to be notify-send
20:15 jberger I though you meant some kind of generic "trigger an event" thing
20:15 CandyAngel I just want the notification :P Alternatives are fine!
20:16 jberger that has to run at a system level
20:16 jberger there has to be a listener
20:16 CandyAngel I know, that's fine too. I don't mind running a listener as well
20:17 CandyAngel Even if it was like.. a web page and they got listed there and i could clear them as I start the next task
20:18 punter joined #mojo
20:21 CandyAngel Basically, I'm running a lot of tasks that can take 30+ minutes to complete and I keep forgetting to check them all, so some stuff is idle for longer than it needs to be :P
20:24 s1037989 CandyAngel: just curious how you'd trigger the notification?  $ some_task && mojo-notify?
20:24 CandyAngel s1037989: Yup. Though more likely $ some_task; mojo-notify
20:24 CandyAngel So it ran even if the command failed
20:25 CandyAngel or
20:25 CandyAngel mojo-notify "message" command <args>
20:25 CandyAngel If I was bored :P
20:25 CandyAngel Then the notification can tell me the command that finished
20:26 lluad My terminal client will pop up a desktop notification when a terminal rings a bell...
20:26 s1037989 I'd be interested in hearing what you finalize on.  Seems there's a myriad of options for this.  Are you looking at a mojo-notify method to be more generic?  Seems there's a dozen tools that could notify on other protocols, even IRC.
20:26 CandyAngel lluad: My terminals are running in VMs, so that wouldn't work
20:27 CandyAngel Hmmm
20:27 s1037989 And of course there's the obvious SMTP, but I hate configuring an MTA on every box.
20:27 CandyAngel Notification in IRC would be nice..
20:27 CandyAngel Well, the mojo-notify could use different notification "servers", sure
20:28 CandyAngel Either a web-based one, or a "notify-send" listener, or IRC/XMPP
20:28 Adura echo -e "\07" good enough? :P
20:29 CandyAngel Adura: No :P
20:32 s1037989 Maybe, checkout sendgrid. Have you looked at them?  They have some amazing APIs and offer a lot of calls for free.  10,000/mo?
20:33 CandyAngel I'm actually really liking the idea of having a bot message me on IRC
20:33 CandyAngel I nearly *always* have IRC open
20:33 s1037989 Mojo::IRC!
20:36 s1037989 I'd be totally interested in a App::MojoNotify or something if you put one together...  Hopefully make it have plugins so one wouldn't be forced into IRC.
20:36 jberger I mean this sounds like a message bus
20:36 jberger there are solutions already as long as you can have a little daemon
20:37 jberger redis, mercury
20:37 jberger etc
20:39 CandyAngel s1037989: Sure, I'll you know if I do something
20:39 s1037989 Thanks!
20:39 Adura You could see what your DE does toaster notification-wise.
20:42 good_news_everyon joined #mojo
20:42 good_news_everyon [mojo] kraih tagged v6.55 at be9195a: https://git.io/vaUY4
20:42 good_news_everyon left #mojo
20:43 good_news_everyon joined #mojo
20:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaUYo
20:43 good_news_everyon mojo/master 5748c55 Sebastian Riedel: bump version
20:43 good_news_everyon left #mojo
20:43 Adura CandyAngel, does your DE use dbus?
20:44 CandyAngel Yes and dbus doesn't do networked notifications as far as I am aware
20:44 CandyAngel This isn't local stuff
20:45 Adura Guess that'd be a client, then.
20:47 jberger hunh, sri, I don't see that last commit announced to the channel
20:48 jberger changing the default handlers
20:48 jberger does that mean that in concept if someone what redefining how say data handler behaved that they can't do that anymore?
20:58 good_news_everyon joined #mojo
20:58 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaUsi
20:58 good_news_everyon mojo/master 22c4140 Sebastian Riedel: a few more description changes
20:58 good_news_everyon left #mojo
20:58 sri jberger: yes
21:08 sri which if you think about it is a horrible idea
21:11 jberger probably, I'm just curious if anyone was doing that
21:13 sri considering they all were special with their own options, which was never documented, i kinda doubt it
21:13 Grinnz_ the only thing i'm doing that seems at all related is the overriding of exception pages as in https://metacpan.org/pod/Mojolicious::Guides::Rendering#Rendering-exception-and-not_found-pages
21:13 Grinnz_ but i dont think thats affected
21:13 sri not at all related
21:30 sivoais joined #mojo
21:36 marty_ joined #mojo
21:55 mdom Great additions for Mojo::Template! Just added my dependency to 6.54 to use them!
22:01 bpmedley CandyAngel : What DB do you run?  If you use PostgreSQL, then I believe you can use the notifications inherent to Pg.
22:04 CandyAngel Not using any database..?
22:05 bpmedley Hrmm, I look forward to seeing your solution, then.. :)
22:11 mspo CandyAngel: at the end of all your jobs put a curl to a notification service
22:11 mspo then it would work like https://deadmanssnitch.com/
22:12 mspo or execute jobs in a more sane way than screen + random session
22:13 CandyAngel A more sane way? I'm listening
22:14 mspo CandyAngel: like anything?  :)
22:15 mspo CandyAngel: mojo minion, jenkins, kubernauts, cron
22:15 mspo kronos
22:15 CandyAngel You're not getting my use case :P
22:15 mspo guess not
22:16 CandyAngel I'm currently moving and sorting several million files
22:16 CandyAngel git takes a long time to commit, git-annex takes a long time to add
22:17 CandyAngel I'm also downloading digital purchases, so I need to know what a directory no longer contains *.dtapart files (downloading is finished)
22:17 CandyAngel And then when git-annex has finished adding them, when md5 has finished checking them
22:18 mspo git is bad at many files
22:18 mspo or maybe git-annex fixes that
22:18 mspo anyway I stand by my statement
22:18 mspo it really sounds like a workqueue
22:20 CandyAngel it is, but it can be completely arbitary commands
22:20 CandyAngel Which cron and Minion aren't for, as far as I know
22:21 mspo you just need to pop the commands from the queue, run them, and notify when done
22:21 punter joined #mojo
22:22 mspo even if your "job" was just my $cmd = shift; my $out = qx#$cmd#; exit shift $?<<8; (or whatever)
22:22 CandyAngel That sounds more complicated than it needs to be
22:22 CandyAngel And prevents me from checking its progress
22:22 CandyAngel A lot of them are run through 'pv' so I can see it actually doing something
22:23 mspo okay
22:23 mspo tmtowtdi
22:23 CandyAngel On a only tangently related note, one of the commands just failed because of an IO error :|
22:23 CandyAngel Laptop HDD is failing :(
22:23 mspo too bad it doesn't resubmit itself into the queue ;)
22:24 CandyAngel So it can fail over and over and over on a failing drive?
22:39 vanHoesel joined #mojo
23:29 bpmedley sri , jberger : http://bmedley.org:3000 <-- I made some modifications.. could this be useful?  This is my Minion UI I was working on a few weeks ago
23:33 bpmedley Also, thoughts from anyone else would be all the awesome..
23:55 bpmedley https://github.com/brianmed/minion_ui/blob/master/ex/pg_demo.pl  <-- I merged in jberger's changes!!  This is now all it takes to have a Minion UI.. launch via $ perl pg_demo.pl minion ui
23:55 jberger <3 commands
23:55 jberger I'll try to read up at some point
23:56 jberger But I'm away from my computer atm
23:56 bpmedley jberger : The app is mobile friendly.. :-0

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