There are some good answers here so far, but I'd like to recommend a
logging module like Log::Log4perl. If your script is more than a run-once
throwaway, proper logging will almost certainly be of benefit.
Metacpan: https://metacpan.org/module/Log::Log4perl
FAQ:
Rob Dixon rob.di...@gmx.com writes:
On 27/08/2013 23:06, John W. Krahn wrote:
Harry Putnam wrote:
[...]
(Simplified for discussion, from a longer script)
my $rsync = 'rsync';
my $tmplog = 'one.log';
my $tmplog2 = 'two.log';
open(LOG,$tmplog)or die Can't open $tmplog : $!;
On Wed, 28 Aug 2013 10:42:30 -0400
Harry Putnam rea...@newsguy.com wrote:
Thanks to all other posters.. lots of good input.
It seems to me that recording the same information is many places is a
design flaw. If you have the same information in two or more places, it
will get out of sync. Write
I know the format and scripting are probably pretty backwards but I
seem to recall it being important to have a `return' line in a
function.
The code below was a script by itself but now I need to turn it into a
function inside a larger script... I've done something that sort of
works but fails
Shawn H Corey shawnhco...@gmail.com writes:
On Wed, 28 Aug 2013 10:42:30 -0400
Harry Putnam rea...@newsguy.com wrote:
Thanks to all other posters.. lots of good input.
It seems to me that recording the same information is many places is a
design flaw. If you have the same information in
On Wed, 28 Aug 2013 12:34:40 -0400
Harry Putnam rea...@newsguy.com wrote:
That sounds quite a bit like what cron could do with this hmm.
Or use a hard link to preserve the file.
--
Don't stop where the ink does.
Shawn
--
To unsubscribe, e-mail:
Rob Dixon wrote:
On 27/08/2013 23:06, John W. Krahn wrote:
my %logs = (
'one.log' = undef,
'two.log' = undef,
);
for my $name ( keys %logs ) {
open my $FH, '', $name or die Cannot open '$name' because: $!;
$logs{ $name } = $FH;
}
for my $log_FH ( values %logs ) {
print $log_FH kdkdkdkd
On 28/08/2013 16:48, Harry Putnam wrote:
The code below was a script by itself but now I need to turn it into a
function inside a larger script... I've done something that sort of
works but fails on a specific file name that looks like `.#somefile'.
What does fails mean? Does it crash?,
On 28/08/2013 19:06, John W. Krahn wrote:
Rob Dixon wrote:
use strict;
use warnings;
use autodie;
my $rsync = 'rsync';
my $tmplog = 'one.log';
my $tmplog2 = 'two.log';
my %logs = map {
open my $FH, '', $_;
What if open fails?!
I have `use autodie`.
Rob
--
To unsubscribe, e-mail:
On Wed, 28 Aug 2013 12:34:40 -0400
Harry Putnam rea...@newsguy.com wrote:
Good thinking thanks. It might not really apply here though.
I'm no kind of data manager... just a homeboy hillbilly.
What I had in mind is writing to a single log file that is dated on
the file name for each run of
10 matches
Mail list logo