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

IRC log for #mojo, 2017-04-27

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

All times shown according to UTC.

Time Nick Message
00:05 gizmomathboy joined #mojo
00:14 tchaves joined #mojo
00:42 cheako joined #mojo
01:49 kiwiroy joined #mojo
02:25 jmac joined #mojo
02:47 cheako joined #mojo
02:49 noganex_ joined #mojo
03:17 tchaves joined #mojo
03:35 aborazmeh joined #mojo
04:01 dikim joined #mojo
04:04 dboehmer joined #mojo
04:25 mattp joined #mojo
04:48 kiwiroy joined #mojo
05:18 inokenty-w joined #mojo
05:40 eseyman joined #mojo
06:26 cheako joined #mojo
06:35 cheako joined #mojo
06:48 kiwiroy joined #mojo
06:49 AndrewIsh joined #mojo
06:51 dod joined #mojo
06:58 dod joined #mojo
07:01 rshadow joined #mojo
07:12 rshadow joined #mojo
07:18 trone joined #mojo
07:24 eseyman joined #mojo
08:39 berov joined #mojo
08:39 osfabibisi joined #mojo
08:52 nic jberger: I'm wondering if TypeModel is referring to classes rather than types.  Or is it a ref to algebraic types?  Each time I try to look at it I get lost in the whole What does he mean by Type? question
08:53 nic or maybe it's what's called in CS 'kind'
09:07 nic Grinnz++  # upgrade notes
09:08 nic Weren't there some changes around $tx->error?  Off the top of my head I'm thinking $tx->res->error is the new $tx->error->{message} but I might be talking nonsense (and don't have time to check it right now)
09:39 kiwiroy joined #mojo
09:59 sri btw. did i mention that i found fantastic keycaps for my corsair keyboard?
10:02 sri turns out corsair actually sells replacement keycap sets, and one of them is a really nice set of smooth keycaps with a pro looking font
10:05 sri so yea, now i got the perfect keyboard :)
10:56 stryx` joined #mojo
11:14 tchaves joined #mojo
11:36 karjala_ joined #mojo
11:42 jberger nic in my mind it relates to the mapping that I used
11:42 jberger But mostly it was a choice tar wouldn't step on a future core namespace
12:21 kiwiroy joined #mojo
12:31 blop joined #mojo
12:35 perlpilot joined #mojo
12:41 perlpilot joined #mojo
12:42 perlpilot joined #mojo
12:58 karjala_ joined #mojo
13:12 gryphon joined #mojo
13:16 stryx` joined #mojo
13:16 perlpilot joined #mojo
13:29 gizmomathboy joined #mojo
13:41 jacobydave joined #mojo
13:42 Armen good morning
13:42 purl For you maybe.
13:42 vicash Hello. While using Mojo::Pg in unit tests I get log messages for Postgresql "LOG: could not receive data from client: Connection reset by peer" each time I run the tests, which succeed. Do I need to call some close() function on the Mojo::Pg object before exiting the test ?
13:48 vicash I have tried the $pg->db->disconnect but that doesn't remove the log messages.
13:52 vicash I also see this with hypnotoad when you do hot deploy
13:56 vicash I am using Pg 9.5 with Mojo::Pg 3.05 on Ubuntu 16.04 LTS 64-bit
13:58 kiwiroy joined #mojo
13:59 vicash I upgraded to DBD::Pg 3.6.0 and don't see the hypnotoad logging the warnings but the test is still logging it.
14:03 maschine joined #mojo
14:03 Pyritic joined #mojo
14:10 osfabibisi joined #mojo
14:37 mcsnolte joined #mojo
14:49 jberger Armen: ignore purl
14:49 jberger bad bot!
14:49 * purl chuckles evilly
14:50 Armen I just need to find a new way to say hello, I guess
14:50 jberger as long as she doesn't scare you off :-P
14:51 maschine it's a she?  damn, this whole time..
14:51 Armen as long as she obeys the three rules of robotics, we should be fine!
14:51 PryMar56 joined #mojo
14:53 jberger yeah, people use "she" for purl
14:53 jberger though it does make me feel bad about the "pushing down the stairs" one that I used to love
14:55 * sri pushes jberger down the stairs
14:56 jberger Hey! thump ow! bang argh! bam son of a thump crunch whimper...
14:57 jberger (its the "crunch wimper" that gets me now)
14:58 vicash left #mojo
14:59 perlpilot joined #mojo
15:11 zivester joined #mojo
15:13 arcanez jberger: thanks for your various blog posts about mojo, even if they are approaching 4 years old. I'm apparently more than fashionably late to the party
15:13 Xyem If I wanted to check a cookie for user authentication on each request, should I be using a before_dispatch hook and store the result in the stash?
15:14 preaction Xyem: that could work. also an under() route
15:15 sri jberger should update and republish some of his blog posts on blog.mojolicious.org :)
15:15 Xyem preaction: Sounds good, thanks.
15:15 jberger I think my new blogging solution is to static blog on my one site (new, not really announced) and then manually repost to blog.mojo
15:16 jberger since tumblr's reblog is so aweful
15:16 jberger awful even
15:16 jberger and yeah, lots of them could use a brush up
15:16 jberger Mojo has gotten better and I've learned a lot too
15:17 jberger arcanez: thanks, I'm glad they still help people
15:19 rshadow joined #mojo
15:20 Trick14 joined #mojo
15:21 Xyem I'm coding a "bolt on" site for someone, so I using cookies set by something else for logged in user data.
15:21 Xyem so I am using*
15:21 jberger then again, now that bpo doesn't look like its going anywhere maybe I'll just keep blogging there (still happy to repost to mojo blog)
15:21 Xyem Client likes what I've done so far. Probably doesn't realise it's all in one file though :)
15:23 sri jberger: or just blog directly on blog.mojolicious.org?
15:23 jberger for mojo stuff that is possible, yeah
15:24 jberger but I still want a blog of my own for non-mojo stuff
15:24 jberger so I'm trying to come up with a solution I like
15:24 jberger that's why tumblr seemed like a good thing
15:24 jberger blog whatever I want, then reblog the mojo stuff
15:24 sri who cares about other stuff...
15:24 jberger you follow my twitter :-P
15:25 sri you're not making it easy ;p
15:25 jberger no, I'm sure plenty of perl people are sick of me on twitter
15:25 jberger I've almost been thinking of doing like brian d foy and having two, one for perl stuff and one for personal
15:26 Armen jberger: where can I find your blog? I, too, am late to this particular party.
15:26 jberger that's part of the whole problem I'm in, I want to be connected to several communities, some of which overlap
15:26 jberger but without annoying people who aren't in the overlap
15:27 jberger tough thing
15:27 purl it has been said that tough thing is whether to stop or not
15:27 Armen purls of wisdom
15:27 purl My young son asked me what happens after we die. I told him we get buried under a bunch of dirt and worms eat our bodies. I guess I should have told him the truth - that most of us go to Hell and burn eternally - but I didn't want to upset him
15:27 Armen did not expect that.
15:27 Grinnz lol
15:27 arcanez jberger: I believe I caught http://blogs.perl.org/users/joel_berger/2013/10/writing-non-blocking-applications-with-mojolicious-part-1.html by searching for something to show how things are done in POE vs IO::Async vs Mojo[::IOLoop]. I really never would have thought to put async in my web like that, but makes sense
15:27 jberger Armen: http://blogs.perl.org/users/joel_berger/
15:28 jberger for the most part at least
15:28 Armen cool.
15:28 jberger man those posts ....
15:28 jberger Mango
15:29 jberger and my old obsession with line oriented HTML helpers
15:29 jberger I came from LaTeX for everything
15:29 jberger the further I get away from that the more I just use HTML properly
15:30 Armen I've been working on a project with a mojolicious back-end for the better part of a year, but hardly ever looked at the perl code.
15:31 Armen if my front-end code was nicer to mojo, everyone would be happier. So here we are plowing through mojo documentation :)
15:34 Trick14 got a question, is it allowed to just ask here?
15:35 Armen I hope so.
15:35 sri arrest him!
15:36 sri it's encouraged though http://mojolicious.org/perldoc#SUPPORT
15:37 Trick14 okay
15:37 Trick14 trying to write a websocket client
15:38 Trick14 and the message i am sending are copied from chrome developer logging
15:39 Trick14 I can successfully send them via the app on www.websocket.org and in a perl script which was using anyevent (but I am moving away from that)
15:39 Trick14 but with mojo useragent the server didn't like my message and replies c[1007,"null"]
15:40 Trick14 so something is wrong with how I send $tx->send('["CONNECT\nprotocol-version:1.3\naccept-version:1.1,1.0\nheart-beat:10000,10000\n\n\u0000"]');
15:43 Trick14 and as mentioned, sending that message using the app on http://www.websocket.org/echo.html I don't get the message the websocket will be closed
15:44 jberger Trick14 do you really want to be sending the frames manually?
15:49 cheako joined #mojo
15:49 Trick14 I don't want to, I was doing it in because afterwards I have to subscribe me to some api calls
15:50 Trick14 and it's the fastest to simply c/p the google frames
15:50 jberger so you are using some protocol on top of the websocket
15:51 jberger (which I suppose must be true since that doesn't look like a websocket frame now that I look at it)
15:51 jberger anyway, I mocked up a super simple demo: https://gist.github.com/jberger/9f821b01af3b7ea6cbc4a24725b4f947
15:53 jberger is that raw socket.io?
15:54 Trick14 don't know
15:56 Trick14 sockjs i believe
15:59 jberger do you need a fallback mechanism
15:59 jberger ?
15:59 jberger most browsers handle websockets natively now
16:00 maschine jberger - I'm just learning about websockets, but it is something I definitely intend to use on my app - is that demo you made a "proof" that websockets are working on my server?
16:00 maschine What I mean is, if it works - that means ws is working through nginx/reverse proxy?
16:00 jberger anyway, I don't know of a native mojo sockjs translation
16:00 Trick14 i try to make my own client over here
16:01 Trick14 but why in $client = AnyEvent::WebSocket::Client->new
16:01 Trick14 $client->connect( "wss:/
16:01 jberger maschine: that demo is a client, so no it has nothing to do with your server
16:01 Trick14 $ws->send('["CONNECT\nprotocol-version:1.3\naccept-version:1.1,1.0\nheart-beat:10000,10000\n\n\u0000"]');
16:02 Trick14 it just works (besides anyevent afterwards screwing up and idling my cpu to 100%)
16:02 jberger Trick14: I'd have to see more of your code (ie paste-site)
16:02 jberger as you can see in my demo, ->send works just fine
16:02 maschine ah, I was hoping to find something simple just to test my server with
16:03 jberger maschine: do you have redis or postgres already?
16:03 jberger there are chat examples for those
16:03 jberger there is even one that isn't broker-backed someplace
16:03 jberger but you can only use that on a single-process server like daemon/morbo
16:03 Trick14 okay jberger will do
16:04 maschine morbo should be fine just for testing though?
16:04 jberger sure
16:04 jberger here is the basic chat, used it in a demo talk a few weeks ago: https://github.com/jberger/VueChat/blob/master/ex/mojo_basic_chat.pl
16:04 maschine I saw a couple of those chat examples - I'll just have to test one :)
16:05 jberger of course it has my reveal comments in it, just ignore those
16:05 maschine I want to use ws to send/receive binary data to a client on a PC or a smartphone - to be flashed onto an embedded device
16:06 maschine it will solve some issues with piracy of proprietary data in the binary files
16:06 jberger wouldn't that be request-response?
16:06 jberger hunh?
16:06 Trick14 aaarrgh
16:06 Trick14 by pasting it to a gists
16:07 Trick14 i discovered a uncommented tx->send('Hi!')
16:07 maschine basically I don't want the user to have direct access to the binary data - it'll go straight to the client software, be flashed, and they'll never directly see it.
16:07 Trick14 this is stupid
16:07 preaction maschine: and why does websockets allow this but plain http does not?
16:08 jmac left #mojo
16:08 maschine it would but the server cost of sending/receiving would be higher
16:08 jberger maschine: how many requests are you making
16:09 jberger the overhead of a websocket frame is less than an HTTP header, but not by a lot
16:09 preaction but a websocket requires a handshake and regular pings. it's not lower-cost than http
16:09 jberger and the websocket handshake is an HTTP request anyway
16:09 maschine I don't know yet - it could be a lot.  Plus I want the web app to be "aware" that the client is connected, and be able to read information out of the embedded hardware
16:10 jberger I have come to this simple maxim: use HTTP if you want a request/response model, use websockets if you want the server to be able to push data unsolicited
16:10 maschine I'll have to think about it some more but it seemed to fit what I wanted to do pretty well
16:11 Trick14 jberger: despite it was a stupid mistake, thanks for helping
16:12 Trick14 gonna hang around here ;)
16:12 maschine anyway I just ran that demo and ws appears to be working :)
16:15 jberger Trick14: no problem, it happens to the best of us
16:16 jberger its also why I encourage people to post minimal examples of problems, very often you find the bug just trying to do that
16:16 jberger maschine neat
16:18 rshadow joined #mojo
16:22 jberger Trick: who knows what might happen when you say you are going to hang around #mojo more :-P https://irclog.perlgeek.de/mojo/2012-10-26#i_6103387
16:22 cheako joined #mojo
16:25 jberger Trick14 even :-P
16:29 maschine heh you even asked about LaTeX :p
16:30 jberger like I said, that's what I was into then
16:30 jberger I still am a fan, I just have less of a reason to write paper lately
16:46 PryMar56 joined #mojo
16:57 dod joined #mojo
17:00 disputin joined #mojo
17:02 sh14 joined #mojo
17:02 kiwiroy joined #mojo
17:23 Trick14 mmm
17:24 Trick14 halfway when running the script
17:24 Trick14 $tx->on(message => sub {
17:24 Trick14 my ($tx, $msg) = @_;
17:24 Trick14 if ($msg eq 'o') {
17:24 Trick14 Use of uninitialized value $msg in string eq at
17:24 Trick14 so it did handle couple of messages okay
17:27 jberger Trick14 please don't paste more than one line of code into the channel
17:27 Trick14 apologies
17:27 purl apologies are in order, then.
17:27 jberger no worries, everyone gets once :D
17:29 nicomen paste?
17:29 purl paste is, like, http://paste.scsys.co.uk/
17:29 jberger purl: paste is also https://gist.github.com
17:29 purl okay, jberger.
17:31 jberger anyway, I dont' know what mojo websocket does on say a text frame with no body
17:31 jberger I'd expect '' but I wouldn't be surprised by undef
17:35 Trick14 https://pastebin.com/Ti0bXMZB
17:36 pink_mist can it distinguish between no body and a body that's empty?
17:36 pink_mist seems undef vs '' would be good for that
17:36 pink_mist (if it's even legal to send a frame without a body?
17:36 pink_mist )
17:55 jberger looks like an undef payload isn't possible
17:55 jberger https://github.com/kraih/mojo/blob/master/lib/Mojo/WebSocket.pm#L148-L149
18:01 Trick14 so what's happening here?
18:04 jberger No idea
18:04 jberger Perhaps try with MOJO_WEBSOCKET_DEBUG=1
18:06 SwellJoe joined #mojo
18:21 sh14 joined #mojo
18:57 jberger I finally have a service that can't handle escaped slashes in JSON
18:57 jberger FML
19:02 quite joined #mojo
19:02 quite left #mojo
19:03 stryx` joined #mojo
19:06 mishanti1 jberger: Finally? Do you like those services best? ;)
19:07 jberger ummmm, I'm going to have to go with .... no
19:07 jberger actually, I'm almost certain they are validating the json-encoded payload with a regexp before decoding it
19:07 jberger and you might wonder how I guess that
19:08 Grinnz http://scicurious.scientopia.org/wp-content/uploads/sites/3/2010/11/Augh1.jpg
19:09 jberger http://en.community.dell.com/techcenter/extras/m/white_papers/20443207 see page 24 of the pdf
19:09 jberger that's their example of how to check the response payload for an error message
19:10 jberger TL;DR: message=re.search("@Message.ExtendedInfo.+?,",get_error_string).group().strip("@Message.ExtendedInfo\":[{")
19:11 jberger so if that's how they want me to check their response for errors, how do you think they are validating that I'm passing a valid NFS path as a value
19:17 mishanti1 Looking like a service that would be fun to prod and poke in less than polite ways.
19:19 rshadow joined #mojo
19:38 cheako joined #mojo
19:48 kiwiroy joined #mojo
19:57 gizmomathboy joined #mojo
20:04 Xyem How bad is it to set $_ in Mojo::Collection->first?
20:14 Grinnz that would change every element until your subroutine returned true
20:14 Grinnz probably not what you want
20:16 Xyem It only changes it before it returns true.
20:17 Grinnz then yes, that would work, though i'm not sure i'd be comfortable relying on that
20:26 simbabque how would I go about a unit test for a configuration-style plugin, where I want to test different code-paths in one .t file?
20:27 simbabque I've looked at various ::Plugin::* distributions to see what they do. mostly it's just a single .t file with a Mojolicious::Lite and Test::Mojo, loading the plugin, a route and a test
20:28 simbabque I'd like to keep everything in one .t file as this is part of a large project though, and I'm not sure how I can get it to have multiple Mojos at the same time.
20:28 simbabque can I just create several packages in my .t file, and then tell Test::Mojo to work with each of them in turn?
20:28 sri my $app = MyApp->new; $app->plugin(MyConfigPlugin => {foo => 'bar'});
20:29 sri is $app->config->{lalala}, 'whatever';
20:29 sri have as many as you like
20:29 sri heck, make it my $app = Mojolicious->new;
20:30 sri if your config plugin is sane it should be absolutely trivial
20:32 simbabque and then I can pass $app to Test::Mojo?
20:32 simbabque oooh, I see
20:32 simbabque thank you
20:33 simbabque I don't even need to use Test::Mojo
20:44 Grinnz Test::Mojo is more for testing routes/requests
20:55 rshadow joined #mojo
21:12 iaw joined #mojo
21:14 iaw apologies for bugging the wizards: I want to share the session across subdomains, think app->sessions->cookie_domain('ucla.edu').  is there a way to set this globally in M-Lite before appstart, or does each URL have to set it?
21:15 jberger thats deeper Cookie lore than I have at the top of my mind, personally
21:24 preaction that should just work if you put it at the top
21:31 Grinnz yes, i believe that should be fine for all ucla.edu subdomains
21:33 rshadow joined #mojo
21:36 Xyem It would appear that a route is only affected by one 'under' at a time in a Lite application.
21:36 Grinnz Xyem: thats why lite has a group keyword unique to it
21:40 Xyem Grinnz: Aha, that solves it. Thank you (and sorry).
21:40 Grinnz see last example in https://metacpan.org/pod/Mojolicious::Guides::Tutorial#Under
21:40 elik joined #mojo
21:40 Grinnz np, its specific to Lite, full apps dont need it as routes are objects
21:40 jmac joined #mojo
21:41 Xyem Yes, it is pretty clear in that example :)
21:50 disputin joined #mojo
21:55 dikim joined #mojo
22:15 plicease joined #mojo
22:16 jnap joined #mojo
22:18 Obbi joined #mojo
22:19 Xyem joined #mojo
22:20 Jonis joined #mojo
22:47 RoxyRose18 joined #mojo
22:47 RoxyRose18 Jonis Xyem Obbi jnap plicease dikim disputin jmac elik rshadow stryx` SwellJoe PryMar56 Trick14 mcsnolte Pyritic jacobydave gryphon blop eseyman mattp dboehmer noganex_ kgoess PopeFelix dantti_laptop Armen Lee castaway bobkare coolo Peppard bwf avkhozov ribasushi mgrimes inokenty dotan_convos v
22:47 RoxyRose18 ytas jberger batman marcus mtths abracadaniel oalders nic haarg matt_ iamb tianon cstamas ranguard mbudde pink_mist esh nicomen jlaffaye sawtooth new_student ashimema genio chandwki kaare meredith omega lari jesk Eke preaction bjakubski Zx3 michael Phil21 mrallen1 sri Caldrin tyldis ccakes crab
22:47 RoxyRose18 left #mojo
23:25 MightyMouse18 joined #mojo
23:25 MightyMouse18 Jonis Xyem Obbi jnap plicease dikim disputin jmac rshadow stryx` SwellJoe PryMar56 Trick14 mcsnolte Pyritic jacobydave blop eseyman mattp dboehmer noganex_ kgoess PopeFelix dantti_laptop Armen Lee castaway bobkare coolo Peppard bwf avkhozov ribasushi mgrimes inokenty dotan_convos vytas jberger
23:25 MightyMouse18 batman marcus mtths abracadaniel oalders nic haarg matt_ iamb tianon cstamas ranguard mbudde pink_mist esh nicomen jlaffaye sawtooth new_student ashimema genio chandwki kaare meredith omega lari jesk Eke preaction bjakubski Zx3 michael Phil21 mrallen1 sri Caldrin tyldis ccakes crab dustinm
23:25 MightyMouse18 left #mojo
23:26 elik joined #mojo

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