Isn't it typical.  Been working on this since yesterday, but as soon as I post 
the question I find the answer·

I've changed

foreach my $line (<STDIN>) {

to

while  (<STDIN>) {
  my $line=$_;

and now it works perfectly.

On Wednesday 15 December 2010 11:19:07 Gary Stainburn wrote:
> Hi folks.
>
> I've written a small perl script that reads from STDIN, parses the data and
> inserts into a database.  It takes the output from syslog-ng and captures
> output from my firewall.
>
> I've configured syslog-ng to send output to the pipe and if I run
>
> cat /var/log/firewall/pipe
>
> I see the output as it is being generated.
>
> The program works perfectly fine if I redirect STDIN from an old log file,
> but if I run it as either
>
> firewall_monitor </var/log/firewall/pipe
>
> or
>
> cat /var/log/firewall/pipe | firewall_monitor
>
> it just sits there and does nothing.  Is there anything I need to do to the
> perl script to get it to work with the pipe?
>
> Here is the main part if the script. Even with everything else stripped,
> and justb this code it doesn't display anything.
>
> !/usr/bin/perl -w
>
> use warnings;
> use strict;
> use DBI;
>
> foreach my $line (<STDIN>) {
>   my $wline=$line;
>   print "$line\n";
> } # while STDIN
>
>
>
>
>
> --
> Gary Stainburn
> I.T. Manager
> Ringways Garages
> http://www.ringways.co.uk



-- 
Gary Stainburn
I.T. Manager
Ringways Garages
http://www.ringways.co.uk 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to