Re: stupid perl question

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
To: Steven A. DuChene, Main PLUG discussion list
Subject: Re: stupid perl question
Am 23. Jun, 2011 schwätzte Steven A. DuChene so:

moin moin,

heading out right now, so can't be detailed.

Check autoflush.

        HANDLE->autoflush(EXPR)
        $OUTPUT_AUTOFLUSH
        $|      If set to nonzero, forces a flush right away and after
every


I don't remember which CPAN module I used last year ( might have been
File::Tail ), but there was an option to set to make sure it kept the file
open to watch for new data.

ciao,

der.hans

> I am attempting to do a "tail -f" on a log file that has a new line added to it every 15 seconds.
> I need to parse and process each new line as it is added to the file.
>
> I am trying to use the following example code from cpan to see if the basic concept will
> work using File::Tail but when I run the example code below and add lines to the file
> I get nothing out.
>
> #!/usr/bin/perl
>
> use File::Tail;
> $file = File::Tail->new("/home/sad/bin/power_input_stuff.txt");
> while (defined(my $line = $file->read))
> {
>    print $line;
> }

>
>
> I am doing the following in another xterm window to add lines to the file:
>
> echo "2011:06:21:15:07:46 57 01 00 a0 04 a0 00 c3 00 a7 00 33 16 01 4e 01 00 00 00 50" >> power_input_stuff.txt
>
> but I am getting NOTHING back in the original window where the perl script is running.
>
> The above perl code is a near direct copy of the File::Tail example code on cpan so I would expect it to work.
>
> What am I doing wrong???
> --
> Steven DuChene
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>


-- 
#  http://www.LuftHans.com/        http://www.LuftHans.com/Classes/
#  In order to live free and happily, you must sacrifice boredom.
#  It is not always an easy sacrifice.
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss