Hello,
I am trying to capture counts of the lines seen on a
POE::Component::Client::TCP session at three different intervals.
POE::Session->create
(inline_states =>
{
_start => \&init,
_stop => \&shutdown,
Timer_10 => \&count_sec,
Timer_60 => \&count_min,
Timer_3600 => \&count_hour,
p_input => \&count_seen,
}
);
POE::Component::Client::TCP->new (
RemoteAddress => "emporia.int.westgroup.net",
RemotePort => "55075",
ServerInput => \&srv_input,
Disconnected => \&discon,
);
$poe_kernel->run();
exit 0;
sub init {
my ($session,$heap) = @_[SESSION, HEAP];
$heap->{int_session} = $session;
$heap->{cnt_10} = 0;
$heap->{cnt_60} = 0;
$heap->{cnt_3600} = 0;
$heap->{iter_10} = 0;
$heap->{iter_60} = 0;
$heap->{iter_3600} = 0;
$_[KERNEL]->delay ('Timer_10', 10);
$_[KERNEL]->delay ('Timer_60', 60);
$_[KERNEL]->delay ('Timer_3600', 3600);
}
sub srv_input {
$heap->{cnt_10}++;
$heap->{cnt_60}++;
$heap->{cnt_3600}++;
print SYSINFO $input . "\n";
}
sub count_sec {
my ($session,$heap) = @_[SESSION, HEAP];
$_[KERNEL]->delay('Timer_10', 10);
my $sec_count = $heap->{cnt_10};
my $sec_iter = $heap->{iter_10};
print POETLOG "10 Second Iteration: $sec_iter Count: $sec_count\n";
$heap->{cnt_10} = 0;
$heap->{iter_10}++;
}
svr_input is updating the heap that belongs to the PoCo, I would like to
update the heap from the session that controls the timers.
So there are two ways to do it, update a the timer heap from the PoCo,
or access the PoCo heap information from the timer session. I know
getting the information is the better way, but I can not figure out how
to access the ifromation.
Can someone give me a clue?
Thanks,
Jeff
Jeff Konz
Thomson Legal & Regulatory
Technical Services - EMAT
651.687.5090