Re: tail -f does not exit

2004-05-19 Thread Claude
Rob == Rob Dixon [EMAIL PROTECTED] writes: I got your code running nicely, although I had to make a small change due to an older Perl (5.004) I am using: [...] Rob You need to close and reopen the file if you want to check for a rename. Rob Something like the program below. Which actually

Re: tail -f does not exit

2004-05-14 Thread Rob Dixon
Claude [EMAIL PROTECTED] wrote: I am reading continuously a file like this: open LOG, junk.txt or die Cannot open $file, $!\n; while ( my $line = LOG ) { print $line; } While appending lines to the file from a shell command line: $ echo this is a new line junk.txt

Re: tail -f does not exit

2004-05-14 Thread Claude
Rob == Rob Dixon [EMAIL PROTECTED] writes: [...] Rob You need to close and reopen the file if you want to check for a Rob rename. Something like the program below. [...] Tx, Rob, I'll give feedback soon here! -- Claude -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: tail + count

2003-01-12 Thread Mark Goland
if (!$ARGV[0]){ die(you've forgotten to enter the file name\n); } if (!$ARGV[1]) { $n = 9; # output 10 rows by default } else { $n = $ARGV[1]-1; } what if the user enters, script.pl 8 ??? This wil try to open a file 8 and dump last 9 lines of it. if( $#ARGV !=

Re: tail + count

2003-01-11 Thread John W. Krahn
Mrtlc wrote: I wrote the following script as a windows tail + count function, but it's too slow if the input is huge, how can it be improved? if (!$ARGV[0]){ die(you've forgotten to enter the file name\n); } if (!$ARGV[1]) { $n = 9; # output 10 rows by default } else

Re: tail + count

2003-01-11 Thread Rob Dixon
Hi John John W. Krahn [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... @ARGV == 2 and my $n = pop || 10; $n will be undefined if @ARGV != 2. Need something like: $n = @ARGV == 2 ? pop : 10; Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: tail -f with cgi

2002-07-12 Thread zentara
On Fri, 12 Jul 2002 08:24:55 -0400, [EMAIL PROTECTED] (Fliptop) wrote: Max Clark wrote: I am trying to write a cgi program to tail -f a log file. I have a perl script that will open and print the log file, however it closes as soon as it reads whatever is in the file at that particular time.

Re: tail -f with cgi

2002-07-12 Thread Shawn
- Original Message - From: Max Clark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 11, 2002 6:43 PM Subject: tail -f with cgi Hi, Hello Max, I am trying to write a cgi program to tail -f a log file. I have a perl script that will open and print the log file,

RE: tail -f with cgi

2002-07-12 Thread Bob Showalter
-Original Message- From: Max Clark [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002 7:44 PM To: '[EMAIL PROTECTED]' Subject: tail -f with cgi Hi, I am trying to write a cgi program to tail -f a log file. I have a perl script that will open and print the log file,

RE: tail -f with cgi

2002-07-12 Thread Camilo Gonzalez
Alright, what's a tail -f? -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:09 AM To: 'Max Clark'; '[EMAIL PROTECTED]' Subject: RE: tail -f with cgi -Original Message- From: Max Clark [mailto:[EMAIL PROTECTED]] Sent: Thursday

Re: tail -f with cgi

2002-07-12 Thread Shawn
- Original Message - From: Bob Showalter [EMAIL PROTECTED] To: 'Max Clark' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 12, 2002 11:08 AM Subject: RE: tail -f with cgi -Original Message- From: Max Clark [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002

RE: tail -f with cgi

2002-07-12 Thread Bob Showalter
-Original Message- From: Shawn [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 12:29 PM To: Bob Showalter; 'Max Clark'; [EMAIL PROTECTED] Subject: Re: tail -f with cgi - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: 'Max Clark' [EMAIL PROTECTED

RE: tail -f with cgi

2002-07-12 Thread Max Clark
I found the file::tail module on cpan... #!/usr/bin/perl -w use File::Tail; my $log = /usr/local/apache2/logs/access_log; $file=File::Tail-new ( name=$log, interval=2, maxinterval=10 ); while (defined($line=$file-read)) { print $line; } It does exactly what

Re: Tail call optimization

2002-06-05 Thread Jenda Krynicky
From: Tagore Smith [EMAIL PROTECTED] Thanks :). That's great. I don't use goto much, except for a couple of very specific situations, so I hadn't read the docs for goto. It seems I missed a very interesting beast in goto NAME. In fact , I sent a friend of mine some code

Re: Tail call optimization

2002-06-03 Thread Tagore Smith
Jenda Krynicky wrote: I believe they meant goto NAME. illuminating example snipped This way perl doesn't create a new record in the call stack every time you call the _fib(). As you can see if you comment out the return in fib_() and remove the comment from croak ... and use Carp;.

Re: Tail call optimization

2002-06-02 Thread Jenda Krynicky
From: Tagore Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject:Tail call optimization Date sent: Tue, 28 May 2002 23:42:30 -0400 I came across this statement on the web: Perl ... supports the tail-call optimization

RE: TAIL

2002-03-13 Thread Nikola Janceski
grep in perl doesn't work exactly same way as grep in *nix. It functions differently in perl, and has better uses in perl that the *nix's grep can't do. perldoc -f grep -Original Message- From: James Taylor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 3:06 PM To: [EMAIL

Re: TAIL

2002-03-13 Thread Jonathan E. Paton
Is there a perl function equivalent to the *nix command 'tail'? Here is a basic Perl implementation of tail: #!/usr/bin/perl @a=;print@a[-10,-1]; IIRC there is a shorter way to do it, but that'd mean going back over the FWP mailing list archives. I don't mean like, a workaround through

Re: TAIL

2002-03-13 Thread Jim Conner
I suggest: File::Tail if you are wanting to something like tail -f, though. Works like a champ. - Jim At 06:09 03.14.2002 +, Jonathan E. Paton wrote: Is there a perl function equivalent to the *nix command 'tail'? Here is a basic Perl implementation of tail: #!/usr/bin/perl