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

IRC log for #mojo, 2015-10-19

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

All times shown according to UTC.

Time Nick Message
00:21 damaya joined #mojo
00:46 aborazmeh joined #mojo
01:56 kaare joined #mojo
02:01 Zoffix joined #mojo
02:04 espent joined #mojo
02:13 noganex joined #mojo
02:37 damaya joined #mojo
02:55 sri hahahahaha https://pbs.twimg.com/media/CRjXuluUkAAKhza.jpg
03:00 damaya joined #mojo
03:02 nnutter lol
03:02 * jberger wants
03:16 davido_ joined #mojo
03:34 damaya joined #mojo
03:42 davido_ joined #mojo
03:55 kivilahtio joined #mojo
04:02 zivester joined #mojo
04:26 noganex joined #mojo
04:26 irqq joined #mojo
04:26 jamesw joined #mojo
04:26 theo joined #mojo
04:26 Grinnz_ joined #mojo
04:26 Lucas1 joined #mojo
04:26 tianon joined #mojo
04:26 elik joined #mojo
04:26 vytas joined #mojo
04:26 sivoais joined #mojo
04:26 cosimo joined #mojo
04:26 da5id joined #mojo
04:26 tyldum joined #mojo
04:26 sri joined #mojo
04:26 cfedde joined #mojo
04:26 buu joined #mojo
04:26 batman joined #mojo
04:26 kmx joined #mojo
04:26 zz_Foxcool joined #mojo
04:26 Ralesk joined #mojo
04:26 coolo joined #mojo
04:26 ssm joined #mojo
04:26 hahainternet joined #mojo
04:26 kwa joined #mojo
04:26 robinsmidsrod joined #mojo
04:30 cosimo joined #mojo
04:39 damaya joined #mojo
04:51 inokenty-w joined #mojo
05:47 damaya joined #mojo
06:11 McA joined #mojo
06:24 marcusr joined #mojo
06:25 trone joined #mojo
06:27 panshin joined #mojo
06:53 damaya joined #mojo
07:02 dod joined #mojo
07:04 damaya joined #mojo
07:07 dod joined #mojo
07:08 eseyman joined #mojo
07:19 salva joined #mojo
07:21 damaya joined #mojo
07:22 trone joined #mojo
07:30 damaya joined #mojo
07:35 odc joined #mojo
07:41 mtths joined #mojo
08:07 meshl joined #mojo
08:11 vanHoesel joined #mojo
08:12 Vandal joined #mojo
08:15 vanHoesel1 joined #mojo
08:19 Shaeto joined #mojo
08:39 meshl joined #mojo
08:47 lsm joined #mojo
08:49 damaya joined #mojo
08:50 irqq joined #mojo
08:52 vanHoesel joined #mojo
09:04 vanHoesel joined #mojo
09:28 damaya joined #mojo
09:33 gaunt joined #mojo
09:47 Shaeto left #mojo
11:07 neilhwatson joined #mojo
11:13 damaya did something change in render recently?
11:14 damaya this used to work $c->render(foo => $bar, bib => $baz); now it's complaning can't find foo.html.ep
11:15 Zoffix :/
11:16 Zoffix No, you're likely doing something wrong. Show us real code.
11:21 Snelius like a devZombi. We need moooore of code
11:38 jontaylor joined #mojo
11:43 berov joined #mojo
11:47 dabudabu joined #mojo
11:50 hernan605 joined #mojo
12:12 mattastrophe joined #mojo
12:12 mattastrophe joined #mojo
12:15 jberger joined #mojo
12:33 Dandre joined #mojo
13:07 gryphon joined #mojo
13:18 zivester joined #mojo
13:19 mattp joined #mojo
13:26 ZoffixW joined #mojo
13:27 ZoffixW Does anyone have an init.d script for starting hypnotoad at boot that I could steal? I'm having trouble with Find::Bin not finding the current script :/
13:28 ZoffixW I guess that's what Toadfarm was designed for...
13:32 aborazmeh joined #mojo
13:32 nic joined #mojo
13:36 * ZoffixW doesn't see how to set different ENV vars for each Toadfarmed app.
13:36 ZoffixW Is that possible?
13:38 marty joined #mojo
13:55 ZoffixW This is ridiculous :| Can't find a simple way to run my app with custom env vars under a non-root user ~_~ Linux--
13:55 nic ?
13:56 nic Is your problem specific to Toadfarm?
13:56 ZoffixW nic, I've not tried Toadfarm because I don't see any way to set different env vars for each app. Is that possible?
13:57 nic I haven't use Toadfarm, but I'm guessing you still have a 'startup' per app
13:57 nic and any 'startup' can set $ENV{MY_VAR_ABUSE} = 1
13:57 bwf joined #mojo
13:58 nic For non-Toadfarm, I'm not seeing what the difficulty is
13:58 ZoffixW No, I don't. ENV vars control a set of config options that decide what app to load
13:59 ZoffixW For non-Toadfarm, I'm having trouble running as a non-root user. The only answer I see is su - someuser -c hypnotoad bin/XTaTIK, but all the perl env vars are not loaded that way, so I'm getting "can't find hypnotoad"
13:59 * nic switches on the batman alert and sweeps it across the sky
13:59 batman ?
13:59 nic ZoffixW: Do you need to use port 80/443?
13:59 ZoffixW nic, no
14:00 nic ah, the pid/lock files
14:00 batman https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/BehindReverseProxy.pod
14:00 nic You need to grant the app user perms to write into those dirs
14:00 batman https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/RunningToadfarm.pod#Listen-to-standard-HTTP-ports
14:01 ZoffixW batman, can I set individual env vars for each app?
14:01 batman ZoffixW: you don't have to bundle your apps. just use it as an init.d starter
14:02 batman no. %ENV is shared between apps, but you can start just as many toadfarm processes as you planned to start hypnotoad
14:02 ZoffixW Alright.
14:02 batman using %ENV is your apps is pretty ...... uhm... not the best strategy :)
14:02 * ZoffixW just screwed up and somehow $production website now has a weird red theme
14:02 * ZoffixW panics
14:03 ZoffixW batman, technically I have just one app  :P
14:03 ZoffixW (XTaTIK)
14:03 * sri picnics
14:03 * nic pancakes
14:04 batman ZoffixW: you know you can't "leak" %ENV from init.d/foo to a _running_ hypnotoad process
14:04 batman changing %ENV inside the toadfarm init script on the other hand works like a charm
14:04 ZoffixW Aha. Alright. Let me give that a whirl.
14:09 * jberger pontificates
14:09 batman the thing is that a running hypnotoad only receives a signal to reload it's own process, meaning any %ENV set when it started can only be changed by code or config files.
14:09 batman ZoffixW: ^ so... since the toadfarm script is the actual code running, it allows changing it self
14:10 batman it also writes a config file that it _could_ read, but that's unrelated to %ENV
14:15 nic For my own init.d scripts, 'restart' picks up new env vars (since it's doing a full 'start')
14:17 batman nic: so you could just run the prefork server, since you don't care about hot reload...?
14:17 nic no
14:17 batman ok
14:18 nic I didn't say that; I use 'reload' a lot
14:18 nic (usual init.d behaviour)
14:19 nic start|stop|status|reload|restart
14:19 ZoffixW Hm. If I manually do sudo /etc/init.d/health-to-home start, then it works, but I've just rebooted my linode and the server wasn't running :/
14:19 batman i like having the "reload" action - just like init.d/nginx.
14:20 ZoffixW This is my /etc/init.d/health-to-home: http://fpaste.scsys.co.uk/500423
14:20 stephan48 ZoffixW: did you tell the os to create rc.d or systemd or whatever links for it?
14:20 nic batman: It would be bonkers to not have it
14:20 ZoffixW stephan48, nope. (reading up on that now)
14:21 batman ZoffixW: it's documented here: https://metacpan.org/pod/distribution/Toadfarm/lib/Toadfarm/Manual/RunningToadfarm.pod#Init-script
14:21 Grinnz usually you use chkconfig for that.
14:21 nic What Grinnz said
14:21 stephan48 update-rc.d chkconfig systemdsomething.. just choose the hell your os provides :)
14:22 asarch joined #mojo
14:22 Grinnz if you're using systemd, then systemctl enable yourservice
14:22 Grinnz but your init script would be wildly different in that case ;)
14:22 mgrimes joined #mojo
14:23 stephan48 true
14:23 batman Grinnz: isn't it common that systemd is init.d compat?
14:23 nic alternatively, if you're using systemd, use dd to overwrite your fs while you still can
14:23 batman i mean, that it loads some init.d module thing that does whatever it used to do? :)
14:23 Grinnz somewhat, but only out of necessity
14:24 stephan48 what i saw is that it somehow hooks into the basic init functions to intercept them
14:24 Grinnz if you want to use a systemd system properly, you should be writing systemd unit files, i hear they aren't that difficult anyway
14:24 stephan48 and then you got a service info script or something like that
14:24 stephan48 ah thanks unit files..
14:24 ZoffixW Yey! Works :) stephan48++ nic++ batman++ Grinnz++ Thanks all.
14:25 batman ZoffixW: glad to hear it! :)
14:25 stephan48 sounds good
14:25 stephan48 congratz
14:25 batman let me know if you want more toadfarm commands.
14:25 Grinnz toadfarm makemebreakfast
14:25 ZoffixW ^ :)
14:29 batman Grinnz: I'll take that PR! :)
14:56 lluad joined #mojo
14:58 ajr_ joined #mojo
14:58 jberger Grinnz: sudo toadfarm makemebreakfast
15:14 stephen joined #mojo
15:20 sugar joined #mojo
15:33 Ptolemarch joined #mojo
15:36 PryMar56 joined #mojo
16:00 Trelane afternoon
16:01 thowe joined #mojo
16:02 nic not necessarily
16:02 sh4 joined #mojo
16:02 jberger Trelane: o/
16:05 Trelane So, I have this Template::Caribou template system I want rid of
16:06 Trelane And I was thinking of replacing it with Mojo's native templates
16:06 Trelane The question is, how to replace the inheritence.
16:09 jberger what do you mean by inheritance?
16:09 jberger inclusions?
16:09 jberger or otherwise overriding templates?
16:09 jberger also, is this in a mojo app (ep?) or just using Mojo::Template directly for another system?
16:11 Trelane Just using M::T in another system.  We have many parts of our system that use different templating languages.  I want less
16:11 Trelane So Caribou is basically template-as-perl code
16:11 sri M::T itself has very few features
16:12 Trelane What I really want is the opposite of M::T.  Where I can escape from perl code into mojo and back
16:13 Trelane into mojo::template and back even
16:13 sri inheritance, include and friends are implemented in the framework
16:14 Trelane ah, extends
16:14 Trelane I shall have to go play with this
16:15 mattastrophe joined #mojo
16:17 sri ye, it's a combination of the renderer and helpers
16:18 sri not even helpers are part of M::T
16:19 sri every now and then i want to add helpers and stash handling to M::T directly, but so far i've not found a clean way
16:27 sugar joined #mojo
16:29 meshl joined #mojo
16:37 mattastrophe joined #mojo
16:38 dod joined #mojo
16:53 fvox joined #mojo
17:30 damaya joined #mojo
17:32 sri in case anyone cares, the bug problem is passing $c as first argument to all helpers
17:32 sri s/u/i/
17:32 sri hehe
17:37 trone joined #mojo
17:55 Ptolemarch joined #mojo
18:05 Ptolemarch joined #mojo
18:05 tencendur joined #mojo
18:06 damaya joined #mojo
18:19 jb360 joined #mojo
18:52 mattastrophe joined #mojo
18:56 moritz joined #mojo
18:56 moritz hi all
18:56 moritz what's the recommended way to have templates in more than one (human) language?
18:57 batman moritz: i just translate sentences inside the same template
18:57 moritz I'd like to set lang => 'en' somewhere, and then automatically pick template foo.en.html.ep or so
18:58 batman a template to me is about structure, not content
18:58 moritz batman: this is for a legacy project in which the templates are already present in both languages
18:58 moritz batman: so while I'd generally agree with you, this doesn't seem practical right now
19:00 sri do you know that all templates are available in all languages?
19:00 batman moritz: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Template-variants
19:00 sri or do you have to test?
19:00 batman maybe that could be an idea.... ^^
19:00 moritz sri: I know they are all available
19:01 jberger is this a case for i18n? (not that I know anything about that)
19:01 sri a before_render hook that modifies the template value could work then
19:02 sri variants are meant for something else, but i guess you could hijack the system
19:02 moritz sri, batman: ok, thanks
19:03 sri the recommended way is of course https://metacpan.org/pod/Mojolicious::Plugin::I18N
19:08 sri too bad it doesn't have better documentation really
19:09 sri not even the section from the rendering guide it used to have made it into the plugin :/ https://github.com/kraih/mojo/commit/b95f4455c90e36afdced4bc87acc1fc93003a8a9#diff-65cf575515a0ad467194433b39cd30d3L747
19:11 sri guess we've not been very lucky with modules extracted from mojolicious core in general
19:12 sri hard to find people that actually care
19:14 sugar joined #mojo
19:17 CandyAngel Has anyone gotten perlcritic to be happy with Function::Parameters?
19:17 sri i sometimes wonder if i18n should have been kept in core
19:17 * sri grabs his pitchfork at the mention of perlcritic
19:18 CandyAngel sri: You're welcome to critique my code instead :P
19:18 Grinnz CandyAngel, perlcritic uses PPI so it's dependent on how PPI ends up parsing things
19:19 CandyAngel sricritic++
19:19 CandyAngel perltidy doesn't like it either :P
19:20 Grinnz perltidy uses its own parsing mechanism, which is even less likely to understand signatures :P
19:20 sricritic http://www.quickmeme.com/img/b3/b30cf715bf2bee50d0c64e52198fcebf649e41b37864e64887410aa4790e6e46.jpg
19:21 irqq joined #mojo
19:29 sri hmm, i would even implement the i18n plugin differently these days
19:29 sri more efficient
19:37 Ptolemarch joined #mojo
19:46 jberger ocdcritic works for me
19:47 jberger for a dfwpm code challenge, I won the critic portion of the challenge, and I didn't even check it with perlcritic :-P
19:48 jberger (also, maybe I should have you review my extracted module: https://metacpan.org/pod/Mojolicious::Plugin::Memorize)
19:55 ans joined #mojo
20:05 Ptolemarch joined #mojo
20:15 good_news_everyon joined #mojo
20:15 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWfRX
20:15 good_news_everyon mojo/master 85eb4d2 Sebastian Riedel: mention variant values too
20:15 good_news_everyon left #mojo
20:19 Ptolemarch joined #mojo
20:45 damaya joined #mojo
21:00 trone what happen if Mojo::Message::upload fail? it return undef? other?
21:04 sugar joined #mojo
21:31 ajr_ joined #mojo
21:34 damaya joined #mojo
21:37 Ptolemarch joined #mojo
21:37 rwp joined #mojo
22:08 Grinnz_ trone: fail how?
22:09 Grinnz_ the file contents will probably just be truncated but not sure
22:10 Grinnz_ see https://metacpan.org/pod/Mojo::Message#max_message_size about the total message size limit
22:10 Craftsmanship joined #mojo
22:12 Craftsmanship is around_action the safe way to have a callback trigger after rendering is done? (and when the timeout happens, if it does?)
22:14 sri around_action has nothing to do with rendering
22:15 Grinnz_ after_render, but note that won't affect static content
22:15 Grinnz_ (which you could use after_static for)
22:18 trone Grinnz_: I make some check against size, empty names, or max_message_size exceeded.
22:18 trone Grinnz_: my point was a sort of: the upload method can fail? if it fails, what it return?
22:19 Grinnz_ https://metacpan.org/pod/Mojo::Message#upload will always return either a Mojo::Upload or undef
22:20 Grinnz_ undef would mean that the request did not have an upload with that name
22:20 good_news_everyon joined #mojo
22:20 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vWJJ2
22:20 good_news_everyon mojo/master 429563e Sebastian Riedel: mention bytes
22:20 good_news_everyon left #mojo
22:31 trone about design :-) I want upload a file.csv, make checks, and if all it's ok to parse it and import in a db.
22:32 trone of course I can do all in the upload action, but I think could be nice to make it asyncronously - saying to the user "ok, your file was take. wait a bit while I work on it"
22:33 Grinnz_ you'll need some JS for that then
22:33 trone have you any hints about this? some flaw?
22:33 Grinnz_ i suspect doing something like "upload progress" is also possible in JS, but i've never tried (most uploads are too fast :)
22:33 trone Grinnz_: yep, do you mean to warn the user about the progress?
22:34 Grinnz_ right
22:35 trone Grinnz_: indeed I think a sequential elaboration would be enough, but I would give a try to async elaboration. But I don't know how manage the actions server side.
22:35 trone at the moment I have the action to render and the upload (in POST) to get data.
22:36 trone I could write a "parse" action and use the stash (?) to have the handler?
22:36 trone write message through the websockets? dunno. :-/
22:37 Grinnz_ if you set up a websocket that would work yeah
22:37 Grinnz_ but i'm not sure about file upload through that
22:37 Grinnz_ hehe
22:37 trone lol
22:38 damaya joined #mojo
22:42 sri if you negotiate compression, uploading a big csv file through a websocket could be quite a bit faster
22:43 Grinnz_ true... a bit more complex though
22:50 d4rkie joined #mojo
23:10 meshl joined #mojo
23:42 thowe So, when I "$c->render(json => encode_json($phones));"  I seem to get a quoted string escaping all the json instead of raw JSON...
23:45 pink_mist you shouldn't encode it
23:45 pink_mist that renderer should do that on its own
23:45 thowe oh....
23:46 thowe yeah.  That did er
23:46 pink_mist https://metacpan.org/source/SRI/Mojolicious-6.24/lib/Mojolicious/Renderer.pm#L20 <-- as you can see here
23:46 thowe Thanks!

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