Hi,
I'm using POE::Component::Client::Ping (1.11), and I'm having difficulty
passing user data from as ping as per the documentation :
use POE::Component::Client::Ping ":const";
# Post an array ref as the callback to get data back to you
$kernel->post("pinger", "ping", [ "pong", $user_data ]);
# use the REQ_USER_ARGS constant to get to your data
sub got_pong {
my ($request, $response) = @_[ARG0, ARG1];
my $user_data = $request->[REQ_USER_ARGS];
...;
}
My code (extract) is :
my $test_data = 'Hello';
$kernel->post( 'pinger', # Post the request to the 'pinger'.
'ping', # Ask it to 'ping' an address.
['pong', $test_data], # Have it post an answer to my
'pong' state.
$ip_address, # This is the address we want it to ping.
$timeout, # This is the optional time to wait.
$retry, # number of retries
);
...later :
sub _got_pong {
my ($kernel, $session, $heap, $request_packet, $response_packet) =
@_[KERNEL, SESSION, HEAP, ARG0, ARG1];
my ($request_address, $request_timeout, $request_time, $user_data) =
@{$request_packet};
my ($response_address, $roundtrip_time, $reply_time) =
@{$response_packet};
print Dumper $request_packet;
The $request_packet dump does not show any $user_data content at all. The
first 3 parameters are OK ($request_address, $request_timeout,
$request_time), but there is no 4th parameter ($user_data).
I've tried the 'my $user_data = $request->[REQ_USER_ARGS];' approach
suggested in the doc, but no joy, as there is nothing beyond the first 3
params in $request_packet;
Anyone got any pointers on this, or is there maybe an issue in this area ?
Regards
Nigel.