Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-11 Thread budi pearl
Hi Jim, On Fri, Jan 11, 2013 at 1:54 PM, Jim Gibson jimsgib...@gmail.com 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.

finding head and tail in data structure

2013-01-10 Thread budi perl
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 = { AAA = BBB,

Re: finding head and tail in data structure

2013-01-10 Thread David Precious
On Thu, 10 Jan 2013 17:01:43 +0700 budi perl budipe...@gmail.com 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,

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Thu, Jan 10, 2013 at 5:19 PM, David Precious dav...@preshweb.co.ukwrote: On Thu, 10 Jan 2013 17:01:43 +0700 budi perl budipe...@gmail.com 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

Re: finding head and tail in data structure

2013-01-10 Thread Rob Dixon
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, MGWQ = CDEF

Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
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 rob.di...@gmx.com 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 = (

Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
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

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread Shawn H Corey
On Fri, 11 Jan 2013 10:33:02 +0700 budi pearl budipe...@gmail.com 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:

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
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 this

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread budi pearl
On Fri, Jan 11, 2013 at 11:05 AM, budi pearl budipe...@gmail.com 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.

Re: Passing hash ref [ was Re: finding head and tail in data structure

2013-01-10 Thread Jim Gibson
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 }) Execution of

More on perl like tail

2009-10-24 Thread Harry Putnam
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't

Re: More on perl like tail

2009-10-24 Thread Jim Gibson
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

Re: More on perl like tail

2009-10-24 Thread Harry Putnam
(untested): while(1) { while(FILE) { print; } sleep 1; seek(FILE,0,1); } That does look like it might be better... and thanks for the explanation. [...] use File::Tail; $file=File::Tail-new(/some/log/file); while (defined($line=$file-read)) { print

Re: perl like tail -f

2009-10-22 Thread Harry Putnam
. 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 to emulate what it really should be doing, it introduces code that may not work in all cases. I'm having trouble with File::Tail... or more likely

Re: perl like tail -f

2009-10-20 Thread Shawn H Corey
Harry Putnam wrote: Shawn H Corey shawnhco...@gmail.com 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

Re: perl like tail -f

2009-10-20 Thread Peter Scott
On Mon, 19 Oct 2009 23:30:30 -0500, Harry Putnam wrote: Shawn H Corey shawnhco...@gmail.com 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

perl like tail -f

2009-10-19 Thread Harry Putnam
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 restarts. I want to get

Re: perl like tail -f

2009-10-19 Thread Shawn H Corey
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-0.99.3/Tail.pm

Re: perl like tail -f

2009-10-19 Thread Jim Gibson
On 10/19/09 Mon Oct 19, 2009 11:38 AM, Harry Putnam rea...@newsguy.com 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? There is an FAQ

Re: perl like tail -f

2009-10-19 Thread Harry Putnam
Jim Gibson jimsgib...@gmail.com writes: On 10/19/09 Mon Oct 19, 2009 11:38 AM, Harry Putnam rea...@newsguy.com 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

Re: display tail of monster file

2009-09-27 Thread Harry Putnam
叶孤城 gucheng...@freenet.de writes: 2009/9/27 叶孤城 gucheng...@freenet.de: 2009/9/27 Harry Putnam rea...@newsguy.com: 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

display tail of monster file

2009-09-26 Thread 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: #!/usr/local/bin/perl use strict; use warnings; my $log = shift

Re: display tail of monster file

2009-09-26 Thread 叶孤城
2009/9/27 Harry Putnam rea...@newsguy.com: 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 which is better

Re: display tail of monster file

2009-09-26 Thread 叶孤城
2009/9/27 叶孤城 gucheng...@freenet.de: 2009/9/27 Harry Putnam rea...@newsguy.com: 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

RE: How to implement tail -f using perl in both windows and linux !

2009-03-24 Thread Bob McConnell
From: Chas. Owens On Mon, Mar 23, 2009 at 14:16, Amit Saxena learn.tech...@gmail.com 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 systems, of course

Re: How to implement tail -f using perl in both windows and linux !

2009-03-24 Thread Chas. Owens
On Tue, Mar 24, 2009 at 10:26, Bob McConnell r...@cbord.com 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

How to implement tail -f using perl in both windows and linux !

2009-03-23 Thread Amit Saxena
Is it possible to implement this without using any external modules from CPAN ? Thanks Regards, Amit Saxena

Re: [PBML] How to implement tail -f using perl in both windows and linux !

2009-03-23 Thread Randal L. Schwartz
Amit == Amit Saxena learn.tech...@gmail.com 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

Re: How to implement tail -f using perl in both windows and linux !

2009-03-23 Thread Chas. Owens
On Mon, Mar 23, 2009 at 14:16, Amit Saxena learn.tech...@gmail.com 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 systems

perl head and tail command ?

2008-04-28 Thread Richard Lee
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: [EMAIL PROTECTED

Re: perl head and tail command ?

2008-04-28 Thread Rob Dixon
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 removes the last character from

Re: perl head and tail command ?

2008-04-28 Thread Richard Lee
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 removes the last

Re: perl head and tail command ?

2008-04-28 Thread Rob Dixon
some 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; But what about the $bottom one? The chop

Re: perl head and tail command ?

2008-04-28 Thread Gunnar Hjalmarsson
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

Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
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=File

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Jeff Pang
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-read)) { print $line; } Thanks, Siva -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: AW: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
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

Re: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
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=File::Tail-new(/some

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Rob Dixon
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::Tail; my

Re: Problem in opening the file using Tail Module

2007-08-29 Thread Mumia W.
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 be that your log file is updated infrequently

Re: Problem in opening the file using Tail Module

2007-08-29 Thread sivasakthi
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

AW: Problem in opening the file using Tail Module

2007-08-29 Thread Angerstein
with no 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 point

AW: Problem in opening the file using Tail Module

2007-08-29 Thread Angerstein
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 has been opened

File::Tail + JavaScript (XmlHttpRequest)

2007-06-08 Thread Steve Finkelstein
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 properly speak

monitoring file like tail -f in perl

2006-05-29 Thread Ken Foskey
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: [EMAIL

Re: monitoring file like tail -f in perl

2006-05-29 Thread JupiterHost.Net
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-mail

Re: monitoring file like tail -f in perl

2006-05-29 Thread Xavier Noria
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

the 'tail' problem

2006-01-14 Thread Jeff Pang
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.Part

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
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 tail (GNU): -F same

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
@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 -F which means a file is followed by its name and the opening is retried from time to time. From man tail

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
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

Re: the 'tail' problem

2006-01-14 Thread John Doe
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'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

Re: the 'tail' problem

2006-01-14 Thread Shawn Corey
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 'tail -f

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
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 mylog $ln

Re: the 'tail' problem

2006-01-14 Thread JupiterHost.Net
'tail -f' command.Part of the code is below: open (TAIL,tail -f $log|) or die can't open pipe:$!; while(TAIL) { do something... } This script is a daemon script which run permanently.There is no problem when in the same day.But when the date changed,the symbol link file

Re: the 'tail' problem

2006-01-14 Thread Jeff Pang
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, I have a log file which is a symbol link to the real logfile,shown as following

RE: Emulate tail -f on file

2005-05-20 Thread Tielman Koekemoer \(TNE\)
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 Knipe [mailto

Re: Emulate tail -f on file

2005-05-20 Thread Wiggins d'Anconia
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 stop working once I restart the application

Emulate tail -f on file

2005-05-19 Thread Tielman Koekemoer \(TNE\)
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://learn.perl.org/ http://learn.perl.org

Re: Emulate tail -f on file

2005-05-19 Thread Ramprasad A Padmanabhan
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, filename |); (?) TIA

Re: Emulate tail -f on file

2005-05-19 Thread Offer Kaye
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.perl.org/perlfaq5.html#How-do-I-do-a-tail--f-in-perl- -- Offer Kaye

Re: Emulate tail -f on file

2005-05-19 Thread Chris Knipe
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 (in the shell), how would I open the file? open(FILE

Re: tail -f does not exit

2004-05-19 Thread Claude
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 qw(:seek); Removed line, as seek is not yet a tag in earlier Perl. Rob my $file = 'junk.txt

tail -f does not exit

2004-05-14 Thread Claude
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, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org

Re: tail -f does not exit

2004-05-14 Thread Rob Dixon
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? Hi Claude, You need to close and reopen the file if you want to check for a rename. Something like the program

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: double-log-tail

2004-01-21 Thread Joel Newkirk
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/File-Tail-0.98/Tail.pm And I might as well throw a POE reference in here, as usual this sort

Re: double-log-tail

2004-01-19 Thread Wiggins d'Anconia
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 'select

double-log-tail

2004-01-12 Thread Joel Newkirk
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:

Tail -f from a cgi script

2003-07-14 Thread Eugene Geldenhuys
Hi all My woes continue I had a great way to view system logs in real-time, all I did is direct the output of the tail command to my browser - a simple tail-f worked well. Since upgrading to RH8 and Apache 2.x this no longer works, though a tail -n20 still does. Does anyone have a way to output

RE: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread NYIMI Jose (BMB)
-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't mentioned that i wanted a pure perl

RE: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread Sudarshan Raghavan
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 $filename = `ls -ltr|tail -1 $DIRECTORY`; print

Re: Unix ls -lrt | tail -1 in Perl

2003-03-21 Thread John W. Krahn
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't mentioned that i wanted a pure perl solution, thanks anyway. my $latest = (sort {-M

Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread NYIMI Jose (BMB)
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 confidential

Re: Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread Sudarshan Raghavan
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 my $latest; while ($dir/*) { $latest

RE: Unix ls -lrt | tail -1 in Perl

2003-03-20 Thread Hanson, Rob
-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 = (sort {-M $b = -M $a} $dir/*)[-1]; or my $latest; while ($dir

How do you code a tail -f if you're using Net::Rsh?

2003-01-22 Thread Richard Fernandez
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---8--- #!/usr

RE: How do you code a tail -f if you're using Net::Rsh?

2003-01-22 Thread Bob Showalter
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-- -8

Re: tail + count

2003-01-12 Thread Mark Goland
){ 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: [EMAIL PROTECTED] Sent: Friday, January 10, 2003 11:52 PM Subject: tail + count I wrote the following script

tail + count

2003-01-11 Thread Mrtlc
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 { $n = $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

Grab last line like `tail'

2002-12-01 Thread Harry Putnam
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]

Re: Grab last line like `tail'

2002-12-01 Thread Danijel Tasov
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::ReadBackwards; bye, Da.Ta

Howto efficiently tail a win32 Logfile?

2002-10-14 Thread Joel Hughes
Hi, I need to set up a perl job which will process the lastest entries on an IIS web logfile. E.g. every (say) 5 mins, a job will run processing new additions to the file. What is the best way to go about this? Should I (when the process runs): 1) read thru the IIS logfile until I reach the

tail -f with cgi

2002-07-12 Thread Max Clark
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, however it closes as soon as it reads whatever is in the file at that particular time. How do I mimic tail -f functionality? Thanks, Max -- To unsubscribe, e-mail: [EMAIL

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
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 out of control, so that you don't have to worry about blowing it up

Re: Tail call optimization

2002-06-03 Thread Tagore Smith
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 out of control, so that you don't have to worry about blowing it up if you recurse very

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

Tail call optimization

2002-05-28 Thread Tagore Smith
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 sure

Better tail -f

2002-04-02 Thread Bruno Figueira
Hi there, I have got the example of trailing a file from Perl Cookbook: --- for (;;) { while (FH) { 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

Re: Better tail -f

2002-04-02 Thread jbajin
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]

  1   2   >