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

IRC log for #mojo, 2016-08-01

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

All times shown according to UTC.

Time Nick Message
00:05 good_news_everyon joined #mojo
00:05 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v6eF1
00:05 good_news_everyon mojo/master eed9a2b Sebastian Riedel: add systemd unit configuration file for the prefork command
00:05 good_news_everyon left #mojo
00:06 sri hope that's correct https://github.com/kraih/mojo/commit/eed9a2b83213ec3b2b3a8013026a6f19d55cb73c#diff-b659d9bfeffa6b78a1f2950c7e72259bR91
00:07 sri assuming the pid file doesn't matter if the pid of the manager process never changes
00:11 marty joined #mojo
00:14 Grinnz yeah that should be fine
00:20 Grinnz ack
00:20 Grinnz it seems stopping prefork workers immediately doesn't stop the manager anymore
00:22 Grinnz think it's because the worker sends a heartbeat on next_tick which will run even if the ioloop has stopped by the previous next_tick, since next_tick all runs in one sub now
00:22 Grinnz https://github.com/kraih/mojo/blob/master/lib/Mojo/Server/Prefork.pm#L144-L145
00:24 Grinnz maybe there's a better way for the plugin to prevent the manager from continuing
00:26 ningu joined #mojo
00:41 ababu joined #mojo
00:59 ningu joined #mojo
01:10 Grinnz well, i can make it die which prevents the heartbeat next_tick from running
01:10 Grinnz dunno if that's the best option...
01:12 marty joined #mojo
01:56 ababu joined #mojo
01:56 marty joined #mojo
01:56 marty joined #mojo
01:57 marty joined #mojo
01:58 ababu left #mojo
01:58 Grinnz would changing user and group on a single process daemon after binding to port 80 be functional?
01:58 marty joined #mojo
01:58 Grinnz maybe i shouldn't remove that option
01:59 marty joined #mojo
02:01 preaction once the socket is open, it should work afaik
02:03 Grinnz guess i'll just stick with warning about morbo in the docs unless someone has another idea
02:10 kaare_ joined #mojo
02:33 noganex_ joined #mojo
02:48 chandwki is there a good out of the box way to do sessions with mojolicious or do most people write their own?
02:49 preaction chandwki: http://mojolicious.org/perldoc/Mojolicious/Controller#session
02:52 ningu it encodes the session in a cookie. if you need anything that won't fit in a cookie then you will need your own way I guess
02:52 preaction which is usually just putting an id in the cookie and looking up things in whatever place
02:53 chandwki sounds good, I can write something like that
02:53 chandwki just wasn't sure if there was an out of the box "standard" way to do it with mojolicious
02:53 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#Sessions
02:54 sri it's right there in the tutorial
02:54 ningu you can fit 4k in a cookie
02:54 ningu which is decent for a normal app's session
02:54 chandwki well yes, I should have specified, I was asking about server side sessions
02:55 ningu ok, but is there a reason you need server-side sessions?
02:55 chandwki haven't thought about it, I suppose there isn't a real reason
02:55 ningu there may be, I am just asking
02:56 chandwki storing session data client side is just something I've never thought of doing
02:56 chandwki I guess if it's encrypted who cares
02:56 preaction it's not encrypted. it's signed
02:56 preaction if it needs to be hidden from the user themselves, you must not give it to them ever
02:57 chandwki ah, gotcha
02:57 ningu how would the user access it?
02:57 preaction by opening up the cookie on their machine
02:57 ningu just base64-decode?
02:57 preaction it's on their computer, how could they not?
02:57 ningu well yes
02:57 ningu but I mean access the contents
02:57 preaction yes
02:58 preaction the tutorial says
02:59 ningu ah, got it
03:26 inokenty-w joined #mojo
04:54 * sri really doesn't like the second season of mr robot
04:58 sri bet there's stuff for us to steal here https://github.com/jkbrzt/httpie
06:44 cpan_mojo Mojolicious-Plugin-SetUserGroup-0.005 by DBOOK https://metacpan.org/release/DBOOK/Mojolicious-Plugin-SetUserGroup-0.005
06:45 mbudde joined #mojo
06:45 che-quest joined #mojo
07:02 Vandal joined #mojo
07:07 AndrewIsh joined #mojo
07:11 ATog joined #mojo
07:16 trone joined #mojo
07:28 arpadszasz joined #mojo
07:45 Atog joined #mojo
08:06 salva joined #mojo
08:06 ningu joined #mojo
08:14 osfabibisi joined #mojo
08:48 Janos joined #mojo
09:52 waghso joined #mojo
09:56 waghso left #mojo
10:18 meshl joined #mojo
10:31 User6 joined #mojo
10:31 mib_it1j9v joined #mojo
10:32 mib_it1j9v Hey
10:34 Kripton joined #mojo
10:35 meshl joined #mojo
10:46 ningu joined #mojo
10:48 tchaves joined #mojo
11:14 dotan joined #mojo
11:19 mpapec how can I use custom options for IO::Socket::SSL,
11:19 mpapec https://metacpan.org/source/SRI/Mojolicious-7.0/lib/Mojo/IOLoop/Client.pm#L171
11:20 pink_mist hypnotoad -l https://foo.bar:443/?tls_ca=baz
11:20 pink_mist or something like that
11:22 mpapec SSL_verify_callback is option for IO::Socket::SSL
11:22 pink_mist oh wait, the -l flag is for the daemon; hypnotoad gets those things from its config
11:23 pink_mist don't think you can get the callback thing
11:23 mpapec it's a shame
11:24 mpapec so sub Mojo::IOLoop::Client::_try_tls {} to path it :/.
11:24 mpapec patch*
11:25 pink_mist seems like the thing to try
11:26 mpapec or
11:26 mpapec IO::Socket::SSL::set_defaults(
11:26 mpapec SSL_verify_callback => sub { say "woohoo" },
11:26 mpapec );
11:28 pink_mist right, that seems like a better way =)
11:31 LeoVince joined #mojo
11:50 sugar__ joined #mojo
12:22 che-quest are there any differences for $ua->proxy schemes socks4 and socks5?
12:23 che-quest or use scheme socks://... for both?
12:24 perlpilot joined #mojo
12:31 gizmomathboy joined #mojo
12:32 meshl joined #mojo
12:53 zivester joined #mojo
12:57 bwf joined #mojo
13:20 dvinciguerra joined #mojo
13:33 jacoby joined #mojo
13:34 asarch joined #mojo
13:41 jacoby joined #mojo
13:42 orev joined #mojo
13:55 jkramer joined #mojo
13:55 jkramer Ahoy
13:56 ribasushi sri: http2 for mojo might fall well within this: http://prototypefund.de/en/
13:57 ribasushi ( it's a bit of a stretch, but you won't know unless you try )
14:08 jkramer Is there a reason why Mojo::JSON sorts keys when encoding?
14:10 genio jkramer: Yes. makes testing consistent and easier IIRC.  There are issues in the repo about it
14:11 sri ribasushi: why is it a bit of a stretch?
14:12 genio jkramer: https://github.com/kraih/mojo/issues/941
14:15 jkramer Is it too late to downvote? :(
14:17 genio Yes.  But if you have a significant problem from it, discuss it here and maybe a better solution for you can be found
14:19 jkramer Meh, the sorting is not my real problem, my problem is that I have to use a really stupid API that expects JSON with keys in a certain order. I could achieve that with Tie::IxHash, but the sorting in Mojo::JSON messes it up.
14:22 genio Mojo::JSON isn't a class, so you can't really subclass it to fix your issue, but you can copy-paste it to remove the sort lines and use your copied version instead.
14:23 jkramer He, I'd rather just monkey-patch it because I use it indirectly through Mojo::UserAgent
14:23 jkramer But good idea
14:27 mcsnolte joined #mojo
14:29 kid51 joined #mojo
14:31 nicomen what there is no unsort? ;D
14:34 Janos joined #mojo
14:35 meshl joined #mojo
14:37 jkramer https://gist.github.com/anonymous/57f7f5dc2db337d8d4950315cbcbead1 - works just fine, thanks for the suggestion
14:39 ningu joined #mojo
14:40 Janos joined #mojo
14:42 Grinnz jkramer, expecting json keys in a certain order is a bug
14:43 cuechan joined #mojo
14:43 Grinnz that is likely to break as soon as Mojo::JSON is updated
14:43 ribasushi sri: because they seem to want "brand new PoC stuff"
14:43 jberger jkramer: not to put too fine a point on it, but at that point perhaps just use Cpanel::JSON::XS and turn off canonical?
14:43 Grinnz you will just get random hash order then
14:44 Grinnz i don't think there's any way even with JSON::PP and friends to get a specific order
14:44 ribasushi sri: " an architectural addition to an established project" *might* be brushed off as out-of-scope
14:44 ribasushi sri: hence "got to try"
14:44 jberger ribasushi: do any other dynamic high level languages have native http2? I imagine we will be prototyping a lot of things
14:44 jberger like how to notate server push items
14:44 jberger or prioritization of files
14:45 ribasushi jberger: not my area of expertise - no idea
14:45 ribasushi also - I am not arguing "meh, mojo won't qualify" I was the one pointing the link after all ;)
14:45 ribasushi I am simply cautious in managing expectations
14:46 jberger all I'm saying is, I think there is definitely areas for exploration
14:46 ribasushi well - sri is perfectly position to explore it (fits every prerequisite checkbox ;)
14:46 ribasushi *positioned
14:48 jkramer Grinnz: It's working for now (in combination with Tie::IxHash), that's good enough for me. If it breaks I'll blame it on their ridicilous API.
14:49 jkramer jberger: That'd be more hassle since I'm using $c->ua->post(..., json => ...)
14:49 marty_ joined #mojo
14:52 zivester joined #mojo
14:53 jberger jkramer: http://mojolicious.org/perldoc/Mojo/UserAgent/Transactor#add_generator
14:59 ningu I would vote for ->canonical if you need a particular order
15:00 lluad joined #mojo
15:00 jberger ningu: the Mojo::JSON OO interface was removed a long time ago
15:01 ningu jberger: I didn't mean in Mojo::JSON
15:01 jberger ah, ok, I read incorrectly
15:01 ningu does it have its own canonical?
15:01 jberger no, sorry I thought you were proposing one
15:01 jberger but you were saying to use one that has ->canonical, we're good
15:01 ningu yes, that's all I meant
15:02 Grinnz ->canonical just enforces the same order that Mojo::JSON does always
15:03 Grinnz without canonical you only get the random hash order, there's no way to specify one, except possibly by using the tied hash
15:03 ningu oh, I didn't realize Mojo::JSON did that
15:03 ningu what is the motivation for that?
15:03 ningu I mean, for making it obligatory?
15:03 pink_mist did you see the issue link earlier?
15:03 Grinnz because there's no reason not to, and several reasons to do it
15:04 pink_mist https://github.com/kraih/mojo/issues/941
15:07 ningu Grinnz: as sri said (in 2014) "%= tag 'h3' => HTt('dos', 'spe')
15:07 ningu ugh
15:07 ningu sorry
15:07 ningu "Sorting costs quite a bit of performance"
15:07 ningu hence the reason I am surprised it isn't a flag of some sort
15:08 Grinnz ningu, as discovered in that issue, the difference isn't actually that large
15:08 ningu ah ok
15:08 ningu yes, I kept reading :)
15:08 jberger the thing that DOES actually have a large difference is checking for a bunch of optional behavior, which IIRC is what happened to the OO interface
15:09 jberger difference in performance
15:09 Grinnz having to check flags in an object for every iteration in a recursive algorithm can get expensive
15:10 sri i stand by what i said in 2014... %= tag 'h3' => HTt('dos', 'spe')
15:10 ningu I wonder though, about sorting when you have a few keys vs. many
15:10 Grinnz plus the penalties of the actual behavior those flags activate
15:10 ningu sri: :)
15:10 Grinnz sri, lol
15:11 ningu there have been cases where I've had json objects with 10,000 keys
15:11 ningu although, those are being decoded, not encoded, in that case
15:12 jberger sort is implemented in the perl core and has been optimized as well as one can hope
15:12 sri we have Mojo::JSON::MaybeXS for those cases
15:32 Bean joined #mojo
15:39 sugar__ joined #mojo
15:42 jabberwok https://github.com/jhthorsen/toadfarm/pull/21    ...there is nothing like reloading a fresh box and writing hand-hold-the-client instructions to find little gotchas, is there? i think i have this right.
16:05 PryMar56 joined #mojo
16:21 jberger I have a coworker who was quite puzzled by trying to call $pg_results->hashes more than once (as if it were an accessor or at least a cached-results method)
16:21 jberger and having it not work
16:22 jberger is there any appetite for having hashes/arrays cache the results of consuming the sth?
16:23 Grinnz_ jberger: same reason ->fetchall_arrayref more than once won't work
16:23 jberger right, I get why
16:24 jberger but is there any reason not to make the method do something like:
16:24 jberger sub arrays { $self->{arrays} ||= ... }
16:32 perlpilot joined #mojo
16:43 Kundun joined #mojo
16:45 AirDisa joined #mojo
16:47 jabberwok hmm, with Toadfarm being loaded from /etc/init.d/my-script... when it gets to >> mount "/home/me/script/mojo-app" => \%config; << ... how do I get it to find modules in @INC? presumably there must be some setting for 'current directory' to be /home/me (which script/mojo-app is under) ?
16:56 dvinciguerra joined #mojo
17:02 itaipu joined #mojo
17:21 jabberwok I'm not sure whether Plugin::Config will find the .conf files, and whether static files under the app's public/ directory will be found either... does mount do all that magic? Or do I need to change my script/mojo-app or lib/MojoApp.pm somehow?
17:23 Grinnz_ jabberwok: script/mojo-app should modify @INC appropriately to include that app's libraries, possibly using FindBin or dirname(__FILE__)
17:24 Grinnz_ the config file is found relative to the app's homedir, which is located from the module location
17:25 Grinnz_ generally, current working directory should be irrelevant
17:25 Grinnz_ depending on it is a problem
17:33 jberger use $app->home in conjunction with configuration, it works really nicely
17:36 jabberwok very good, i'm on it
17:38 jberger jabberwok: for example: https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L32-L116
18:27 gizmomathboy joined #mojo
18:46 good_news_everyon joined #mojo
18:46 good_news_everyon [mojo] kraih tagged v7.01 at b2315a0: https://git.io/v6fXS
18:46 good_news_everyon left #mojo
18:47 good_news_everyon joined #mojo
18:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v6f1f
18:47 good_news_everyon mojo/master 0c2ac7e Sebastian Riedel: bump version
18:47 good_news_everyon left #mojo
19:06 itaipu joined #mojo
20:24 jabberwok Thanks Grinnz_ jberger , it all works!
20:29 jberger wooo
21:21 berov joined #mojo
21:23 cpan_mojo Mojolicious-Plugin-DSC-1.006 by BEROV https://metacpan.org/release/BEROV/Mojolicious-Plugin-DSC-1.006
21:41 sugar__ joined #mojo
21:53 sugar__ joined #mojo
22:06 dotan joined #mojo
22:14 Janos joined #mojo
22:58 sugar__ joined #mojo
23:11 cuechan joined #mojo
23:21 cfedde joined #mojo
23:38 cfedde joined #mojo
23:55 cfedde joined #mojo

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