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

IRC log for #mojo, 2016-11-14

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

All times shown according to UTC.

Time Nick Message
00:02 henq joined #mojo
01:04 preaction joined #mojo
01:07 tojo joined #mojo
01:43 asarch joined #mojo
02:05 mgrimes joined #mojo
02:27 jberger suede Mojo::Pg does connection pooling though
02:28 jberger So you can do parallel async queries even with transactions
02:28 jberger But be careful about locking
03:21 khfeng joined #mojo
03:42 noganex_ joined #mojo
04:05 aborazmeh joined #mojo
04:21 Paddi joined #mojo
04:31 lluad joined #mojo
05:10 parv joined #mojo
05:10 parv joined #mojo
05:31 inokenty-w joined #mojo
06:08 Paddi joined #mojo
06:19 dod joined #mojo
06:22 dod joined #mojo
06:36 alexbyk joined #mojo
07:15 Vandal15263 joined #mojo
07:23 dod joined #mojo
07:27 mbudde joined #mojo
07:36 dod joined #mojo
07:40 dod joined #mojo
07:49 jamesaxl joined #mojo
07:57 Paddi Hi all Mojolicious developer
08:01 AndrewIsh joined #mojo
08:14 dod joined #mojo
08:19 rshadow joined #mojo
08:41 trone joined #mojo
08:45 ledet joined #mojo
08:47 osfabibisi joined #mojo
08:51 ledet Hello. Best practice for RESTful API with parameters with slashes? Say that I have something like '/api/server/:server/path/:path/info'. And the :path parameter can be something like /some/weird/path/to/stuff. How do I go about that? I thought of URL encoding it, but it appears that it is decoded before it is handled by routing (using Mojolicious::Lite). Any great ideas?
08:51 rshadow joined #mojo
08:58 Lee ledet: POST json
08:58 Lee and rename your route
09:00 ledet Lee: Yes, that would be the easy way, but in "RESTful" doing a post would mean to create a new entry, not query information. I was hoping someone had an idea to keep this is a GET request...
09:01 Lee so send query params instead if you want to adhere to the principles
09:02 Lee /api/server?path=/foo/bar/baz&... etc
09:03 ledet I'm considering to just base64 encoding it...
09:03 Lee that's horrible
09:03 Lee ledet: https://www.youtube.com/watch?v=9w4dNi2wu_E&feature=youtu.be&t=16981
09:04 osfabibisi so the call that you're describing would look like /api/server/server1/foo/bar/baz ?
09:04 Lee don't fight the framework to adhere to a set of arbitrary RESTul principles that nobody really agrees on anyway
09:04 osfabibisi in which case you could make the info call:  /api/server/server1/foo/bar/baz/info
09:30 Paddi joined #mojo
09:34 dod joined #mojo
09:41 dod joined #mojo
09:47 ashimema joined #mojo
09:47 Snelius joined #mojo
10:04 dod joined #mojo
10:07 ledet osfabibisi: yes
10:07 ledet Lee: I'm starting to give up on the RESTful principles already, so no worries :)
10:10 Lee :)
10:21 ledet lee: End solution will likely be /api/server/:server/path/info?path=/some/path - not exactly pretty, but works (and GET is simpler than POST). Thanks
10:21 mbudde joined #mojo
10:34 Lee np
10:46 gbhat joined #mojo
10:57 tchaves joined #mojo
11:00 Paddi joined #mojo
11:03 dod joined #mojo
11:13 henq joined #mojo
11:15 henq joined #mojo
11:38 gregf_ joined #mojo
11:59 henq joined #mojo
12:13 sri hmm, i guess this might be the best atom package for remote editing https://atom.io/packages/remote-sync
12:35 jkramer left #mojo
12:39 rshadow joined #mojo
12:44 tchaves joined #mojo
13:24 gizmomathboy joined #mojo
13:26 dod joined #mojo
13:32 Janos joined #mojo
13:36 dod joined #mojo
13:43 asarch joined #mojo
13:56 CW joined #mojo
14:04 dod joined #mojo
14:13 ramortegui joined #mojo
14:14 dod joined #mojo
14:15 jacoby joined #mojo
14:19 Pyritic joined #mojo
14:19 marty joined #mojo
14:22 jacoby joined #mojo
14:31 marty joined #mojo
14:38 chorny joined #mojo
14:44 vytas joined #mojo
14:46 jberger A warning for cpan authors (and users too I suppose) http://blogs.perl.org/users/todd_rinaldo/2016/11/how-removing-from-inc-is-about-to-break-cpan.html
14:46 jberger batman: i know you use the technique mentioned in here quite a bit
14:47 jberger use t::Helper;
14:49 khfeng joined #mojo
14:51 khfeng_ joined #mojo
14:52 batman jberger: yup
14:53 batman thanks
14:54 * coolo is afraid - very afraid
14:55 jacoby joined #mojo
14:55 coolo if I inject the variable into building, I'll never know what will break at runtime ;(
15:05 sri it's going to be a painful transition
15:07 dmanto joined #mojo
15:08 genio That won't be a problem for Mojo, will it? You're using    use lib "$FindBin::Bin/external/lib";    etc.
15:08 genio in your tests
15:11 coolo genio: you mean if Mojo was without any external dependencies ?
15:12 jberger I don't think core mojo does it
15:12 sri for the perl community i mean
15:12 jberger but I know that lots of cpan modules do
15:12 sri not for us, we try to avoid bad practices :)
15:12 genio I'm saying I don't think Mojo itself is going to have any pains with fixing the problem of no . in @INC
15:13 genio Other authors aren't quite as quick to fix/adopt best practices.
15:15 sri OMG
15:15 sri https://webcache.googleusercontent.com/search?q=cache:Vk2On-9psscJ:https://msdn.microsoft.com/en-us/magazine/mt790182.aspx
15:15 sri visual studio for mac
15:15 sri just leaked it seems
15:16 sri this is definitely a new microsoft
15:16 genio Nice
15:16 jberger right as mac decides it doesn't care
15:16 sri jberger: :,(
15:17 sri thanks for reminding me
15:19 jberger glad to help
15:28 jacoby joined #mojo
15:30 jacoby_ joined #mojo
15:39 jontaylor joined #mojo
15:45 jontaylor Hey guys, I can only find version 6 of Minion on cpan, I just wanted to check if thats intentional
15:46 jontaylor It caught me out, since we are using Minion::Backend::mysql, and its not compatible with version 6 yet
15:47 jberger jontaylor: you can use cpanm to install past version or better yet carton+cpanfile to pin versions
15:47 jberger with cpanm you do "cpanm Minion@5.01" or whatever
15:48 jontaylor ahh, you are right
15:48 jontaylor I was off by one trying to find 5.10
15:48 jontaylor my bad :)
15:56 janl joined #mojo
16:00 sri how odd, i've installed a wifi repeater over the weekend and it seems to cause fragile ssh connections if one computer is connected to the base station and the other to the repeater
16:00 jabberwok I have code in my app->startup() to verify configuration, but I don't want that bit to run when you use my "script/myapp change_configure_the_magic" M::Command. Is there a way to do that with Hooks or something?
16:11 lluad joined #mojo
16:13 stryx` joined #mojo
16:15 howitdo joined #mojo
16:17 jberger jabberwok typically we have guarded that with an environment variable
16:19 jberger that said a generic inspectable "starting as web server" might be handy but I can't come up with how it would work
16:19 jberger order of operations is wrong
16:20 jberger for example: https://github.com/Nordaaker/convos/blob/master/lib/Convos.pm#L91
16:21 jabberwok Ah. right. Yes,, you'd want to run the check code for "test" and "daemon" but not for the set-the-check-config command. With other commands too that would be a horrible mess. Hmm.
16:22 jabberwok $::magicks *= 2.3721330000001;
16:23 jberger jabberwok don't forget hypnotoad and morbo, which don't pass arguments at all
16:28 jabberwok Perhaps push an 'always' event on the event queue?  Or does the event queue get run through once even when a Command terminates the main program.
16:29 jberger not all commands start the ioloop
16:29 jberger but I wouldn't count on that
16:30 buu jberger: So in 7.10 with a proxy that returns 503 it memory leaks
16:31 jberger for the record I'm still not sure why I'm getting the highlight on these :-P
16:31 sri better you than me :)
16:31 buu You asked!
16:32 jberger buu: did you test against an older mojo?
16:33 jberger I guess it probably is enough to open a bug anyway, but it would be interesting to know if it is a regression
16:34 buu jberger: Well, I verified neither version leaked with a proxy that actually worked
16:36 khfeng_ joined #mojo
16:39 rshadow joined #mojo
16:53 Pyritic joined #mojo
16:53 Grinnz 09:55:26 <coolo> if I inject the variable into building, I'll never know what will break at runtime ;(
16:53 Grinnz you also never know what could break at runtime if you rely on the current working directory ;)
17:29 chandwki joined #mojo
17:29 chandwki anyone have any luck with extending mojolicious with Moo / Moose?
17:30 chandwki everything seemed to be going well until I did "extends 'Mojolicious::Plugin'" with Moo
17:30 chandwki In my plugin I'm making a helper, $app->helper( banks => sub { state $banks = {} } );
17:31 chandwki and I get this error, "Global symbol "$banks" requires explicit package name"
17:31 pink_mist did you forget to "use feature 'state';"?
17:31 chandwki works fine when I get rid of Moo and just do "use Mojo::Base" instead
17:31 pink_mist Mojo::Base imports feature 'state' for you
17:31 chandwki ohhhhhhhh
17:31 pink_mist Moo doesn't
17:32 chandwki it works!
17:32 pink_mist you should probably read more about what Mojo::Base does
17:32 chandwki I should!
17:32 pink_mist and do the same
17:32 chandwki thank you!
17:32 pink_mist (except the things Moo does)
17:34 chandwki oh what it's actually doing is "use feature ':5.10';"
17:34 chandwki I thought "state" was a mojolicious feature not a new perl feature
17:37 chandwki alright, looks like I can just include "use Mojo::Base -base;"
17:37 chandwki even better
17:38 pink_mist sure you mean -strict
17:39 pink_mist -base will change @ISA as well as adding a has() ... which should be provided by Moo
17:39 pink_mist s/sure/surely/
17:42 chandwki mmm, -strict is better for what I need
17:44 sri finally indented herdocs \o/
17:44 sri https://perl5.git.perl.org/perl.git/commit/cdd6375d6dbc0eea3676faa4e615af1ae28bb103
17:44 buu oh
17:44 buu my
17:44 buu god
17:45 khfeng_ joined #mojo
17:46 pink_mist \o/
17:47 pink_mist time to "use 5.25.8;" everywhere :P
17:49 pink_mist oh, or maybe it only needs 5.25.7
17:53 khfeng joined #mojo
17:59 buu Well, you could already indent heredocs, it was just sillier
17:59 jontaylor I’ve got a problem with minion, where when I start it, it will process exactly 1 job, and then freeze, it never registers itself in the minion_workers table either. If I strace it, then I can see its just stopped at recvfrom(5,
17:59 buu oh I see
18:09 Grinnz d'oh, i meant to cut a Mojo::SQLite release with the deprecation of pubsub this weekend
18:12 arcanez I see buu but no buubot?
18:21 vicash jontaylor: try processing something that doesn't take up time like an "ls" or something. or implement an example and see if something is missing. Minion works fine for me on Debian. So it must be some other system issue that's causing a problem.
18:22 jontaylor vicash: good idea, i’ll give that a go now
18:23 rshadow joined #mojo
18:27 jberger sri: seems like I've also seen chatter about safe dereference
18:27 jberger what a time to be alive \o/
18:33 Pyritic joined #mojo
18:34 Grinnz and in a couple releases Fedora might be able to play MP3s out of the box. what a time to be alive indeed
18:40 batman does anyone know if `use lib ".";` is cross platform? (will it work in windows)
18:40 jberger batman it should, I'm pretty sure the . is a literal . in the perl source
18:40 batman ok...
18:48 dod joined #mojo
19:00 suede DBI doesn't let me pass in a list to fulfill a placeholder, so I did this: https://dpaste.de/ffJy
19:04 suede is that fine?
19:06 stryx` joined #mojo
19:09 Pyritic joined #mojo
19:09 preaction it's pretty common, but i think Postgres and DBD::Pg specifically allow a way to pass in an arrayref and make the query treat it as a postgres array
19:14 gizmomathboy joined #mojo
19:16 jabberwok preaction: yes.  although there's not quite enough magic to make DBD::Pg automatically store+retrieve arrays as JSON in json(b) fields versus arrays in array fields. That would be a rather nifty extension, perhaps
19:17 preaction jberger knows how to do this, i think... i swore he showed me once. How do you insert an arbitrary list of values without manually creating a bunch of '?' SQL placeholders with join()
19:18 jabberwok SQL::Abstract(::More)  is one way
19:19 preaction that still, somewhere deep inside, manually creates a bunch of '?' SQL placeholders with join()
19:20 jabberwok =nods gravely=
19:27 rshadow joined #mojo
19:34 rshadow1 joined #mojo
19:35 Grinnz if you're using Mojo::Pg, it already has the ability to encode JSON parameters for you
19:36 jberger $pg->db->query("UPDATE table SET something = ? WHERE id=ANY(?)", $variable, \@ids)
19:37 gizmomathboy joined #mojo
19:39 jberger https://www.postgresql.org/docs/9.6/static/functions-comparisons.html
19:39 jberger https://www.postgresql.org/docs/9.6/static/arrays.html
19:39 jberger https://www.postgresql.org/docs/9.6/static/functions-array.html
19:39 jberger suede ^^
19:39 rshadow joined #mojo
19:39 suede jberger: Oh, awesome
19:39 suede Thanks
19:40 jberger jabberwok I'm not sure what you are asking but there are ways to manipulate JSON<->Array
19:43 batman just ran this on all my projects: https://gist.github.com/jhthorsen/baa15ce5afc6c332be7e9438a3bfa8bd
19:43 batman didn't bother to make a new release, but at least i think i'm ready :)
19:43 dod joined #mojo
19:48 pink_mist jberger++ # just had occasion to link to http://blogs.perl.org/users/joel_berger/2015/12/response-to-the-perl-jam-2.html as a response to someone posting a link to the video
19:50 jberger man, I was so ad
19:50 jberger mad even
20:04 arcanez he doesn't seem to understand perl at all
20:07 preaction jberger: thanks, that's what i was looking for
20:07 preaction (the postgres stuff)
20:25 CandyAngel jberger: sri: If I wanted to build a framework (different domain, not web) but could reuse quite a few parts of Mojolicious, but might need to extend them.. any advice how to go about that? In terms of if it would be classed as "forking" Mojolicious or not?
20:30 jberger CandyAngel: well, the Mojo layer is designed specifically for that
20:30 jberger what are you looking to change?
20:34 jberger well, the Mojo layer is designed for reuse
20:34 CandyAngel I'm not sure yet, just thinking ahead. I have no problem with including Mojolicious as a dependency, but concerned that I might want to add something that isn't wanted in Mojolicious
20:35 jberger so, the toolset is definitely open for reuse
20:35 CandyAngel Like adding Collection::Categorized functionality to Mojo::Collection
20:35 jberger I don't know what that is, but it sounds like a subclass
20:37 CandyAngel So I could do something like: my $categorised = $collection->group_by(positive => sub { $_ > 0 }, zero => sub { $_ == 0 }, negative => sub { $_ < 0 });
20:59 Grinnz re: mailing list, https://metacpan.org/source/SRI/Minion-6.0/lib/Minion/Job.pm#L62 unconditionally dereferences $self->args, but the args attribute has no default, leading to the error message they saw because they don't seem to be setting any args
21:13 jberger CandyAngel: oh and regarding forking, mostly what we care about is that you aren't just forking for the sake of packaging etc
21:13 jberger adding extended functionality wouldn't be a problem
21:13 PryMar56 joined #mojo
21:13 CandyAngel Ah okies, coolies
21:14 CandyAngel Obviuosly, the "if you fork, we might exile you" made me a bit worried :P
21:14 CandyAngel Obviously*
21:14 jberger let me reread the policy bit on that but I hope it doesn't generally read like that
21:16 jberger hmmm, I guess the "without our consent" is the safety valve
21:16 CandyAngel Well, it prompted me to ask, so it did it's job :P
21:16 CandyAngel its*
21:17 CandyAngel I can english I swarz
21:17 jberger :D
21:17 pink_mist ... was that him?
21:18 jberger ?
21:18 pink_mist 22:17 -!- rshadow [~rubin@broadband-95-84-218-122.nationalcablenetworks.ru] has quit [Ping timeout: 360 seconds]
21:18 pink_mist no wait, he's not russian, is ihe?
21:18 pink_mist *he
21:18 jberger no, israeli
21:18 pink_mist right, then I guess that wasn't him :P
21:32 CW joined #mojo
21:35 henq joined #mojo
21:41 lluad joined #mojo
21:50 disputin joined #mojo
21:54 vicash pink_mist: he could be using a russian VPN.
21:55 pink_mist true
21:56 pink_mist that looked like a home line though, judging by "nationalcablenetworks"
21:57 Grinnz ...who?
21:57 Grinnz oh, the perl jam guy? lol
22:01 arcanez pink_mist: he got in via a CGI 'exploit'
22:02 khfeng joined #mojo
22:03 jberger in removed documentation I'm sure
22:08 khfeng_ joined #mojo
22:48 jontaylor joined #mojo
23:06 marty joined #mojo
23:12 alexbyk joined #mojo
23:31 sri re wifi repeater problems earlier, i guess you have to give it a different network name or devices will randomly switch between repeater and base station, causing fragile connections
23:32 Grinnz then you have to switch to a different connection entirely if you get out of range of the first one though, i would think that's a bigger problem
23:33 Grinnz unless things handle that smoothly?
23:33 Grinnz (wasn't following the earlier discussion)
23:34 sri i guess i just won't wander around with devices ;p
23:34 sri there was no discussion, just me complaining a little :)
23:36 Grinnz with everything being in the cloud now anyway, what's the problem with a fragile connection :P
23:36 sri my problem was that one side of the house didn't have wifi, so i got a repeater, which works, but my macbook started to switch between both if signal strength was about the same
23:37 sri was ssh-ing from one laptop to the other, and the connection dropped a few times, which sucked
23:37 CandyAngel Needs more hysteresis
23:39 CandyAngel Maybe you need to change the roaming threshold?
23:40 sri changed the network name in the repeater, now it's all good, just need to switch networks when i go to the other side of the house ;p
23:53 jberger There's some way to do that
23:54 jberger Phil21 would know, but he's on a peaceful central American get away

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