Yes they work very well. Now there's the second part of the problem:
I need the read non-blocking of check if there's any
data ready before doing the 'sysread()'.
The complete consumer is a program that reads account
packets from a radius server (this problem has been solved)
and stores the Radius attributes (MAC,IP,User_name) in a
List of Hashes. This list of hashes has to be processed
every 60 seconds.
The consumer only reads from stdin in order to add new
packets to the listofHashes.
Here there's the consumer that works with:
#cat accounts| ./consumer.pl
where accounts has:
MAC1;IP1;USer1
MAC2;IP2;USer2
#consumer.pl
#!/usr/bin/perl -w
my (%account,@accountList,@accountListTemp);
while(1){
my (@lines,$line,@values);
sleep(60);
@lines = <STDIN>;
foreach $line (@lines){
#MAC;IP;User_Name\n
chomp($line);
@values = split ';',$line;
$account{"MAC"} = $values[[0]];
$account{"IP"} = $values[1];
$account{"Name"} = $values[2];
push @accountList, {%account};
}
my $i;
for $i (0 .. $#accountList){
#Process @accountList <-- IMPORTANT !!
}
}
In reply to Re^2: Read from a Linux pipe hangs.
by dmor4477
in thread Read from a Linux pipe hangs.
by dmor4477
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |