ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-SNMP/README
(Generate patch)

Comparing cvsroot/AnyEvent-SNMP/README (file contents):
Revision 1.1 by root, Mon Dec 3 17:27:38 2007 UTC vs.
Revision 1.2 by root, Tue Mar 31 22:39:40 2009 UTC

1NAME 1NAME
2 Net::SNMP::EV - adaptor to integrate Net::SNMP into the EV event loop. 2 AnyEvent::SNMP - adaptor to integrate Net::SNMP into Anyevent.
3 3
4SYNOPSIS 4SYNOPSIS
5 use EV; 5 use AnyEvent::SNMP;
6 use Net::SNMP; 6 use Net::SNMP;
7 use Net::SNMP::EV;
8 7
9 # just use Net::SNMP and EV as you like: 8 # just use Net::SNMP and AnyEvent as you like:
10 9
11 ... start non-blocking snmp request(s)... 10 # use a condvar to transfer results, this is
11 # just an example, you can use a naked callback as well.
12 my $cv = AnyEvent->condvar;
12 13
13 EV::loop; 14 # ... start non-blocking snmp request(s)...
15 Net::SNMP->session (-hostname => "127.0.0.1",
16 -community => "public",
17 -nonblocking => 1)
18 ->get_request (-callback => sub { $cv->send (@_) });
19
20 # ... do something else until the result is required
21 my @result = $cv->wait;
14 22
15DESCRIPTION 23DESCRIPTION
16 This module coerces the Net::SNMP scheduler to use the EV high 24 This module implements an alternative "event dispatcher" for Net::SNMP,
17 performance event loop as underlying event loop, i.e. EV will be used by 25 using AnyEvent as a backend.
18 Net::SNMP for all events.
19 26
20 This integrates Net::SNMP into EV: You can make non-blocking Net::SNMP 27 This integrates Net::SNMP into AnyEvent: You can make non-blocking
21 calls and as long as your main program uses the EV event loop, they will 28 Net::SNMP calls and as long as other parts of your program also use
22 run in parallel to anything else that uses EV or AnyEvent. 29 AnyEvent (or some event loop supported by AnyEvent), they will run in
30 parallel.
31
32 Also, the Net::SNMP scheduler is very inefficient with respect to both
33 CPU and memory usage. Most AnyEvent backends (including the pure-perl
34 backend) fare much better than the Net::SNMP dispatcher.
35
36 A potential disadvantage is that replacing the dispatcher is not at all
37 a documented thing to do, so future changes in Net::SNP might break this
38 module (or the many similar ones).
23 39
24 This module does not export anything and does not require you to do 40 This module does not export anything and does not require you to do
25 anything special apart from loading it. 41 anything special apart from loading it *before doing any non-blocking
26 42 requests with Net::SNMP*. It is recommended but not required to load
27 The module is quite short, you cna use it to do a similar integration 43 this module before "Net::SNMP".
28 into e.g. Event or other event loops.
29
30BUGS
31 Net::SNMP has no (documented or otherwise) API to do what this module
32 does. As such, this module rummages around in the internals of Net::SNMP
33 in a rather inacceptable way, and as thus might be very sensitive to the
34 version of Net::SNMP used (it has been tested with some 5.x versions
35 only, YMMV).
36 44
37SEE ALSO 45SEE ALSO
38 EV, Net::SNMP, AnyEvent, Glib::EV. 46 AnyEvent, Net::SNMP, Net::SNMP::EV.
39 47
40AUTHOR 48AUTHOR
41 Marc Lehmann <schmorp@schmorp.de> 49 Marc Lehmann <schmorp@schmorp.de>
42 http://home.schmorp.de/ 50 http://home.schmorp.de/
43 51

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines