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
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
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
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 !=
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
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
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.
- 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,
-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,
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
- 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
-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
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
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
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;.
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
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
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
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
19 matches
Mail list logo