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

IRC log for #mojo, 2016-05-18

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

All times shown according to UTC.

Time Nick Message
00:41 marty_ joined #mojo
00:56 dvinciguerra joined #mojo
01:39 allnighter joined #mojo
02:03 noganex_ joined #mojo
02:08 oalders i'm POSTing to the Fitbit API.  If I POST with Mojo::UserAgent then I get an error.  If I try the same POST with LWP::UserAgent, it's fine.
02:08 oalders https://gist.github.com/oalders/72d89aec217feb66acd08aa89a169dd7
02:20 punter joined #mojo
02:21 jberger "Missing 'grant_type' parameter value"
02:22 punter I just moved my mojolicious webapp to a new server, and now I keep getting this strange error in STDERR whenever i try to start morbo app.pl - can anyone figure out why?
02:22 punter Can't load application from file "/home/baza/web/perl/app.pl": Can't locate Mojolicious/Plugin/BCore/Plugin/Auth.pm:   ./Mojolicious/Plugin/BCore/Plugin/Auth.pm: Permission denied at (eval 125) line 1.
02:22 punter Compilation failed in require at (eval 85) line 1.
02:22 jberger oalders Are you sure the requests are the same?
02:22 oalders jberger: they look mostly the same
02:22 punter I'm using the plugin with name BCore::Plugin::Auth
02:23 punter worked before, doesn't now
02:23 jberger punter: is it installed?
02:23 punter Yes, but let me perl -M it and see again.
02:23 bpmedley oalders: i didnt see perl code, is that included?
02:23 punter yes it is
02:24 punter it says "permission denied"...
02:24 oalders bpmedley: was just pushing it
02:24 oalders https://github.com/oalders/Mojolicious-Plugin-Web-Auth/blob/fitbit/lib/Mojolicious/Plugin/Web/Auth/OAuth2.pm#L60
02:24 bpmedley punter: how are you launching the app?
02:24 punter ubic start myapp
02:24 punter bpmedley: ^^
02:25 punter this sets some env variables, and launches this command:
02:25 bpmedley Ubic?  Is that a script?
02:25 punter /home/baza/perl5/bin/morbo -l http://127.0.0.1:8080 -w /home/baza/web/perl /home/baza/web/perl/app.pl
02:26 punter Ubic is a thingy like supervisor
02:26 punter starts up your apps when the machine boots, and makes sure the apps are running and launches again if fallen
02:26 bpmedley And what version of perl is in baza?
02:26 oalders fitbit says the request looks fine: https://community.fitbit.com/t5/Web-API/Missing-grant-type-parameter-value/m-p/1367266#M5534
02:26 punter 5.22
02:26 oalders wondering if it's something at cloudfront
02:27 bpmedley oalders: moment
02:27 oalders sure, no hurry :)
02:27 punter so app.pl refuses to run
02:27 bpmedley punter: what about straight perl on app.pl?
02:27 punter o
02:28 * jberger biab sorry
02:28 punter bpmedley: this brings up a help screen, saying it requires extra parameters
02:29 bpmedley What parameters are required?
02:29 punter the perl app.pl command requires further parameters, like "get /"
02:30 bpmedley Try perl app.pl daemon
02:30 punter did that
02:30 punter it worked
02:30 punter Listening at ..., server available at ....
02:30 bpmedley Can you access via browser?
02:30 punter I'll check
02:31 punter oh ok, database error (haven't set up the database properly)
02:31 punter thanks :-)
02:32 punter I'll do that and come back if more problems
02:33 bpmedley oalders: do you have your scripts code handy?
02:34 oalders bpmedley: yep.  i realized i need to upload one more thing.  will push it now
02:37 oalders bpmedley: the script is at https://github.com/oalders/mojolicious-plugin-web-auth-site-fitbit/blob/master/examples/auth.pl
02:53 aborazmeh joined #mojo
02:59 noganex joined #mojo
03:16 punter bpmedley: a server restart fixed my problem. Don't know what the problem was.
03:25 mcsnolte joined #mojo
03:30 ivi joined #mojo
03:31 oalders bpmedley++ # sorting my UserAgent issues
03:32 oalders chomping the Authorization header fixed it in Mojo::UserAgent and broke the request in LWP::UserAgent, but it solves my problem for now
03:39 Lee joined #mojo
03:43 oalders looks like i needed to pass an empty string as the last arg to encode(): MIME::Base64::encode("$user:$passwd", q{})
03:44 Grinnz right, base64 encoding functions all seem to have this quirk
03:51 Guest-quest joined #mojo
03:55 user_8822 joined #mojo
03:57 user_8822 $delay->steps( { sub { my $delay shift; $self->helperfunction('bla' => $delay->begin); }, sub { my $delay = shift; $self->app->log->debug('Step2'); })->wait;
03:57 user_8822 can anyone tell me why $delay->begin does not work with a helper function?
03:57 user_8822 Sub#2 never called
04:12 jberger oalders: ah yeah, that one has bit us all
04:12 jberger were user_8822 still around I'd say that it seems like the callback from ->begin is never called
04:13 jberger maybe they'll check the log
04:19 allnighter joined #mojo
04:33 inokenty-w joined #mojo
04:52 sri hehe, every now and then i want to make Mojo::Headers filter headers... but then i remember the horrible benchmark results...
05:07 punter joined #mojo
05:38 dod joined #mojo
05:39 Lee joined #mojo
05:44 dod joined #mojo
05:51 inokenty joined #mojo
06:02 Lee joined #mojo
06:03 dod joined #mojo
07:14 AndrewIsh joined #mojo
07:19 trone joined #mojo
07:20 allnighter joined #mojo
08:04 osfabibisi joined #mojo
08:23 Vandal joined #mojo
08:23 odc joined #mojo
08:31 jwang joined #mojo
08:37 arthas joined #mojo
09:20 meshl joined #mojo
10:48 tchaves joined #mojo
11:08 dvinciguerra joined #mojo
11:55 kaare joined #mojo
12:03 meshl joined #mojo
12:38 arthas joined #mojo
12:40 mcsnolte joined #mojo
12:58 ramortegui joined #mojo
13:11 gizmomathboy joined #mojo
13:26 marty joined #mojo
13:30 marty joined #mojo
13:33 marty_ joined #mojo
13:47 icjs joined #mojo
13:49 icjs batman, hello! we're using Mojolicious::Plugin::Swagger2 and trying to rustle up a section to cater for POST of JSON data in the body, it's proving hard to get the right paramaters in place and just wondered if there is an example you can point me too?
13:52 icjs snipper of our YAML: http://pastebin.com/JraCuLTw
14:04 batman icjs: try in #swagger instead
14:04 icjs batman, thanks, will do
14:17 dvinciguerra joined #mojo
14:26 arthas_ joined #mojo
14:31 arthas joined #mojo
14:32 jberger sri: it seems that HTTP::Headers strips trailing newline in headers which is why oalders had different experience between Mojo::UserAgent and LWP yesterday
14:32 jberger seen here: https://metacpan.org/source/ETHER/HTTP-Message-6.11/lib/HTTP/Headers.pm#L289
14:32 jberger is that something that would be worth considering for Mojo?
14:41 marty joined #mojo
14:52 lluad joined #mojo
14:52 arthas_ joined #mojo
15:03 meshl joined #mojo
15:07 zivester joined #mojo
15:15 arthas joined #mojo
15:31 marty joined #mojo
15:35 kevin1 joined #mojo
15:36 kevin1 http://paste.arn-fai.net/?1975575
15:36 kevin1 is there a chance to make this working like this
15:37 kevin1 it's blocking
15:37 kevin1 my goal is that anything in sub test should be non blocking.
15:39 jberger kevin1: You need to call those get methods nonblocking
15:39 jberger Synchronize with delays
15:39 irqq joined #mojo
15:39 kevin1 it's not enough to call the function in non blocking style?
15:40 jberger kevin1: http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#Will-my-code-magically-become-non-blocking-with-Mojolicious
15:40 marty joined #mojo
15:40 kevin1 I see. jberger: i can do this, but on question though
15:41 kevin1 if i have own routines that perform i/o stuff on the harddisk. on every call that may delay, i have to make sure it's called in non blocking style?
15:42 kevin1 some libaries on cpan dont support callbacks?
15:42 kevin1 means i have to modify those?
15:42 kevin1 that's unclear to me how to handle this
15:43 marty_ joined #mojo
15:52 vicash kevin1: Mojolicious::Plugin::ForkCall
15:53 punter joined #mojo
16:00 bwf joined #mojo
16:04 kevin1 thanks. i still can't get behind it somehow.
16:04 kevin1 i made this sample
16:04 kevin1 http://paste.arn-fai.net/?1975613
16:05 kevin1 it's completely non blocking, isn't it? But if i open 2x http connection at the same time, it is delayed
16:06 kevin1 in the debug window, it shows the new incoming connection, once the first connection is closed and then it begins.
16:10 jberger kevin1: those are sequential requests
16:10 jberger do you want them "parallel"
16:11 kevin1 i want them sequential, but non blocking.
16:11 jberger that's what you have
16:12 kevin1 but under the whole app blocks
16:12 kevin1 but the whole app is blocking*
16:12 kevin1 i could have 3 connections at the same time, that call the function which needs sequential requests.
16:13 kevin1 right now each connection waits until the other is finished and all other rest funcitons are not working either during this function call
16:13 jberger kevin1: I'm surprised to hear that given the code you are showing
16:14 jberger I suspect there is something in your real app that isn't in the toy app you are showing
16:14 jberger or else that your client test isn't right
16:14 kevin1 i only call /delay with the code from the paste link
16:15 jberger using say curl in multiple terminals?
16:15 jberger what server are you using?
16:15 kevin1 morbo
16:16 kevin1 try this code yourself you will see
16:16 kevin1 it blocks
16:16 jberger that isn't a runnable example
16:16 jberger and I have a meeting in a few minutes
16:16 jberger but from what I see it should be non-blocking as you would expect
16:16 kevin1 but we both agree this should be non blocking and accept multiple incoming connections?
16:16 jberger it should yes
16:17 kevin1 i will try to figure this out
16:17 kevin1 could it be because the host is invalid?
16:17 kevin1 http://abc
16:17 jberger name resolution is blocking
16:17 jberger unless you have Net::DNS::Native installed
16:17 jberger so yes
16:17 kevin1 Oh.
16:18 kevin1 So the problem is the invalid host
16:18 jberger name resolution is done at a system level, it isn't something mojolicious can control
16:18 jberger Net::DNS::Native uses threads to parallelize name resolution
16:18 kevin1 how would i add this into the function?
16:18 jberger sorry, I assumed you had real addresses in your example
16:19 jberger install Net::DNS::Native or use resolvable hosts
16:19 jberger name resolution, though blocking, doesn't take very long
16:19 jberger so usually from this perspective one usually just accepts a small amount of blocking there
16:19 jberger OSes usually cache the resolution anyway
16:20 jberger NDN is useful when writing a spider or crawler and there might be tons on unlike parallel name resolutions at once
16:20 kevin1 ok, i got it
16:20 jberger s/tons on/tons of/
16:20 kevin1 i just wanted to simulate when the remote host is down
16:20 kevin1 but ns should work still then
16:21 jberger yeah, but name resolution isn't the same thing as the host being down unfortunately
16:21 jberger though it may seem that way at first
16:21 kevin1 but if the host is down this code should be non blocking?
16:21 jberger yes
16:21 jberger assuming the name resolves
16:22 kevin1 well.. i think the problem is solved then
16:22 kevin1 thx
16:22 jberger k
16:22 jberger np
16:23 kevin1 making a large function non blocking
16:23 kevin1 ain't that easy
16:23 kevin1 especially if you take cpan modules that don't support callbacks
16:23 jberger make it out of smaller non-blocking functions that call each other
16:23 jberger that's true
16:23 jberger ForkCall can help, but its not a panacea
16:23 jberger ReadWriteFork is another module too
16:24 kevin1 i'll check it out
16:24 kevin1 one way would be also to modify the cpan modules to accept callbacks, or?
16:24 jberger if you control that code
16:25 jberger Or else use a job queue
16:30 kevin1 jberger: you helped me now 3 times, also in earlier questions. keep it up. i have to leave now.
16:31 mishanti1 This is a helpful crowd indeed.
16:36 icjs i concur, i've got more help from the peeps on this channel than all other 32,768 irc channels combined
16:40 marty joined #mojo
17:04 dod joined #mojo
17:04 dave Given I have a Mojolicious::Controller with a websocket, what should the argument to "finish()" be?
17:13 preaction i don't think there is one
17:47 disputin joined #mojo
17:57 zivester joined #mojo
18:03 disputin joined #mojo
18:12 punter joined #mojo
18:20 irqq joined #mojo
18:22 allnighter joined #mojo
18:48 PryMar56 joined #mojo
19:00 kevin1 Testing non blocking code with delayed response in browers, such as mozilla or chrome doesn't work well. it seems the browsers block the connection when one tab has not finished loading to the same url. ;-/
19:01 jberger dave: http://mojolicious.org/perldoc/Mojolicious/Controller#finish
19:01 jberger it is the close reason code and optional message
19:01 jberger reason codes less than 4000 are reserved so I usually use 4000 + HTTP Status code
19:05 irqq_ joined #mojo
19:10 pink_mist kevin1: there used to be a way of controlling what firefox did there, but no idea if it's still possible
19:31 pink_mist kevin1: anyway, perhaps you should take a look at 'wrk' for performance testing that kind of setup?
19:44 allnighter joined #mojo
19:50 absolut_todd joined #mojo
20:35 bobkare joined #mojo
20:52 itaipu joined #mojo
21:09 sri jberger: did you benchmark it?
21:12 bobkare joined #mojo
21:13 jberger benchmark the newline/headers stuff?
21:13 jberger no I wouldn't even know where to put it
21:13 sri ok
21:13 jberger but if performance is the concern then that's a reasonable response
21:13 allnighter joined #mojo
21:13 sri it is
21:14 sri Mojo::Headers is one of the big hotspots in mojolicious
21:14 sri anything you make slower or faster there has a ripple effect through the entire framework
21:17 tyldis I have a peculiar case I need some ideas on. I have an existing non-mojo application I want to port to Mojolicious, and thought using Mojo::IOLoop->client was a good idea. However, I need the socket to be flushed on every write() as the IP packet cannot exceed 1260 bytes (talking to an embedded unit that works on IP packets not a TCP stream). In my old application i use sockopts to control the socket and it works, but with Mojo::IOLoop I need t
21:18 tyldis Granted, I am still no Mojo wizard...
21:18 pink_mist your line got cut off
21:18 pink_mist so unsure what your issue is
21:19 tyldis Hmm. Last few words?
21:19 pink_mist check the irclog to see how much of it we saw
21:19 pink_mist (see topic)
21:19 tyldis >> but with Mojo::IOLoop I need to do ->one_tick after each write to achieve the same, and then I get a huge backlog on the reads...
21:22 tyldis I don't really need async and non-blocking, but before giving up I thought I'd seek help.
21:23 sri Mojo::IOloop disables nagle's algorithm for all sockets
21:23 sri so, no need to flush
21:24 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Streaming
21:25 tyldis sri: Aha, so I need to drain.
21:39 meshl joined #mojo
21:40 allnighter joined #mojo
21:42 sri and this is your daily reminder that async doesn't make everything better ;p https://github.com/kraih/minion/issues/35
21:42 punter joined #mojo
21:46 tyldis I'm just trying to get away from my horrible implementation with threads.
21:47 tyldis It was fun up to a certain point.
21:47 tyldis But then quickly went down hill.
21:57 sri what is more idiomatic postgresql <> or !=?
22:02 sri looks like <> is the one, since it's from the sql specs
22:02 lluad <> is SQL standard.
22:02 lluad Postgresql people tend to use either of them, at random.
22:14 sri argh
22:14 sri i'm getting so much spam from rt.cpan recently
22:14 sri might start flagging all rt mails as spam
22:15 sri is there a way to disable rt mail notifications?
22:15 preaction no
22:16 sri :S
22:16 preaction that's why schmorp has his auto-responder that people dislike
22:17 Grinnz_ in mysql, != can return null if either operand is null, <> returns 1 if both operands are null
22:17 Grinnz_ oh sorry, that's <=>
22:17 Grinnz_ <> and != are identical
22:25 lluad "is distinct from" is the postgresql (and, I think, SQL standard) way of saying that (assuming NULL <=> NULL is false).
22:48 dave jberger: thanks :) The examples for finish() for a websocket are listed with status codes 1000ish...what I didn't know was that there -were- status codes for websockets. :)
22:49 jberger Close reason codes, but yes
22:51 dave the RFC I read says that you can use the 1000s for certain things, no idea if that's a good idea in practice
23:07 bpmedley tyldis: Will you describe your app further?  Does the embedded unit talk to the app after a GET/POST request?
23:30 gizmomathboy joined #mojo
23:31 disputin joined #mojo

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