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

IRC log for #mojo, 2017-07-14

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

All times shown according to UTC.

Time Nick Message
00:08 Pierre joined #mojo
00:29 arcanez and we can't have that
01:02 schelcj joined #mojo
01:11 schelcj joined #mojo
01:19 schelcj joined #mojo
01:37 Pierre joined #mojo
02:02 kiwiroy joined #mojo
02:05 noganex_ joined #mojo
02:42 kiwiroy joined #mojo
02:58 kiwiroy joined #mojo
03:15 kiwiroy joined #mojo
03:36 kiwiroy joined #mojo
03:39 karjala_ joined #mojo
03:53 kiwiroy joined #mojo
04:01 jberger oO
04:01 jberger is Coro back? https://metacpan.org/release/MLEHMANN/Coro-6.512
04:24 kiwiroy joined #mojo
04:40 kiwiroy joined #mojo
04:47 schelcj joined #mojo
04:56 kiwiroy joined #mojo
05:11 trone joined #mojo
05:28 kiwiroy joined #mojo
05:35 Pierre joined #mojo
05:43 schelcj joined #mojo
06:46 karjala_ joined #mojo
06:51 AndrewIsh joined #mojo
07:02 Lee_ joined #mojo
07:07 Lee[home] joined #mojo
07:29 prg joined #mojo
07:34 Vandal joined #mojo
07:51 Lee_ joined #mojo
07:51 Lee[home] joined #mojo
07:56 dod joined #mojo
08:02 dod joined #mojo
08:19 inokenty-w joined #mojo
08:23 cosimo joined #mojo
08:27 rshadow joined #mojo
08:34 cosimo joined #mojo
08:56 VVelox joined #mojo
09:27 castaway preaction: hey, about? just trying Beam::Runnable::Timeout::Alarm.. and it seems to be ending fairly instantly
09:44 castaway .. using beam run that is
09:55 * castaway fails to get Beam::Minion running, hmm
10:10 bianca joined #mojo
10:12 bianca Hey, I am trying to save a file inside /public/images/filename.png from a post method defined inside the controller. I am currently doing something like $path = '../public/images/' which only works if I run the application from inside script/ i.e it fails if I run perl script/myapp daemon. Do you know a better way of constructing the path?
10:14 CandyAngel bianca: You should probably be using Mojo::Home
10:15 bianca checking it out, thanks a lot :)
10:16 CandyAngel I think the synopsis covers what you are after
10:16 bianca yes, I didn't know what to look for :)
10:16 CandyAngel i.e. $home->child('public', 'images', 'filename.jpg');
10:16 CandyAngel Uh-huh, that happens :P
10:25 petru joined #mojo
10:27 petru I have a list of hashes of having 2 keys. Based on this list, I want to generate a select_field. What's a clean way to do this?
10:34 geheimnis` joined #mojo
10:52 gregf_ joined #mojo
11:36 castaway hmm, fun.. why doesnt Minion::Backend::Pg include a dep on Mojo::Pg ?
11:48 haarg it's packaged with Minion, so that would make Minion depend on DBD::Pg
11:51 ribasushi joined #mojo
12:02 castaway haarg: hmm? i failed to grok that
12:02 * castaway just took a break to upgrade pg from 9.4 to 9.5.. funfun
12:02 haarg Minion::Backend::Pg is shipped with Minion
12:02 castaway haarg: yup
12:03 castaway but when I ran my mini app the first time it said:
12:03 haarg so adding a dep would mean Minion itself would always depend on Mojo::Pg and DBD::Pg
12:03 castaway Can't locate Mojo/Pg.pm in @INC
12:03 castaway oh.. now I get you
12:03 castaway hmpf
12:04 castaway so you either get ALL the db stuff, or none and diy ;)
12:06 tchaves joined #mojo
12:13 Lee[home] joined #mojo
12:17 bianca joined #mojo
12:17 Lee_ joined #mojo
12:35 gizmomathboy joined #mojo
12:38 Vandal is there a way to disable Rendering cached template?
12:39 irqq joined #mojo
12:44 castaway hmm, just saw the minion enqueue "delay" param.. wonder if I can use that .. instead of a worker that just sleeps N secs..
12:57 cosimo joined #mojo
12:58 Vandal nvm, I've found how
13:01 itaipu joined #mojo
13:01 Gedge joined #mojo
13:13 Pyritic joined #mojo
13:22 itaipu joined #mojo
13:35 sri you know, the vcsode docs kinda make me rethink my reference docs vs tutorial separation stance... the way they mix it for stuff like settings is really good https://code.visualstudio.com/docs/getstarted/settings
14:02 bianca joined #mojo
14:03 bianca joined #mojo
14:11 gryphon joined #mojo
14:23 sri not that i know how to use that format for class reference docs like in mojolicious
14:29 mcsnolte joined #mojo
14:30 castaway sri: any thoughts re using delay (start of worker) versus worker that sleeps? ..
14:31 castaway fwiw I prefer reference docs with examples.. and tutorials that glue the whole lot together
14:31 sri delay
14:31 Gedge_ joined #mojo
14:32 castaway righto.. and if I want to do aomething when working is done: $job->on('finished', sub {}) .. or did I miss another way?
14:34 jberger castaway: the problem with the finished event is that it is fired from inside of the job process.
14:35 sri yea, events are for extension libraries, not tasks
14:35 jberger if that is good enough then that's fine, otherwise I wrote Minion::Notifier which uses a message broker to make the event more available
14:36 castaway otherwise.. polling? (ick)
14:37 jberger polling is an option, but as I said, not necessary with Minion::Notifier
14:37 castaway as in, whats the usual way to do it?
14:37 jberger mostly Minion tasks are set-it-and-forget-it
14:37 sri the example app polls https://github.com/kraih/minion/tree/master/examples/linkcheck
14:38 jberger "post processs all of these pictures"
14:38 castaway hmm, the entire point of mine is "wait X time then do Y"..
14:38 jberger castaway: there are delayed jobs
14:38 sri think we are talking about different things
14:39 castaway maybe..
14:39 purl Maybe not.
14:45 castaway going to try what I've got and see what happens ;)
14:51 vicash castaway: if you have to "wait X time", using an event loop Mojo::IOLoop maybe a preferred method rather than polling
14:52 castaway Im not using mojo in general
14:54 vicash castaway: Minion uses Mojo::IOLoop internally.
14:54 sri vicash: no it doesn't
14:55 vicash sri: but Minion::Job has "use Mojo::IOLoop" !?
14:55 sri to call Mojo::IOLoop->reset
14:56 sri after fork
15:01 sri until castaway explains the use case in more detail i don't think there is much we can do
15:03 dod joined #mojo
15:06 castaway I will attempt in a mo.. sec
15:08 castaway hmm, finished event doesnt seem to get called.. (tho not really sure how it would.. )
15:09 castaway this is what I did so far: http://paste.scsys.co.uk/564610
15:10 castaway .. I suspect instead of trying to be clever .. I should probably load my websimple model in the job code.. and then check/call step_chore in the job code itself..
15:11 sri yes, waiting for a job to finish is always going to be shitty, might as well not use a job queue at all
15:12 castaway tis (imo) not all thaht complicated.. user taps button to say "dishwasher is running".. system tells em 2 hours later "its done!"
15:12 castaway so.. code into the job?
15:12 castaway dunno why I was trying to get around that
15:15 sri a job can just enqueue another job
15:15 sri if you're still considering some kinda sleep
15:16 castaway nah, delay is fine.. next is a user job tho.. no timer needed
15:16 sri job1 does whatever it needs to start your dishwasher, enqueues job2 with a delay of 2 hours that will send a notification
15:16 castaway oh I see..
15:17 castaway might be useful later.. this is more for prompting users tho.. not automating the whole thing ;)
15:19 jberger can the prompt just be at the end of the task definition?
15:20 jberger or be two jobs with a parent-child job relationship
15:20 jberger TIMTOWTDI of course :D
15:21 castaway end of job.. currently I have a step cycle of load -> run -> empty -> load etc..
15:22 castaway anyhoo.. now getting the job to load the model..
15:43 zivester joined #mojo
15:48 PryMar56 joined #mojo
15:48 vicash left #mojo
15:52 karjala_ joined #mojo
15:55 castaway woohoo, it worked
15:55 purl Of course it worked
15:55 * castaway pats purl
15:55 * purl bites!
15:56 castaway http://paste.scsys.co.uk/564611 <- saner?
16:00 castaway jberger: hmm, now I have the thing, I could put the "send notification" bit into a job, and start that.. ;)
16:10 karjala_ Is there a way to check out how many hypnotoad workers were busy each hour or so in the past day/month?
16:11 karjala_ like a chart or something
16:11 karjala_ And other useful stats?
16:12 karjala_ hm... in a non-blocking application it shouldn't really matter how many
16:12 karjala_ yes
16:13 karjala_ but is a large file-downloading operation non-blocking? (eg with Plugin::RenderFile)
16:14 jberger castaway++
16:16 jberger karjala_ can you not just render it with a Mojo::Asset::File?
16:16 jberger looking at M::P::RenderFile there are some immediate code-smells
16:16 karjala_ I could... I was just trying to make my code tidier.
16:17 karjala_ jberger, maybe you could submit issues in its github repo
16:17 jberger I suppose I could, but I just use Mojo::Asset::File
16:17 karjala_ I'll write my own plugin in place of renderfile then
16:18 karjala_ what code smell did you see?
16:18 karjala_ the utf8?
16:18 purl i heard the utf8 was telling perl teh source code is utf8
16:19 jberger yes, on a quick viewing
16:19 jberger anyway http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Custom-responses
16:19 jberger is M::P::RenderFile really just sugar for generating the content disposition header?
16:20 karjala_ that's what i used it for, anyway. i don't know really
16:20 karjala_ and you can serve $data from a va
16:20 karjala_ var
16:20 jberger oh I see it is trying to do some range operations too
16:21 karjala_ doesnt need a file
16:21 jberger like a Mojo::Asset::Memory?
16:21 karjala_ o
16:21 jberger I'm not saying sugar isn't good
16:22 jberger just know that you don't need it
16:22 karjala_ ok :-)
16:23 jberger anyway Mojolicious::Static does range operations too so I don't know why it is trying to do that?
16:23 jberger am I missing something?
16:25 jberger ummm: https://metacpan.org/source/KOORCHIK/Mojolicious-Plugin-RenderFile-0.11/lib/Mojolicious/Plugin/RenderFile.pm#L28
16:25 Grinnz ????
16:26 jberger I could see the usefulness of generating some of the auxiliary headers
16:27 jberger most of the rest of that module seem unnecessary IMHO
16:29 sri jberger: think it predates those parts of the static api being public
16:29 jberger ah, now that would make more sense
16:30 jberger in which case I rescind some of my tone (which I probably shouldn't have used anyway)
16:30 jberger but the overall point stands given the current state of things
16:32 petru joined #mojo
16:45 Pyritic joined #mojo
16:48 itaipu joined #mojo
16:49 jberger should the filename be manually utf8 encoded here: https://metacpan.org/source/KOORCHIK/Mojolicious-Plugin-RenderFile-0.11/lib/Mojolicious/Plugin/RenderFile.pm#L59 ?
16:49 jberger seems like that would happen as the headers are written
16:51 sh14 joined #mojo
16:51 jberger also I don't think you specify the filename on the Content-Type header https://metacpan.org/source/KOORCHIK/Mojolicious-Plugin-RenderFile-0.11/lib/Mojolicious/Plugin/RenderFile.pm#L61
16:52 jberger now I'm really just trying to analyze for a potential simple replacement that just generates the headers
16:52 Grinnz honestly the only complicated part of adding the headers is finding the mime type of your file
16:53 Grinnz also if your filename is non-ascii, but browsers have no consistent way of dealing with that anyway
17:10 Vandal what is the simple way to exec external application and move on?
17:11 Grinnz depends on the context
17:11 Grinnz is this in a web app? or?
17:11 Vandal what?
17:12 Grinnz what kind of application are you talking about?
17:12 Grinnz what is it doing at the time where you want to exec an external application?
17:12 Vandal vlc.exe
17:12 Grinnz i mean your perl application
17:12 Vandal mojo app
17:12 Grinnz ok, so you want to do this while responding to a http request?
17:12 Vandal yep
17:13 Grinnz do you care about the result of the exec?
17:13 Vandal no
17:14 nicomen do you want to track it, ie. be able to stop it later?
17:14 Vandal I tried kust exec and redirect but it halts after
17:14 Grinnz sounds like you want to fork and disassociate the fork, then exec
17:14 Vandal nicomen, no, I will just kill it my name later
17:15 Vandal *by
17:15 Vandal Grinnz, it is the simple way?:)
17:16 tianon ie, something like system('nohup vlc &') ?  I'm sure there's a more native Perl way to do that
17:16 Grinnz well that might actually be the simplest way
17:16 Vandal can I even fork inside mojo controller?
17:16 Grinnz sure
17:17 Vandal tianon, 'nohup' is not recognized as an internal or external command, operable program or batch file.
17:17 Vandal I'll try to fork, thank you
17:17 Grinnz ah this is windows?
17:17 Vandal yes
17:17 Grinnz ick, i dont really know how to do it there then
17:18 Vandal did you see vlc.exe on linux? O_o
17:18 Grinnz heh, didnt notice
17:19 tianon there's probably some cmd equivilant to nohup and backgrounding
17:20 tianon looks like "start" is the place to explore (probably needs some flag to tell it you don't care about the process lifecycle)
17:20 tianon maybe "start /min vlc.exe" ?
17:21 tianon or possibly even just "start vlc.exe"
17:22 sri could have been WSL
17:23 tianon if only :)
17:25 itaipu joined #mojo
17:25 * sri just discovered the macro extension for vscode, and now has a shortcut for saving the current file and running a task on it :)
17:25 kes joined #mojo
17:25 Vandal well fork inside Controller just crushes process
17:25 trwww joined #mojo
17:26 sri Vandal: that's more a windows problem than mojo
17:26 sri the official mojo stance is that you should get WSL
17:27 Vandal World Surf League?
17:27 Vandal oh I see Windows Subsystem for Linux
17:28 Vandal is it any different from SUA?
17:29 sri you can even get suse now :) https://www.microsoft.com/de-de/store/p/opensuse-leap-42/9njvjts82tjx?rtc=1
17:30 Vandal and you couldn't before?
17:36 Vandal I think there was some X11 for SUA
17:42 marty joined #mojo
17:43 sri it's something new, you better read up on it
17:44 sri is this really a perl6 best practice? https://github.com/Bailador/Bailador/blob/dev/lib/Bailador/CLI.pm#L7-L18
17:44 sri i thought they gave us indented heredocs
17:45 sri so much of that code makes me want to run screaming
17:46 dod joined #mojo
17:47 ribasushi sri: no, bash did ( I am not joking ;)
17:48 genio Bailador is Dancer P6-ified?
17:49 genio I mean, Rakudo-ified?
17:49 sri looks like a 1:1 copy of Dancer1
17:50 sri and every now and then a mojo-ism
17:51 Vandal tianon, it looks like this works, thank you
17:54 sri i'm reminded of how people were yelling at me when i brought up a mojo port, and how perl6 needs to grow its own solutions... yea, really good going there folks!
17:54 marty joined #mojo
17:54 sri back when i was still visiting #perl6
17:54 Grinnz if they're going to copy Dancer it should be Dancer2...
17:54 Grinnz do they have a PSGI framework?
17:55 genio Calling it Rakudo instead of that other name makes me hate less.
17:56 brunoramos joined #mojo
17:57 someguy joined #mojo
17:58 Vandal why some one wouldn't want mojo on p6? O_o
18:01 marty joined #mojo
18:03 marty_ joined #mojo
18:03 marty joined #mojo
18:04 jberger wait, some people didn't WANT you to port mojo to p6?!
18:04 jberger I thought there were people who were upset that you decided not to!
18:04 jberger (I guess there is no reason there can't be both)
18:10 sri there is both :)
18:29 genio man, I wish we'd never done this project using RethinkDB
18:29 genio moving away from it is going to be such a huge pain
18:30 preaction why? i've got a project that we keep threatening to move from graphite to rethink
18:31 someguy genio: sounds like a good title for a blog post to me ;)
18:31 petru joined #mojo
18:31 genio it's pretty much dead as far as maintenance goes.
18:31 genio had we been normal people and used Pg and ES, we wouldn't be where we are
18:34 brunoramos joined #mojo
18:42 Grinnz thats the danger with any of these things, the risk that the maintainers will go under / stop caring
18:42 Grinnz doesn't look like a high probability for either Pg or ES at the moment though
18:43 jberger Pg seems the most safe to me
18:43 jberger strong open source committment
18:43 jberger ES is still primarily one company
18:43 jberger a stronger company than Rethink to be sure
18:44 genio preaction: Don't get me wrong, RethinkDB is an awesome product. The usability is _really_ nice. However, with no maintenance being done, fears run strong for the next round of server updates.
18:44 ranguard ES also loves a (often breaking) upgrade and a short support cycle
18:44 preaction ranguard: that's bit me a couple times already...
18:45 preaction cpantesters is using influxdb, and it seems to be working out well so far, but i haven't thrown any actually difficult work at it yet
18:45 Grinnz for my usage at work that's great, because i can stay on top of it with our small indexes
18:45 Grinnz for metacpan, a bit more annoying :P
18:46 someguy What's the best way for a plugin to have its own config file? should I just dump it in Mojo::Home too?
18:46 Grinnz someguy: sounds reasonable to me
18:46 someguy that seems un-good if I want to run the plugin from a git clone too though
18:46 Grinnz just keep in mind if you use the Config plugin to load it, it'll merge into the app's main config hash, so you should namespace your plugin-specific config
18:47 Grinnz someguy: how come? config files should always be .gitignored
18:47 someguy git clone Mojolicious-Plugin-Things.git  ; git clone Myapp.git ;   cd Myapp && PERL5LIB=../*Things/lib ./script/myapp things
18:48 sri and we have vscode support :) https://github.com/kraih/vscode-mojo
18:48 Grinnz nice
18:49 sri thanks to marty, for preserving the tmLanguage files i threw away many years ago
18:49 sri turns out they just work
18:50 itaipu joined #mojo
18:52 someguy Grinnz: are you suggesting that I should specify an env variable to point my app at a config file from outside the repo?
18:53 Grinnz uh, no, but you could i guess
18:58 irqq joined #mojo
18:58 Lee[home] joined #mojo
18:59 rshadow joined #mojo
19:03 * someguy must be missing somehting
19:03 Lee_ joined #mojo
19:04 sri and live https://marketplace.visualstudio.com/items?itemName=kraih.mojolicious
19:07 jberger sri: is it possible to still set headers after doing $c->reply->asset($asset)?
19:07 jberger it SEEMS to work
19:07 jberger but I wonder if there's evil there
19:09 jberger I'm tinkering with this: https://gist.github.com/jberger/c24814e21d3fd16e03a1f444e42a3003
19:10 jberger I thought it would be simple if it just looked at whatever asset you had already set to be rendered
19:10 jberger but now I wonder if that's sane
19:12 sri jberger: dunno
19:13 jberger anyway, I'm not sure I want to own that code on CPAN either
19:13 jberger but I got curious about how I would do it if it were up to me
19:16 ch joined #mojo
19:19 sri wonder how microsoft had to pay for @code
19:35 simbabque joined #mojo
19:35 simbabque can I create a variable in a mojo template that will be visible in the layout?
19:35 simbabque I want to conditionally decide in the layout which js libs to load
19:36 sri % layout 'foo', bar => 'baz';
19:36 sri <%= $bar %>
19:36 simbabque ah, thanks
19:45 marcus sri: I don't get the uppercase PERL in code installed from aur (claims to be latest official bins)
19:45 marcus also yay for the mojo support, love the icon :)
19:46 sri give it a 5 star rating :p
19:47 sri to differentiate us from all the other mojo extensions you know
19:47 marcus with my microsoft account? :-D
19:48 sri i had to make a microsoft and visual studio account to release
19:48 marcus tried some of my emails, but doesn't look like I have one
19:48 marcus guess I can register.
19:50 marcus verification mail in spam. Well played, google
19:50 sri haha
19:52 sri only have 4 extensions installed so far
19:52 sri one dark pro theme, perltidy, mojolicious and macros
19:53 marcus u can haz review
19:54 sri \o/
19:54 marcus I installed perltidy-more. Not sure if actually more
19:54 marcus I also have the vim one. Pretty nice with neovim support for ex commands.
19:55 sri yea, i want to try that
19:55 sri but i had to get work done today... which went pretty well with vanilla vscode
19:58 sri if anyone wants snippets, pull requests welcome
19:59 sri for how to do it https://github.com/samosad/vscode-template-toolkit
20:10 tchaves joined #mojo
20:12 marcus I'm on vacation :)
20:12 marcus Was here today https://www.instagram.com/p/BWhzBTvHCdx/?taken-by=marcusramberg
20:15 simbabque that does not look like denmark
20:17 marcus simbabque: Pretty sure I'm in Denmark tho.
20:18 * jberger goes to Hawaii in just over a week
20:18 jberger \o/
20:18 jberger Big Island this time
20:18 marcus I'm going to St. Petersburg next.
20:18 marcus Hawaii sounds pretty smooth.
20:18 * jberger envisions MojoConf HI
20:19 jberger marcus: those cliffs are pretty sweet
20:21 sri sweet drone too
20:22 irqq_ joined #mojo
20:22 gryphon joined #mojo
20:25 dod joined #mojo
20:32 marcus sri: The mavic is p. great.
20:41 marty My pleasure, sri.  Least I can do after all the help you have given me.
21:01 itaipu joined #mojo
21:37 kiwiroy joined #mojo
21:57 sri too bad that the perl intellisense extension is not good
21:58 sri seems to generate a borked ctags file
21:59 sri *facepalm*
21:59 sri https://github.com/henriiik/vscode-perl/blob/master/src/format.ts#L23
22:07 sri hmm, author seems to be a mojo user
22:07 sri if you're here, please clean up that extension!
22:17 ptolemarch joined #mojo
22:52 Lee[home] joined #mojo
22:52 Lee_ joined #mojo
23:11 CandyAngel If I have an object that packs its data for transmission (or saving).. to_string is the wrong place to do that, right?
23:29 zerah joined #mojo

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