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

IRC log for #mojo, 2017-02-08

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

All times shown according to UTC.

Time Nick Message
00:03 marty_ joined #mojo
00:12 cpan_mojo Mojo-IOLoop-LineReader-0.2 by FERREIRA https://metacpan.org/release/FERREIRA/Mojo-IOLoop-LineReader-0.2
00:12 sugar joined #mojo
01:08 stryx` joined #mojo
01:30 zivester joined #mojo
01:41 kiwiroy joined #mojo
01:44 cpan_mojo Mojo-Webqq-2.0.6 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-2.0.6
01:48 sugar joined #mojo
01:50 cpan_mojo Mojo-Weixin-1.3.1 by SJDY https://metacpan.org/release/SJDY/Mojo-Weixin-1.3.1
02:33 asarch joined #mojo
03:16 kiwiroy joined #mojo
03:23 ferreira joined #mojo
03:28 howitdo joined #mojo
05:04 dboehmer joined #mojo
05:10 disputin joined #mojo
05:13 disputin1 joined #mojo
05:40 howitdo joined #mojo
05:59 disputin joined #mojo
07:05 dod joined #mojo
07:05 Gedge joined #mojo
07:12 dod joined #mojo
07:16 Vandal joined #mojo
07:21 kiwiroy joined #mojo
07:29 marcus pretty underwhelmed by https://sparrowdo.wordpress.com/ :-/
07:50 schelcj joined #mojo
07:55 AndrewIsh joined #mojo
08:00 schelcj joined #mojo
08:16 howitdo joined #mojo
08:32 sri here's an idea for someone looking for a plugin to write :) https://groups.google.com/d/msg/mojolicious/QaVw_wk1JnY/qGG3XlBqBwAJ
08:32 trone joined #mojo
08:40 noganex joined #mojo
08:56 Gedge joined #mojo
09:09 tardisx I'm hoping someone does :-) I use Mono as
09:09 tardisx *Mojo
09:10 tardisx As a proxy but it's simple store and forward style
09:10 tardisx Websocket support too would be even better :-) just while I'm dreaming
09:38 bjakubski I need to process uncaught exceptions (report them to rollbar.com)
09:38 bjakubski so i do what airbrake plugin does - hook into after_dispatch and check if there is "exception" on stash
09:39 kes joined #mojo
09:39 Sebbe jberger: In case you haven't gotten the link to the FOSDEM videos, it looks like they've finished putting them up on https://video.fosdem.org/2017/K.4.201/ (the videos are of all the talks in that room; the videos are a mix of Ruby and Perl)
09:40 bjakubski and it works, BUT if exception thrown was Exception::Class then it will get "converted" to Mojo::Exception
09:40 bjakubski and trace seems to be lost
09:42 bjakubski (which is my concern). If exception is not an object then Mojo::Exception is ->throw when converting (which implies ->trace) and M::Exception will gather and store trace
09:44 bjakubski I guess my question is - how to globally catch all exceptions with access to original exception in Mojolicious?
09:44 Dandre joined #mojo
09:52 sugar joined #mojo
10:03 rshadow joined #mojo
10:07 sugar joined #mojo
10:09 rshadow joined #mojo
10:46 irqq joined #mojo
10:47 dotan_convos joined #mojo
10:57 inokenty joined #mojo
11:24 sugar joined #mojo
11:59 marty joined #mojo
12:19 tchaves joined #mojo
12:19 sri tardisx: yea, don't disagree an efficient proxy plugin would be valuable
12:23 litwol question.. i'm always a little skeptical at claims of 'efficiency' or 'performance' of various languages that provide internal servers. for example php providing a server nowadays. nodejs acting as a server... in mojo's case we have perl and mojolicious offering server.
12:23 litwol i have absolutely 0 facts to back that up with
12:23 litwol and i dont know how to effectively measure it
12:24 litwol my bias is to always use nginx for front-end static server with proxy requests to dynamic things.
12:24 sugar joined #mojo
12:24 litwol i was surprised to see that mojo offers static asset servering as part of its server..
12:24 litwol how comparable are they?
12:24 sri you have to differentiate between different types of servers first, app servers and general purpose web servers are very differnt beasts
12:26 sri mojolicious being event driven means  you *can* use resources much more efficiently than with old school technologies where one process can only handle one request at a time
12:26 litwol not sure how to make that distinction.
12:27 sri nginx is a general purpose web server, you'd use it as a reverse proxy and to serve static files
12:27 sri hypnotoad is an app server
12:29 litwol without getting into binary vs scripting languages (im assuming perl compiles into binary on first run, then stays "as fast as binary" for as long as process is running)
12:30 litwol could hypnotoad be as fast for static serving as general purpose server?
12:30 litwol i'm not sure what the difference is, from consumer perspective, between general purose server and app server within context of serving static files.
12:33 rshadow joined #mojo
12:36 sri perl does compile to bytecode when you run it, but it will never be as fast as hand optimized C code, not even close
12:37 sri for web apps the bottleneck is rarely raw execution speed though
12:38 sri (bytecode that gets interpreted i should clarify i suppose)
12:41 sugar joined #mojo
13:25 sugar joined #mojo
13:33 zivester joined #mojo
13:33 rshadow joined #mojo
13:35 blonewolfs joined #mojo
13:40 hartenfels joined #mojo
14:23 Ryoga joined #mojo
14:25 Pyritic joined #mojo
14:33 rshadow joined #mojo
14:33 * jberger catches up
14:33 jberger marcus: yeah, we discussed that sparrow system a while back
14:33 jberger https://irclog.perlgeek.de/mojo/2016-03-09#i_12158728
14:33 jberger I'd especially encourage a reading of the linked github issues on mojo and kelp
14:38 jberger I've gotten to the point of, if you want deployment management start with ansible
14:39 jberger if you really want programmatic vs declarative or if you have a strong preference to use a Perl-based tool then use Rex
14:39 sugar joined #mojo
14:41 jberger Sebbe: thanks, yes I have seen that more videos went up
14:41 gryphon joined #mojo
14:41 jberger I watched stevan's with great excitement
14:42 Sebbe Yeah, I was pretty excited, too.
14:53 jberger its been fun watching his work on this progress
14:59 Jonis C/w 4
14:59 jberger sri: do you think that it could be a general purpose proxy? ie would I be able to use it for a TCP<->websocket relay?
14:59 jberger and still reuse that same code (ie handling backpressure) for proxies like the poster on the mailing list needs?
14:59 jberger if so, perhaps I could be persuaded
15:00 jberger I've been meaning to brush up my websocket vnc relay to put on cpan
15:00 jberger (not sure when I'll find the time to do it)
15:03 gizmomathboy joined #mojo
15:04 jnap sri: the rPerl fork actually compiles to optimized code which for some set of things is much faster.  I keep trying to understand it well enough to do something more useful...
15:04 jnap for math stuff its way fast but not sure any of that translates usefully to the types of bottlenecks we get with web application stuff
15:06 Dandre joined #mojo
15:10 jberger jnap: it is my understanding that rperl only handles a subset of the perl language/feature set
15:11 jberger is that still true?
15:11 jnap yeah
15:11 jnap well, I need to check with wil
15:11 jberger then that's a big meh from me
15:11 jberger its a cool idea
15:11 jnap but its 'if you use the subset and the extra bits to mark types we can compile to fast'
15:12 jnap the thing is is you write rPerl the regular perl compiler will accept it no problem
15:12 jnap its a little like that javascript subset thing asm.js
15:12 jberger sure, but what are the odds that a large web framework and a reasonable subset of cpan plugins will contain only that subset
15:12 jnap no evals, etc
15:12 jnap yeah well that's the thing
15:12 jnap in theory it can be a mix
15:13 jnap although there's also always Inline::C for stuff like that as well
15:13 jberger and C::Blocks and FFI::Platypus too
15:13 jberger (both relative newcomers to the field)
15:13 jnap just rPerl lets you do 'mostly perl' instead of remember C (which I often don't)
15:14 jberger actually NativeCall.pm (wrapper for FFI::Platypus) is really cute
15:14 jnap I still see it as a sort of replacement or adjunct to PDL
15:15 jberger rPerl vs PDL?
15:15 jberger maybe, but I see them filling very different spaces
15:15 jberger PDL is matrix-oriented
15:15 jnap well rPerl does the math stuff fast, so I see it as something the PDL people might be into.  But I don't piddle much so maybe I'm wrong
15:15 jberger implementing that on top of any perlish syntax will be hard
15:16 jnap I should ask Wil for examples I guess
15:16 jberger math stuff != PDL
15:16 jberger there would likely be places that rperl would out-math PDL
15:16 jberger but I doubt it would do so in matrix-oriented problems
15:30 * perlpilot doubts any of rperl is faster than PDL except for small numbers of calculations.
15:30 perlpilot (if we're strictly talking about just the mathy bits)
15:32 tchaves joined #mojo
15:33 jnap perlpilot: no idea actually.  I just like the idea of doing something with Perl that isn't stuck in 1994 or a totally alien brains rewrite
15:33 rshadow joined #mojo
15:43 sugar joined #mojo
16:00 zivester joined #mojo
16:01 disputin joined #mojo
16:07 sugar joined #mojo
16:11 Ryoga joined #mojo
16:14 Ryoga joined #mojo
16:14 Ryoga joined #mojo
16:20 jesk joined #mojo
16:20 jesk hiho
16:20 jesk I'am having hard times in understanding the mojo ioloop and callback stuff
16:22 jesk does anyone know some good resource which shows/explains these things in more beginner friendly way?
16:48 dod joined #mojo
16:51 pink_mist jesk: unfortunately I don't think there are good perl-specific help resources for understanding async programming ... you'd do best to find a good tutorial for some other language (say javascript/node), and then trying to apply the knowledge you got from there to perl, and to Mojo::IOLoop
16:52 Grinnz once i have infinite time, i still want to write a mojo guide for it
16:53 genio so, I'm hearing that we just need to annoy Grinnz enough (several times a day each) so that he's sufficiently bothered to writing a guide
16:55 pink_mist jesk: there is also an in-progress document that helps describing the ways to handle concurrent programming in perl ... but it's FAR FROM COMPLETE: https://docs.google.com/document/d/1XSrZiHP6_HrHgDEqUAfQ37NFI_65aIFAVjvM4YijbWw/edit?usp=sharing
17:08 hartenfels joined #mojo
17:23 gizmomathboy joined #mojo
17:26 sri we could really use a good introduction to async
17:27 sri so, in two weeks is suse hackweek, and i'm still not entirely sure what to work on
17:28 sri number one on my list so far is diagnostics for Mojo::Reactor::Poll, for finding slow (blocking) event handlers
17:29 sri as an alternative reactor backend or hidden behind an env var
17:29 sri MOJO_REACTOR=Mojo::Reactor::PollWithDiagnostics or MOJO_REACTOR_DEBUG=1
17:30 * pink_mist coughs * http2 * cough *
17:30 sri and it will tell you where your slowest even handlers are defined
17:30 sri pink_mist: sadly it's just one week
17:30 pink_mist crud :P
17:30 sri if it was like 8 weeks i'd give http2 a shot ;p
17:32 litwol jberger: ^ this gem requires an update http://blogs.perl.org/users/joel_berger/2013/11/writing-non-blocking-applications-with-mojolicious-part-2.html
17:33 jberger litwol: what does it need?
17:33 sri other possibilities are 1) example tests for the Mojo::Pg blog app (to make it complete), 2) unix domain socket support for our servers, 3) a blocking websocket API for Mojo::UserAgent (based on Test::Mojo), 4) Mojolicious::Plugin::StreamingProxy
17:33 jberger (my gods that series was 3 1/2 years ago)
17:34 pink_mist I do like the unix domain socket idea! =)
17:36 itaipu joined #mojo
17:37 litwol jberger: last time i oosted this link you said it needs an update. given above convo it seemed appropriate to resurface it.
17:38 jberger I guess I vaguely remember that coming up
17:38 jberger any chance you could refresh my memory by finding a log for it?
17:38 jberger irclog.perlgeek.de/mojo
17:38 litwol kk. once off phone.
17:39 sri jberger: the delay example with $delay->on(finish => sub{ would look better as my $delay = Mojo::IOLoop->delay(sub {...});
17:39 jberger I did use to like the finish event more than I do now
17:40 jberger I think I was trying to introduce delays without introducing steps
17:40 jberger yeah, steps show up in the next post
17:41 jberger I don't know if I'd make that same choice today
17:41 sri ->render_exception
17:41 sri that's broken
17:42 sri and $delay->wait unless $delay->ioloop->is_running;
17:42 sri you now just ->wait without worrying
17:43 jberger ah, that is something I would change
17:44 jberger (and yes, unconditional ->wait is amazing, use it all the time)
18:16 ferreira joined #mojo
18:31 stryx` joined #mojo
18:34 PryMar56 joined #mojo
18:37 kiwiroy joined #mojo
18:38 blonewolfs joined #mojo
18:47 litwol jberger: https://irclog.perlgeek.de/mojo/2017-01-28#i_14004890
18:47 litwol + few lines before
18:48 litwol my very first day in this channel :) https://irclog.perlgeek.de/mojo/2017-01-28#i_14004409
18:49 disputin joined #mojo
18:54 sh14 joined #mojo
18:56 jberger litwol: wow, that wasn't as long ago as I thought
18:56 jberger my memory seems to be going :o
18:58 pink_mist jberger: yeah, litwol is pretty new here =)
19:02 rshadow joined #mojo
19:02 itaipu joined #mojo
19:13 irqq joined #mojo
19:22 sri joined #mojo
19:23 chansen joined #mojo
19:24 stryx` joined #mojo
19:24 SmokeMachine joined #mojo
19:26 phillipadsmith joined #mojo
19:33 rshadow joined #mojo
19:35 mrallen1 joined #mojo
19:47 tchaves joined #mojo
19:54 rshadow joined #mojo
19:54 bjakubski joined #mojo
20:11 Grinnz joined #mojo
20:17 Eke joined #mojo
20:24 kiwiroy joined #mojo
21:16 ferreira joined #mojo
21:17 sugar joined #mojo
22:14 stryx` joined #mojo
22:36 diegok joined #mojo
22:37 ferreira I am writing some code which reads lines from a file in a non-blocking fashion while doing non-blocking operations. But it turns out all lines are read before any of the other callbacks happen. Can someone point what i am doing wrong at this contrived example? https://gist.github.com/aferreira/4568d226fcd45a39696cbd9e782de326
22:42 jberger ferreira: the file is in memory
22:43 jberger so of course it reads in all at once
22:43 jesk I'am not sure if my problem is understanding asynch
22:43 jesk its more the documentation of ioloop::delay and stuff like that
22:43 jberger jesk == ferreira ?
22:44 ferreira jberger: I am here - it is quite obvious now that you said it
22:44 jberger for the purposes of that example, the lines are going to be read in
22:45 jberger * synchronously
22:45 jesk iodelay::delay::begin is explaind with 4 sentences
22:45 jberger and the nonblocking get requests are effectively queued
22:45 jesk thats not verbose
22:45 jesk you must be perl hacker to get into that
22:45 jberger jesk: are you commenting on ferreira's question or are you asking something else?
22:46 jesk some hours back I asked about some better documentation
22:46 jesk and now commented to the answers I received
22:46 jberger jesk: class documentation is reference not tutorial
22:47 jberger see this instead: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-non-blocking-operations
22:48 jesk similar quality
22:48 jesk not for me
22:48 ferreira jberger: Do I have some way to yield control to the IOLoop do something else? or is just that I haven't understood yet what it takes to do non-blocking programming :-/
22:48 jberger ferreira: perhaps it is helpful to note that the loop doesn't advance because of Mojo::EventEmitter events being called
22:48 jberger events are synchronous
22:48 jesk I investigated now 2 days to understand that stuff
22:48 jesk without success
22:48 jberger jesk: are you just generally complaining about the documentation?
22:48 jberger and meanwhile interrupting a productive conversation I'm having with ferreira ?
22:48 jesk no, as said I asked for better documentation
22:49 jesk and now commenting about the answers I received
22:49 jesk thats IRC, its working like that, its not realtime all the time
22:49 jesk sorry for disturbing
22:49 purl How wude
22:50 bpmedley jesk : I got here a little late, do yo have some example code we can discuss?  I'm not seeing any code referenced in my buffer history..
22:50 jberger ferreira: you could of course add a Mojo::IOLoop->next_tick(sub{ ... }) in your event callbacks
22:50 jberger hmmm, no, nevermind
22:51 jberger wrong way around
22:51 jesk thats because I'am not able to generate code, and normally I try to understand stuff in theory before I try to produce code
22:51 Grinnz jesk: i don't think anyone claimed that mojo's documentation on async is complete, rather the opposite, so now it just sounds like you're complaining
22:51 jesk yes i'am complaining
22:51 Grinnz well that doesn't accomplish anything
22:52 jesk it does
22:52 Grinnz except make us less likely to help you with problems
22:52 jesk without hearing users things won't change
22:52 jberger jesk: I know you're looking for something to teach you nonblocking code patterns, but that is beyond the scope of mojolicious' documentation
22:52 Grinnz the problem was already acknowledged
22:52 jberger just like it isn't going to teach you OO or HTTP
22:52 jesk not neseccary
22:52 jberger thanks, I guess that ends the conversation nicely
22:53 jesk I'am sorry for you that you heared my criticism
22:53 jberger what criticism?
22:53 purl i guess criticism is generally defended in parody cases
22:54 jberger you want the mojo docs to teach you something, it isn't going to do that
22:54 jberger there are blog posts, some written by me, that might help
22:54 jberger there are plenty of design pattern books
22:54 jesk no thank you
22:54 jesk i just stick to something else
22:54 jesk have a good night
22:54 jberger I'm sorry you feel that way, you have a good night too
22:56 jberger ferreira: I think that given your example it is both doing what I would expect and hope it to do
22:56 jberger I want events to fire as soon as possible
22:56 jberger then since you are enqueuing non-blocking things to happen as a result they will happen later
22:57 jberger does your use-case require a different order-of-operations?
23:04 kaare joined #mojo
23:13 sri ferreira: what's the point of Mojo::IOLoop::LineReader?
23:13 sri file system i/o is always blocking
23:14 sri files are always readable and writable
23:15 Grinnz sri: i didnt think it was for files
23:15 Grinnz or, not specifically for them
23:16 sri in the example he just posted it's used that way though
23:16 marty_ joined #mojo
23:16 Grinnz when i needed a linestream in the past it was usually to read text output from ssh
23:17 sri the use of $/ also makes it look that way
23:17 * sri shrugs
23:17 Grinnz i havent looked at the code
23:18 sri for sockets and line oriented protocols i can see the use
23:36 sugar joined #mojo
23:37 stryx` joined #mojo
23:39 ferreira sri: I am yet trying to wrap my head around async programming - for the particular case, LineReader was written,  it is a convenience to process stream of lines and from there to start non-blocking operations  (like accessing web pages and then storing data to databases).
23:39 ferreira However, as jberger pointed me a lot of lines will be read in a single gulp, and  in a big file, they would be many more than I want to start processing.  For example, my issue is that when I tried a similar code writing data to MongoDB, after the lines have been read, the db callbacks would fail due to connect timeouts (maybe due to too many MongoDB pending
23:42 ferreira So I am struggling to intermingling some typical blocking code (reading files) and some async stuff – in the particular case, it seems I need to find a way to fill a queue with the read lines, and block waiting for non-blocking to finish before adding more to this queu.
23:43 bpmedley ferreira : I'm somewhat confused, are these CLI programs?
23:44 ferreira yes
23:45 bpmedley ferreira : Is rl.pl still a good example?
23:46 ferreira rl.pl is very simplified - but thinking on callbacks accessing web pages and saving data to db would be more like it.
23:47 ferreira ^ my production use case
23:48 bpmedley ferreira : Which datastore/driver/wrapper are you using?
23:48 ferreira Mango for MongoDB
23:49 sri jberger: re proxy, i'm not sure, perhaps some functionality can be pushed down into Mojo::IOLoop::Stream
23:52 bpmedley ferreira : So, you're starting a CLI program and building up to a web app?
23:54 ferreira Not a web app - it is meant to run as a Minion worker - it uses the Mojo framework
23:59 bpmedley ferreira : Ok, so, taking a step back: Have you written a CLI program that uses Mojo::IOLoop->delay that merely outputs some text strings: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Concurrent-blocking-requests is a good starting point

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