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

IRC log for #mojo, 2017-05-25

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

All times shown according to UTC.

Time Nick Message
00:09 zivester joined #mojo
01:20 aborazmeh joined #mojo
01:31 PopeF joined #mojo
01:32 zivester joined #mojo
01:59 kiwiroy joined #mojo
02:03 zivester joined #mojo
02:39 tchaves joined #mojo
02:58 noganex joined #mojo
03:05 zivester joined #mojo
03:33 zivester joined #mojo
03:37 maschine joined #mojo
04:04 dboehmer joined #mojo
05:26 inokenty-w joined #mojo
05:28 zivester joined #mojo
06:28 Vandal joined #mojo
06:36 karjala_ joined #mojo
06:43 AndrewIsh joined #mojo
07:41 trone joined #mojo
07:47 aborazmeh joined #mojo
07:55 dod joined #mojo
07:57 Rofl joined #mojo
08:02 dod joined #mojo
08:13 ribasushi joined #mojo
08:42 karjala_ joined #mojo
08:46 rshadow joined #mojo
08:51 karjala_ I'm confused: is there a way to do non-block DNS resolution?
08:51 karjala_ I need to resolve 400 IPs to reverse DNS entries quite quickly (every minute)
08:52 karjala_ If there's a way, which module should I look at about it? Thanks
08:57 karjala_ (is this the recommended way? http://search.cpan.org/~mlehmann/AnyEvent/lib/AnyEvent/DNS.pm )
09:02 aborazmeh joined #mojo
09:07 Petru joined #mojo
09:08 pink_mist karjala_: Mojo::IOLoop mentions what module to use
09:08 pink_mist and no, AnyEvent is never the recommended way
09:08 purl okay, pink_mist.
09:10 pink_mist karjala_: https://metacpan.org/pod/Mojo::IOLoop
09:10 pink_mist karjala_: read the description
09:13 praxilian joined #mojo
09:16 karjala_ pink_mist, I see. 2 or 3 modules are described in there for non-blocking DNS resolution. But would I have to write a wrapper around them to be able to use them with Mojo::IOLoop? Or is there something ready for that purpose that I can use?
09:20 pink_mist no, only one module is described in there for non-blocking DNS resolution
09:21 pink_mist and the only thing you need to do is install it
09:21 pink_mist it will be used automatically
09:22 pink_mist as it says
09:26 karjala_ I'd like to repeat that I want to use resolve some addresses myself (under the event loop of Mojolicious), not have UserAgent or other Mojolicious modules use Net::DNS::Native
09:26 pink_mist ok, so use it
09:26 pink_mist why would you need to write some wrapper? just use it
09:27 pink_mist see how it's used by Mojolicious if you don't know how
09:39 kes joined #mojo
09:52 simbabque the docs for Mojo::Test says I can use { content =>'foo', filename=>'bar.txt' } to test a file upload with post_ok, but can I also supply an actual file from the file system without bothering to read it first?
09:53 pink_mist content => path($path)->slurp
09:54 simbabque just read http://mojolicious.org/perldoc/Mojo/UserAgent/Transactor and it says that I can put a path directly into file
09:54 simbabque I'll try that quickly, maybe the Mojo::Test doc is just misleading
09:54 pink_mist path() comes from Mojo::File
09:56 kes Hi. How to test why ./bin/app do not see my command?
09:59 Petru joined #mojo
10:01 karjala_ pink_mist, do you know if Net::DNS::Native works with CentOS's system perl (5.16.3, I believe without pthreads)?
10:02 karjala_ oh, it says in the pod, sorry
10:02 sri pink_mist: actually, Net::DNS::Native is not great for use on its own
10:06 sri it's raw getaddrinfo on a thread pool with a clunky api that just gives you a handle to watch
10:08 karjala_ Maybe there's a binary utility for Linux that does mass lookups
10:15 pink_mist sri: oh, didn't realise :/
10:16 pink_mist sri: maybe I'll try making an easier interface for it ... would naming it Mojo::IOLoop::DNS be alright?
10:16 sri no, that's too generic
10:17 sri Mojo::IOLoop::DNSNative or so perhaps
10:17 pink_mist ah, that sounds like a good name yeah =)
10:51 karjala_ Would using Minion to do the lookups (one lookup per job) sound silly to you people?
10:51 karjala_ overkill?
10:51 purl there is no such thing as overkill. there is only "not enough kill" and "enough kill" or if it's worth doing, it's worth overdoing (mythbusters) or http://thereifixedit.files.wordpress.com/2009/12/129044739191257156.jpg
10:57 stryx` joined #mojo
11:43 gregf_ joined #mojo
12:27 Armen greetings
12:32 simbabque how do I change a value in $c->config('foo') temporarily in a unit test?
12:32 simbabque can I just do $t->app->config('foo', 'bar')?
12:33 gizmomathboy joined #mojo
12:41 mishanti1 simbabque: That is one way of doing it yes. I do believe there has been some work done recently on overriding configuration during tests, though I can't remember what that was.
12:42 simbabque in catalyst I would use Sub::Override and replace the Moose accessor for the value I want to mock, but since mojo doesn't use attributes for the config value that approach does not work
12:42 mishanti1 simbabque: at $work we have been doing various things to control what kind of configuration is served, especially when testing failure-scenarios. Test::MockModule has been used there to overload the config-method.
12:43 simbabque yeah I could replace the whole config() method as well, even using sub::override (which is easier to do if you only want a little bit of stuff done)
12:43 mishanti1 Though I do think that people have issues with Test::MockModule, but I do not know what the main pain-points of using that module is.
12:43 simbabque I find its interface complicated
12:43 simbabque but it depends
12:43 mishanti1 It is definitly not intuitive. :)
12:44 simbabque I think I gave a talk explaining the differences between T::MM and S::O at some point, but that was in German and at $work and there's no video
12:44 mishanti1 But once I got into using it I actually found it quite handy. Especially being able to call ->original and get the original sub if needed.
12:46 mishanti1
12:53 gryphon joined #mojo
12:54 rshadow1 joined #mojo
12:58 mishanti1 Is it Devel::Leak people use to find leaks these days?
12:59 pink_mist Devel::Cycle or Devel::MAT I think
13:00 mishanti1 pink_mist: Thanks. I'll look into those.
13:02 mishanti1 Oh. Devel::MAT looks pretty sweet. This'll be fun.
13:02 pink_mist karjala_: I just released https://metacpan.org/pod/release/COFFEE/Mojo-IOLoop-DNSNative-0.001/lib/Mojo/IOLoop/DNSNative.pm
13:03 pink_mist karjala_: it's still very much alpha - there aren't even any real tests for it yet :P
13:07 tchaves joined #mojo
13:09 karjala_ pink_mist, thanks
13:09 karjala_ pink_mist, does it also do reverse DNS lookups?
13:10 pink_mist no
13:10 karjala_ will it ever do?
13:10 stryx` joined #mojo
13:10 pink_mist sure, since you asked, it will :P
13:10 pink_mist but not this afternoon
13:11 karjala_ ok thanks
13:11 rshadow joined #mojo
13:11 pink_mist (as long as Net::DNS::Native supports that)
13:12 zivester joined #mojo
13:12 pink_mist ... which, I'm not sure that it does, actually
13:12 jberger simbabque without arguments config returns a hash ref. You can then localize the value in your block (subtest?)
13:12 pink_mist karjala_: so it might be that it won't :(
13:17 vicash karjala_: you can use Net::Whois::Raw for that
13:23 jberger Reverse dns as in ip -> name?
13:23 pink_mist yes
13:23 jberger That's not really a thing
13:23 pink_mist sure it is
13:23 jberger Not like name -> ip
13:24 pink_mist it's a different thing, yes
13:24 pink_mist but it's certainly a thing
13:24 jberger Certainly not 1-1
13:24 mishanti1 PTR-records have been around for a while haven't they?
13:25 pink_mist karjala_: sorry, it seems Net::DNS::Native can't do reverse lookups, so can't add that functionality =(
13:27 Pyritic joined #mojo
13:29 jberger PTR records exist, but I don't think that that is what karjala_ is asking about
13:30 pink_mist I think it is
13:31 karjala_ I want the result of: host 123.45.67.89
13:31 karjala_ on Linux
13:31 karjala_ that's what I'm after
13:31 purl hmmm... after is using the map which doesn't trigger a query at all because rel_interfaces is prefetched
13:35 spicyjack jberger: reverse DNS is a thing, one of my favourite tricks is to get BIND to generate hostnames for PTR records for DHCP pools
13:35 spicyjack so if you do lookups of IP addresses in a DHCP pool, they always return a hostname
13:36 spicyjack $GENERATE 20-49 $ PTR ${0,2,x}011bac.example.com is the correct BIND magick for that
13:36 spicyjack the IP address is encoded in the hostname, with the octets reversed
13:44 Janos joined #mojo
13:44 gregf_ joined #mojo
14:00 maschine joined #mojo
14:05 vicash karjala_: a single IP address can host multiple domains. so IP -> domain is a one-to-many relationship. It is quite difficult to get it right.
14:06 Rofl If you have many names pointing at your IP, the reverse should be the hostname of the computer. Having multiple reverses just means DNS will RR them.
14:15 dod joined #mojo
14:21 simbabque jberger: thanks, I didn't think of that it would return a hash ref, that's exactly what I was looking for
14:33 jberger ok then, re karjala I stand corrected
14:33 jberger simbabque: cool, glad that works for you
14:36 Pyritic joined #mojo
14:36 Rofl Say, is there anything for bridging events out of a mojo app and onto some kind of message router?
14:41 spicyjack Rofl: https://metacpan.org/pod/Mojo::Pg::PubSub?
14:46 kaare_ joined #mojo
14:50 zivester joined #mojo
14:52 jberger Rofl: Mojo::Pg and Mojo::Redis2 both have message brokering, also Mercury is a websocket-based message broker
15:19 mas joined #mojo
15:23 zivester joined #mojo
15:25 PryMar56 joined #mojo
15:25 mas New to async.  I need to poll an external api for a response every X seconds from within an event handler.  The event handler shouldn't be called again until I get a "done" response.  Is there a preferred way to achieve this?
15:26 pink_mist I don't think there's any sane way to stop people from calling your event handler
15:26 pink_mist that sounds very odd
15:27 pink_mist I may well be mistaken though
15:27 mas yeah, I'm not sure I'm doing it right...
15:29 mas I've got one recurring timer polling one api.  When it gets results it emits a event to a handler that syncs to a 2nd api.  I need to to poll that second api for job completion.
15:30 pink_mist perhaps you want to implement a job queue?
15:30 pink_mist in that case have a look at Minion
15:30 mas The problem is I don't want to pile up jobs if that 2nd api takes too long to complete.
15:30 mas oh. ok
15:32 mas If I sleep from within an event handler, the whole process sleeps, right?  It doesn't pass control back to the loop?  I think I'm too used to threads.
15:32 pink_mist NEVER sleep in async programs
15:32 pink_mist NEVER
15:32 mas I thought not.
15:33 mas is there a way to pass control back for a time period, like "come back and check on me in a few seconds"?
15:34 pink_mist callbacks and/or delays
15:37 mas Can I call a delay from within a running loop?
15:37 pink_mist unsure what you mean
15:38 pink_mist really though, you should take a look at Minion
15:38 mas thanks
15:46 Kundun joined #mojo
15:46 meredith joined #mojo
16:30 Ryoga joined #mojo
16:36 dod joined #mojo
16:53 kes joined #mojo
17:11 Pyritic joined #mojo
18:02 Pyritic joined #mojo
18:06 Kundun joined #mojo
18:08 rshadow joined #mojo
18:12 rshadow joined #mojo
18:51 Pyritic joined #mojo
18:53 maschine joined #mojo
19:02 jberger sri: if we are definitely holding on to the $ua but get an error here: https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L334
19:02 jberger can
19:02 jberger can't call write on undefined
19:03 jberger and it happens after a fairly long time of making repeated requests to the same host
19:03 jberger so it seems to me that the connection has gone away but something still thinks its there
19:04 jberger is it possible that there is a bug in the keep-alive handling or something?
19:04 jberger basically imagine our code is a very long running loop that posts to the same url every 10s
19:05 jberger and after many hours we start getting exceptions there
19:36 coolo sri: https://plus.google.com/u/0/photos/photo/104257421720370350735/6421873356559531490?icm=false - this sounds like you, sorry :)
20:01 disputin joined #mojo
20:02 disputin1 joined #mojo
20:02 disputin joined #mojo
20:50 itaipu joined #mojo
20:59 tchaves joined #mojo
21:06 stryx` joined #mojo
22:00 kgoess what's the best way to composite some methods into my mojo controller class?
22:00 kgoess just import the function?
22:01 preaction Role::Tiny should work too
22:04 kgoess perfect, t hanks
22:04 pink_mist tom hanks? :P
23:40 castaway joined #mojo

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