Hi Jim,
On Fri, Jan 11, 2013 at 1:54 PM, Jim Gibson wrote:
> OR
>
> print_path( $id, $routes->{$id} );
> ...
> sub print_path
> {
> ...
> while( my ($start, $end) = each %$edges ) {
>
>
This is what i want, thank you!
Apparently passing "$routes->{$id}" is my earlier issue.
--budi
On Jan 10, 2013, at 7:33 PM, budi pearl wrote:
> Hi All,
>
> I would like to pass hash: %{$routes{"ROUTE-252"}} instead of %routes but
> got this error:
>
> [budi@dev bin]$ ./print_path.pl
> Type of arg 1 to each must be hash (not hash element) at
> ./print_path.plline 38, near "}) "
> Executio
On Fri, Jan 11, 2013 at 11:05 AM, budi pearl wrote:
> Hi Shawn,
>
> When trying to accessed inside subroutine , i got:
>
> Type of arg 1 to each must be hash (not hash element) at ./print_path.plline
> 41, near "}) "
>
> Execution of ./print_path.pl aborted due to compilation errors.
>
>
> this
Hi Shawn,
When trying to accessed inside subroutine , i got:
Type of arg 1 to each must be hash (not hash element) at
./print_path.plline 41, near "}) "
Execution of ./print_path.pl aborted due to compilation errors.
this is work:
while (my ($start, $end) = each %{$routes{$label}}) {
but thi
On Fri, 11 Jan 2013 10:33:02 +0700
budi pearl wrote:
> my $id = "ROUTE-252";
> print Dumper $routes{$id};
>
> print_path($id, \%{$routes{$id}});
I think you want:
print_path( $id, $routes{$id} );
--
Don't stop where the ink does.
Shawn
--
To unsubscribe, e-mail: beginners-unsubs
Hi All,
I would like to pass hash: %{$routes{"ROUTE-252"}} instead of %routes but
got this error:
[budi@dev bin]$ ./print_path.pl
Type of arg 1 to each must be hash (not hash element) at
./print_path.plline 38, near "}) "
Execution of ./print_path.pl aborted due to compilation errors.
#use
Hi Rob,
This works and looks much more simpler. Thanks, i love it.
--budhi
On Fri, Jan 11, 2013 at 1:00 AM, Rob Dixon wrote:
> On 10/01/2013 10:01, budi perl wrote:
>
>> Hi,
>>
>> I have this following hash:
>>
>> #!/usr/bin/perl
>> #
>> use strict;
>> use Data::Dumper;
>>
>> my %MYROUTES = (
On 10/01/2013 10:01, budi perl wrote:
Hi,
I have this following hash:
#!/usr/bin/perl
#
use strict;
use Data::Dumper;
my %MYROUTES = (
"ROUTE-252" => {
# src => dest
427 => "ABEP",
"ABEP" => 441,
441 => 427,
427 => 444,
444 => "MGWQ",
On Thu, Jan 10, 2013 at 5:19 PM, David Precious wrote:
> On Thu, 10 Jan 2013 17:01:43 +0700
> budi perl wrote:
> You can't have the same hash key twice; you've duplicated 427 there.
>
> Also, you don't need to quote the left side of a fat comma, so you can
> just as easily say e.g. ABEP => 441.
>
On Thu, 10 Jan 2013 17:01:43 +0700
budi perl wrote:
> Hi,
>
> I have this following hash:
>
> #!/usr/bin/perl
> #
> use strict;
> use Data::Dumper;
>
> my %MYROUTES = (
> "ROUTE-252" => {
> # src => dest
>427 => "ABEP",
>"ABEP" => 441,
>441 => 427,
>427
Hi,
I have this following hash:
#!/usr/bin/perl
#
use strict;
use Data::Dumper;
my %MYROUTES = (
"ROUTE-252" => {
# src => dest
427 => "ABEP",
"ABEP" => 441,
441 => 427,
427 => 444,
444 => "MGWQ",
"MGWQ" => "CDEF"
},
"ROUTE-432" => {
thing like the
> following (untested):
>
> while(1) {
> while() {
> print;
> }
> sleep 1;
> seek(FILE,0,1);
> }
>
That does look like it might be better... and thanks for the explanation.
[...]
>>
>> use File::Tail;
>&
At 3:57 PM -0500 10/24/09, Harry Putnam wrote:
Sorry about being tricky with what was an older thread. But I suspect
that thread died... and no one noticed there was an unaswered question
still there.
Or no one knew the answer.
Shawn C originally suggested I use File::Tail. There was a
Sorry about being tricky with what was an older thread. But I suspect
that thread died... and no one noticed there was an unaswered question
still there.
Shawn C originally suggested I use File::Tail. There was a short
exchange about why and then I began trying to use File::Tail but
haven
s usually take care of special cases that you
> may not be aware of. That makes them the preferred method of solving a
> problem.
>
> In this case, the above code is a kludge. You can tell this because the
> program sleeps, rather than waiting on input. When a program does
> something
On Mon, 19 Oct 2009 23:30:30 -0500, Harry Putnam wrote:
> Shawn H Corey writes:
>
>> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
>
> Thanks that looks useful. Is there a reason why I should use that
> module as apposed to the kind of code offered in the faq a
Harry Putnam wrote:
> Shawn H Corey writes:
>
>> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
>
> Thanks that looks useful. Is there a reason why I should use that
> module as apposed to the kind of code offered in the faq about
> tail? (perldoc -q tail)
Shawn H Corey writes:
> http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm
Thanks that looks useful. Is there a reason why I should use that
module as apposed to the kind of code offered in the faq about
tail? (perldoc -q tail) as suggested by another poster (Jim G).
I mean, I
Jim Gibson writes:
> On 10/19/09 Mon Oct 19, 2009 11:38 AM, "Harry Putnam"
> scribbled:
>
>
>>
>> I'm not sure what it is about the tail -f command that allows it to
>> keep reading over restarts of system logger (on Opensolaris)... but
On 10/19/09 Mon Oct 19, 2009 11:38 AM, "Harry Putnam"
scribbled:
>
> I'm not sure what it is about the tail -f command that allows it to
> keep reading over restarts of system logger (on Opensolaris)... but
> how can I emulate whatever it is.. in perl?
>
Th
Harry Putnam wrote:
> I'm not sure what it is about the tail -f command that allows it to
> keep reading over restarts of system logger (on Opensolaris)... but
> how can I emulate whatever it is.. in perl?
Have you looked at File::Tail
http://search.cpan.org/~mgrabnar/File-Tail-
at fifo
Now restart system logger.
Now anything that sys logger produces will be displayed from the cat
command.
Now restart systemlogger again and cat closes as would a common
shell script or awk.
However the `tail -f' command will not close... it keeps on reading
through rest
叶孤城 writes:
> 2009/9/27 叶孤城 :
>> 2009/9/27 Harry Putnam :
>>> Will it make any difference in loading time or cpu resource usage to
>>> use the `tail' command like 'qx/tail -n30 $file/' as apposed to something
>>> in straight perl like
2009/9/27 叶孤城 :
> 2009/9/27 Harry Putnam :
>> Will it make any difference in loading time or cpu resource usage to
>> use the `tail' command like 'qx/tail -n30 $file/' as apposed to something
>> in straight perl like this example that prints the last 30 lin
2009/9/27 Harry Putnam :
> Will it make any difference in loading time or cpu resource usage to
> use the `tail' command like 'qx/tail -n30 $file/' as apposed to something
> in straight perl like this example that prints the last 30 lines of $log:
>
Not absolute that
Will it make any difference in loading time or cpu resource usage to
use the `tail' command like 'qx/tail -n30 $file/' as apposed to something
in straight perl like this example that prints the last 30 lines of $log:
#!/usr/local/bin/perl
use strict;
use warnings;
On Tue, Mar 24, 2009 at 10:26, Bob McConnell wrote:
snip
> As a result, installing a new module on the production server is very
> expensive. It must go through our code review and QA testing as well as
> being repackaged in the correct format for deployment. It is difficult
> to justify this expe
From: Chas. Owens
> On Mon, Mar 23, 2009 at 14:16, Amit Saxena
wrote:
>> Is it possible to implement this without using any external modules
from
>> CPAN ?
>
> The FAQ covers this quite nicely (see below). In general you should
> use File::Tail[1]. And on UNIX sys
On Mon, Mar 23, 2009 at 14:16, Amit Saxena wrote:
> Is it possible to implement this without using any external modules from
> CPAN ?
>
> Thanks & Regards,
> Amit Saxena
>
The FAQ covers this quite nicely (see below). In general you should
use File::Tail[1]. And on UNIX s
> "Amit" == Amit Saxena writes:
Amit> Is it possible to implement this without using any external modules from
Amit> CPAN ?
Is it possible? Yes. Reasonable? No.
Please state clearly your confusion about being able to include CPAN modules
in your workflow. Hint: none of the reasons you come
Is it possible to implement this without using any external modules from
CPAN ?
Thanks & Regards,
Amit Saxena
Rob Dixon wrote:
Richard Lee wrote:
when you are doing it to filehandle vs array, which consumes more
memory?
my source file is about 100,000 lines...
open my $source, 'tmp/server.txt' or die !$;
VS tie my @file, 'Tie::File', '/tmp/server.txt' or die $!;
Neither of them use any significant
and no doing head -1 /tmp/server.txt
>>> is not an option since I need to go through some other stuff
>>> before i need to issue below command )
>>>
>>> and I wanted to do
>>>
>>> my $top = `head -1 $source`
>>> my $bottom = `tail
r stuff
before i need to issue below command )
and I wanted to do
my $top = `head -1 $source`
my $bottom = `tail -1 $source`
but I realized I cannot do $source in back tick.
so I imagine i can do
my $top = chop $source;
But what about the $bottom one?
The chop() function simply r
me other stuff
> before i need to issue below command )
>
> and I wanted to do
>
> my $top = `head -1 $source`
> my $bottom = `tail -1 $source`
>
> but I realized I cannot do $source in back tick.
>
> so I imagine i can do
>
> my $top = chop $source;
>
&
ommand )
and I wanted to do
my $top = `head -1 $source`
my $bottom = `tail -1 $source`
but I realized I cannot do $source in back tick.
so I imagine i can do
my $top = chop $source;
But what about the $bottom one?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [
rtfm ^^
-Ursprüngliche Nachricht-
Von: sivasakthi [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 29. August 2007 13:16
An: beginners perl
Betreff: Re: Problem in opening the file using Tail Module
>
> File::Tail will read only lines that are added to the file after it
>
buffering at all you use syswrite and only
write 1 char at a time.)
-Ursprüngliche Nachricht-
Von: sivasakthi [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 29. August 2007 12:13
An: Jeff Pang
Cc: beginners perl
Betreff: Re: Problem in opening the file using Tail Module
i didn't get your
>
> File::Tail will read only lines that are added to the file after it has been
> opened. Your program will simply sleep until something new is added.
>
> Rob
when my log file is updated then it works correctly
thanks to all for reply
;
use warnings;
use File::Tail;
my $file=File::Tail->new("/some/log/file/path");
while (defined(my $line=$file->read))
{
print "$line";
}
Thanks,
Siva
It works for me.
Maybe you want to change one of the intervals or timeouts for
File::Tail. It could b
sivasakthi wrote:
I have used the following code to print the log files. but nothing is
printed even it doesn't show the warning message, no prompt is
returned. what is the mistake in code , could u help me to find the
pbm???
#!/usr/bin/perl
use strict;
use warnings;
use File::Tai
>:
> > Hi Guys,
> >
> > I have used the following code to print the log files. but nothing is
> > printed even it doesn't show the warning message, no prompt is
> > returned.
> > what is the mistake in code , could u help me to find the pbm???
> &
>File::Tail is waiting at least 10 second before starting to work.
if it is taking at least 10 second to start then how it is faster than
using open to access the file???
On Wed, 2007-08-29 at 11:49 +0200, Angerstein wrote:
> File::Tail is waiting at least 10 second before starting to work
message, no prompt is
> returned.
> what is the mistake in code , could u help me to find the pbm???
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use File::Tail;
> my $file=File::Tail->new("/some/log/file/path");
> while (defined(my $line=$file->
Hi Guys,
I have used the following code to print the log files. but nothing is
printed even it doesn't show the warning message, no prompt is
returned.
what is the mistake in code , could u help me to find the pbm???
#!/usr/bin/perl
use strict;
use warnings;
use File::Tail;
my $file
thought at first it might make more sense to write the backend
part of my script in PHP, but PHP lacks
http://search.cpan.org/dist/File-Tail/Tail.pm which I'd like to use for
continuous screening of a spool file.
I was hoping someone could point me in the correct direction to have
Perl prop
On May 29, 2006, at 18:19, Ken Foskey wrote:
I want to monitor a daemon's logs that updates randomly through the
day
and night. Is there a way to open the log file and read the new
records
as they come in the same way as tail -f does?
Sure, with File::Tail for example.
-- fxn
Ken Foskey wrote:
I want to monitor a daemon's logs that updates randomly through the day
and night. Is there a way to open the log file and read the new records
as they come in the same way as tail -f does?
Sure, look on cpan for File::Tail::App and File::Tail
--
To unsubscribe, e
I want to monitor a daemon's logs that updates randomly through the day
and night. Is there a way to open the log file and read the new records
as they come in the same way as tail -f does?
Thanks
Ken
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [
e the symlink get changed at 00:00.
-Original Message-
>From: "JupiterHost.Net" <[EMAIL PROTECTED]>
>Sent: Jan 15, 2006 1:04 AM
>To: beginners@perl.org
>Subject: Re: the 'tail' problem
>
>
>
>Jeff Pang wrote:
>> hi,lists,
>
>Hello
nix 'tail -f' command.Part of
the code is below:
open (TAIL,"tail -f $log|") or die "can't open pipe:$!";
while()
{
do something...
}
This script is a daemon script which run permanently.There is no problem when
in the same day.But when
I don't know why it can't work for me.
I have tested it as following:
$ln -s mssvr.log.2006-01-14 mylog
$tail --follow=name --retry mylog
Now this command output the content of mssvr.log.2006-01-14 correctly.
So I continue to excute these commands (open another terminal):
$rm -f
Jeff Pang wrote:
hi,lists,
I have a log file which is a symbol link to the real logfile,shown as following:
$ll mssvr.log
lrwxrwxrwx1 cmail root 40 Jan 14 00:00 mssvr.log ->
/home/cmail/logs/mssvr.log.2006-01-14
I have to access this file in perl script with unix '
ira <[EMAIL PROTECTED]>
> >Sent: Jan 14, 2006 7:23 PM
> >To: Jeff Pang <[EMAIL PROTECTED]>, beginners@perl.org
> >Subject: Re: the 'tail' problem
> >
> >Jeff,
> >
> >Maybe all you have to do is make some adjustments to the pipe you'
this. I also
made a few hasty tests, and if you got hard links rather symbolic
ones, it looks like "tail -F" would do the magic without hassle.
Cheers,
Adriano.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
<[EMAIL PROTECTED]>, beginners@perl.org
>Subject: Re: the 'tail' problem
>
>Jeff,
>
>Maybe all you have to do is make some adjustments to the pipe you're
>opening. Besides the well known "-f" switch, some tail's (like gnu
>tail) support "
Jeff,
Maybe all you have to do is make some adjustments to the pipe you're
opening. Besides the well known "-f" switch, some tail's (like gnu
tail) support "-F" which means a file is followed by its name and the
opening is retried from time to time. From "man
hi,lists,
I have a log file which is a symbol link to the real logfile,shown as following:
$ll mssvr.log
lrwxrwxrwx1 cmail root 40 Jan 14 00:00 mssvr.log ->
/home/cmail/logs/mssvr.log.2006-01-14
I have to access this file in perl script with unix 'tail -f' command
"Because it's up-side down.
Why is that?
It makes replies harder to read.
Why not?
Please don't top-post." - Sherm Pendley, Mac OS X list
Tielman Koekemoer (TNE) wrote:
>
> Thanks all for your input. The File::Tail package works although it
> seems to st
Thanks all for your input. The File::Tail package works although it
seems to stop working once I restart the application writing to the
logfile. I've played around with the settings but I'll have to take it
up with the author.
Thanks again!
-Original Message-
From: Chris Kni
On Thu, May 19, 2005 at 11:54:35AM +0530, Ramprasad A Padmanabhan wrote:
> use File::Tail;
>
>
> On Thu, 2005-05-19 at 11:37, Tielman Koekemoer (TNE) wrote:
> > Hi All,
> >
> > If I wanted to monitor a file in a way that would emulate "tail -f"
>
On 5/19/05, Tielman Koekemoer (TNE) wrote:
>
> Hi All,
>
> If I wanted to monitor a file in a way that would emulate "tail -f"
> (in the shell), how would I open the file?
>
> open(FILE, " filename |"); (?)
>
> TIA
>
http://perldoc.pe
use File::Tail;
On Thu, 2005-05-19 at 11:37, Tielman Koekemoer (TNE) wrote:
> Hi All,
>
> If I wanted to monitor a file in a way that would emulate "tail -f"
> (in the shell), how would I open the file?
>
> open(FILE,
Hi All,
If I wanted to monitor a file in a way that would emulate "tail -f"
(in the shell), how would I open the file?
open(FILE, " filename |"); (?)
TIA
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http:/
ething like the program below.
Which actually emulates "tail f-" nicely, since it notices a filename
change and exits, on contrary of "tail -f" which has to be killed.
Rob> use strict;
Rob> use warnings;
Rob> use IO::Handle;
Rob> autoflush STDOUT;
Rob> use Fcntl
> "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 additi
the file from a shell command line:
>
> $ echo "this is a new line" >> junk.txt
>
> Everything ok, except that I would like to find out from the Perl code
> above when junk.txt has been deleted, or renamed. Unfortunately, "tail
> -f" does not exit...
&
k.txt
Everything ok, except that I would like to find out from the Perl code
above when junk.txt has been deleted, or renamed. Unfortunately, "tail
-f" does not exit...
Any idea how to do that?
--
Claude
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
as well as dealing with logfile rotation gracefully.
> >
> > Any suggestions?
> >
>
> Check out File::Tail on CPAN, particularly the section on 'select' and
> the mentioned example script, it should get you close.
>
> http://search.cpan.org/~mgrabnar/Fil
Joel Newkirk wrote:
I'm interested in tailing two logs (qmail) simultaneously, and
interleaving the data in something approaching chronological sequence,
as well as dealing with logfile rotation gracefully.
Any suggestions?
Check out File::Tail on CPAN, particularly the section on 's
I'm interested in tailing two logs (qmail) simultaneously, and
interleaving the data in something approaching chronological sequence,
as well as dealing with logfile rotation gracefully.
Any suggestions?
j
--
"Not all those who wander are lost." - JRR Tolkien
--
To unsubscribe, e-mail: [EMA
Sudarshan Raghavan wrote:
>
> On Fri, 21 Mar 2003, NYIMI Jose (BMB) wrote:
>
> > > From: Palmer Greg [mailto:[EMAIL PROTECTED]
> > >
> > > $filename = `ls -ltr|tail -1 $DIRECTORY`;
> > > print $filename;
> >
> > Sorry, i didn'
On Fri, 21 Mar 2003, NYIMI Jose (BMB) wrote:
> > -Original Message-
> > From: Palmer Greg [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, March 20, 2003 4:50 PM
> > To: NYIMI Jose (BMB)
> > Subject: RE: Unix ls -lrt | tail -1 in Perl
> >
> >
&
> -Original Message-
> From: Palmer Greg [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 20, 2003 4:50 PM
> To: NYIMI Jose (BMB)
> Subject: RE: Unix ls -lrt | tail -1 in Perl
>
>
> $filename = `ls -ltr|tail -1 $DIRECTORY`;
> print $filename;
Sorry, i didn&
03 9:17 AM
To: Perl beginners
Subject: Re: Unix ls -lrt | tail -1 in Perl
On Thu, 20 Mar 2003, NYIMI Jose (BMB) wrote:
> Hello,
>
> How can I do this unix command in Perl ? : ls -lrt | tail -1
> Actually, i would like to get the most recent file from a given directory.
my $latest
On Thu, 20 Mar 2003, NYIMI Jose (BMB) wrote:
> Hello,
>
> How can I do this unix command in Perl ? : ls -lrt | tail -1
> Actually, i would like to get the most recent file from a given directory.
my $latest = (sort {-M $b <=> -M $a} <$dir/*>)[-1];
or
Hello,
How can I do this unix command in Perl ? : ls -lrt | tail -1
Actually, i would like to get the most recent file from a given directory.
Thanks in advance for your input.
José.
DISCLAIMER
"This e-mail and any attachment thereto may contain information which is confide
Richard Fernandez wrote:
> There's a FAQ that deals with coding a "tail -f" if you're logfile is
> on the same box as the perl script.
> But what if you want to use rsh to tail a file remotely?
>
> Here's what I have:
> --8&
There's a FAQ that deals with coding a "tail -f" if you're logfile is on the
same box as the perl script.
But what if you want to use rsh to tail a file remotely?
Here's what I have:
--8<
ry to open a file 8
and dump last 9 lines of it.
if( $#ARGV != 2){ print " usage.";exit 1;}
unless ( -f $ARGV[0] ){ print " bad file name ";exit 1;}
$n = $ARGV[1]-1 || 9;
- Original Message -
From: "Mrtlc" <[EMAIL PROTECTED]>
To: <[EMAI
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 ad
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]) {
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 defaul
Harry Putnam wrote:
> Is there a perl equivalent to the unix `tail' command? Where I could
> grab the last line from a file without having to read the whole file?
There is the module File::ReadBackwards;
# perl -MCPAN -e 'install File::ReadBackwards'
$ perldoc File::ReadB
Is there a perl equivalent to the unix `tail' command? Where I could
grab the last line from a file without having to read the whole file?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ME. In fact , I
> sent a friend of mine some code recently that would have been improved
> in one place by its use.
>
> But I still have a question :). As I understand it when tail-call
> optimization is done automatically there are two advantages. One is
> that the stack doesn&
g beast in goto &NAME. In fact , I sent a friend of mine
some code recently that would have been improved in one place by its use.
But I still have a question :). As I understand it when tail-call
optimization is done automatically there are two advantages. One is that the
stack doesn't grow
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:
>
> &
I came across this statement on the web:
>Perl ... supports the tail-call optimization (although you have to do it by
hand).
I was wondering if someone could give me an example of this. I know what
tail-call optimization means, and how to write tail-recursive functions, in
Lisp- just not s
D]
Subject: Re: Better "tail -f"
On Tuesday, April 2, 2002, at 04:30 , Bruno Figueira wrote:
> However, if another program removes (all) lines from the file referenced
> by
> FH, perl looses the trailing (for a undetermined time). How do I improve
> this code to understand
preceed it with this then:
do{
sleep 1;
} while (not -e $filename);
of course... you want a more robust tail.. that will require lots of
thought... I don't have enough to spare for this though. I have thought
about this problem before and said, "screw it, let the
it is a size thing.
if tail opened filename 'file' at size N
then process p2 truncates it with
p2 > file
tail -f file has no output till file is > N
it's not an inode thing...
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROT
On Tuesday, April 2, 2002, at 07:04 , Nikola Janceski wrote:
> open(TAIL, "tail -f $filename |") or die "no tail $! $?\n";
> while(){
print $_;
> }
> close TAIL;
first off it doesn't seem to work - it is just siting there.
The problem being th
On Tuesday, April 2, 2002, at 04:30 , Bruno Figueira wrote:
> However, if another program removes (all) lines from the file referenced
> by
> FH, perl looses the trailing (for a undetermined time). How do I improve
> this code to understand the file was changed?
I misread your problem - then r
what about?
open(TAIL, "tail -f $filename |") or die "no tail $! $?\n";
while(){
}
close TAIL;
> -Original Message-
> From: Bruno Figueira [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 9:53 AM
> To: [EMAIL PROTECTED]
> Cc: [EMA
On Tue, 2002-04-02 at 09:23, [EMAIL PROTECTED] wrote:
> How about putting a file lock on it?
>
> That way if someone tries to access it and write to it, it will not work.
>
One problem with doing this is that POSIX does not require programs to
check to see if a file is locked before
Well,
I should not lock it. Actually, my code should be "robust" enough to
workaround it and "tail -f" a file that is "reseted" sometimes.
Cheers,
Bruno
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Terça-feira, 2 de Ab
How about putting a file lock on it?
That way if someone tries to access it and write to it, it will not work.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi there,
I have got the example of trailing a file from "Perl Cookbook":
---
for (;;) {
while () { print $_ }
sleep 1;
seek(FH, 0, 1);
}
---
However, if another program removes (all) lines from the file referenced by
FH, perl looses the trailing (for a undetermined tim
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
1 - 100 of 110 matches
Mail list logo