Thanks for the reply, sorry if this seems confusing.

This is my first go at using event loops so I am slowly grasping the concepts and how to implement it, but i'm struggling a little, so I'm not even sure if i'm doing this properly. The main reason I started with this, was to develop a simple perl ICMP monitoring plugin for another application that would be able to ping different sets of many hosts, very quickly, across different, possibly overlapping schedules. E.g 192.168.1.x every 2 minutes and 192.168.2.x every 5 minutes. I've tried various methods and the AnyEvent::Ping module seems to be the best option for performance for asynchronous. To answer your questions:

1. I used IO::Async::Timer::Periodic to give me an extra option on scheduling the code execution. I didn't realise that i needed AnyEvent::Impl::IOAsync, i've done some more reading and understand this now, so thanks.

2. This is just test code, so in reality the intention is to invoke AnyEvent::Ping on different sets of hosts and different schedules, however I'm not sure how I get around the fact that AnyEvent::Ping is blocking. I just didn't bother to create another subnet as I'm still trying to understand how I will get this to work. So just ignore that for now.

3. Yes I'm aware of that, thats me testing on how the reschedule option in Periodic works, i.e. the ping bomb you're talking about, so just ignore that for now. If this is not the best approach to achieve this then I'm open to alternatives. I also looked at using Threads but its very CPU/memory intensive compared to AnyEvent::Ping. I'm testing this on Windows using Strawberry Perl if thats relevant.

Thanks! Mike


In reply to Re^2: Implementing AnyEvent::Ping multiple times by mmoorreett
in thread Implementing AnyEvent::Ping multiple times by mmoorreett

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.