NAME POE::Component::Client::NTP - A POE Component to query NTP servers SYNOPSIS use strict; use warnings; use POE qw(Component::Client::NTP); use Data::Dumper; my $host = shift or die "Please specify a host name to query\n"; POE::Session->create( package_states => [ main => [qw(_start _response)], ], ); $poe_kernel->run(); exit 0; sub _start { POE::Component::Client::NTP->get_ntp_response( host => $host, event => '_response', ); return; } sub _response { my $packet = $_[ARG0]; print Dumper( $packet ); return; } DESCRIPTION POE::Component::Client::NTP is a POE component that provides Network Time Protocol (NTP) client services to other POE sessions and components. NTP is a protocol for synchronising the clocks of computer systems over data networks and is described in RFC 1305 and RFC 2030. The code in this module is derided from Net::NTP by James G. Willmore CONSTRUCTOR "get_ntp_response" Takes a number of options, only those marked as "mandatory" are required: 'event', the event to emit when completed, mandatory; 'session', provide an alternative session to send the resultant event to; 'host', the name/address of the NTP server to query, default is 'localhost'; 'port', the UDP port to send the query to, default is 123; 'timeout', the number of seconds to wait for a response, default is 60 seconds; The "session" parameter is only required if you wish the output event to go to a different session than the calling session, or if you have spawned the poco outside of a session. OUTPUT EVENT This is generated by the poco. "ARG0" will be a hash reference with the following keys: 'response', this will be a HASHREF on success; 'error', on failure this will be defined, with an error string; The "response" hashref will contain various parts of the NTP response packet as outlined in RFC1305. Like Net::NTP some of the data will be normalised/humanised, such as timestamps are in epoch, NOT hexidecimal. An example: 'Root Delay' => '0.001220703125', 'Version Number' => 3, 'Precision' => -19, 'Leap Indicator' => 0, 'Transmit Timestamp' => '1239808045.86401', 'Receive Timestamp' => '1239808045.86398', 'Stratum' => 2, 'Originate Timestamp' => '1239808045.24414', 'Reference Timestamp' => '1239807468.92445', 'Poll Interval' => '0.0000', 'Reference Clock Identifier' => '193.79.237.14', 'Mode' => 4, 'Root Dispersion' => '0.0000' AUTHOR Chris "BinGOs" Williams Derived from Net::NTP by James G. Willmore LICENSE Copyright © Chris Williams and James G. Willmore. This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details. SEE ALSO Net::NTP POE