Perlers,
I getting this error, any help is appreciated!
I tried to use other files in /tmp that I manually created but still
received the same error.
Look at line 76 in the Copy.pm file and wasn't sure but here it is:
58 sub copy {
59 croak("Usage: copy(FROM, TO [, BUFFERSIZE]) ")
60 unless(@_ == 2 || @_ == 3);
61
62 my $from = shift;
63 my $to = shift;
64
65 my $from_a_handle = (ref($from)
66 ? (ref($from) eq 'GLOB'
67 || UNIVERSAL::isa($from, 'GLOB')
68 || UNIVERSAL::isa($from,
'IO::Handle'))
69 : (ref(\$from) eq 'GLOB'));
70 my $to_a_handle = (ref($to)
71 ? (ref($to) eq 'GLOB'
72 || UNIVERSAL::isa($to, 'GLOB')
73 || UNIVERSAL::isa($to,
'IO::Handle'))
74 : (ref(\$to) eq 'GLOB'));
75
76 if ($from eq $to) { # works for references, too
77 croak("'$from' and '$to' are identical (not copied)");
78 }
Here is the output from my array NBlogs2 which contains absolute path of
log file names:
/usr/openv/netbackup/logs/bpcd/log.082006
/usr/openv/netbackup/logs/bpcd/log.082106
/usr/openv/netbackup/logs/bpdbm/log.082006
/usr/openv/netbackup/logs/bpdbm/log.082106
/usr/openv/netbackup/logs/bptm/log.082006
/usr/openv/netbackup/logs/bptm/log.082106
Uncaught exception from user code:
Operation `eq': no method found,
left argument in overloaded package IO::All::File,
right argument has no overloaded magic at
/opt/perl/lib/5.8.3/File/Copy.pm line 76.
main::__ANON__('Operation `eq\': no method found,\x{a}\x{9}left
argument in overloade...') called at
/opt/perl/lib/5.8.3/File/Copy.pm line 76
File::Copy::copy('IO::All::File=GLOB(0x40563820)','/usr/openv/logs/old/l
og.082006.1') called at /opt/
perl/lib/site_perl/5.8.3/Logfile/Rotate.pm line 169
Logfile::Rotate::rotate('Logfile::Rotate=HASH(0x4055d158)')
called at logroll_for_NB.plx line 54
main::logroll('IO::All::File=GLOB(0x40563820)') called at
logroll_for_NB.plx line 87
/usr/openv/netbackup/logs/bpcd/log.082006
My Perl code is:
use strict;
use warnings;
use diagnostics;
use Logfile::Rotate;
use IO::All;
$ENV{"PATH"} = qq(/usr/local/admin);
delete @ENV{qw (IFS CDPATH ENV KSH_ENV BASH_ENV)};
my $runlog = qq(/var/tmp/logroll_for_NB.log);
my $oldir = qq(/usr/openv/logs/old);
my $oneweekdir = qq(/usr/openv/logs/);
my $twoweekdir = io('/usr/openv/netbackup/logs');
my @twoweekdir_contents = $twoweekdir->all(0);
my (@NBlogs1,@NBlogs2,) = ();
##-- BEGIN ROUTINES --##
my $overide = $SIG{__DIE__}; ## get error handler currently assigned
2 die
$SIG{__DIE__} = sub {
my $error = shift; ## error now holds the mesg passed to
die
$overide->($error) if ( ref $overide );
print LOG ($error);
};
sub logroll {
my $name = shift;
my $logs = new Logfile::Rotate(
File => $name,
Count => 3,
Gzip => 'lib',
Dir => "$oldir",
Flock => 'no',
Persist => 'yes'
);
$logs->rotate();
}
sub dateme {
my ( $hour, $min, $month, $day, $year ) = (localtime)[ 2, 1, 4, 3, 5 ];
sprintf( "%02d:%02d\t%02d/%02d/%02d\n",
$hour, $min, $month + 1, $day, ( $year % 100 ) );
}
## -- BEGIN MAIN --##
opendir( DIR1, $oneweekdir ) or die "unable to open directory:
$oneweekdir $!";
opendir( DIR2, $twoweekdir ) or die "unable to open directory:
$twoweekdir $!";
open( LOG, "+>>$runlog" ) or warn "logfile $runlog not opened:
$!";
##-- Get todays Julian date to determine run week;
--##
##-- 0 => weekly, 1 => bi-weekly. i
--##
##-- Make sure directory exists, get Julian date.
--##
##-- For bi-weekly runtimes, run_wk will be = to 1 and array will be
built. --##
if ( -d $oldir ) {
my $julian = qx(julian_date.sh) or die "unable to spawn julian.sh $!";
my $run_wk = ( $julian / 7 ) % 2;
if ( $run_wk == 1 ) {
foreach my $log (@twoweekdir_contents) {
push @NBlogs2, $log if $log =~
/bpcd\/log|bpdbm\/log|bptm\/log.\d+/;
}
unless (! @NBlogs2) {
foreach my $nblogs2 (@NBlogs2) {
print $nblogs2,"\n";
logroll($nblogs2);
}
} ##-- End unless --##
}
foreach my $log (@twoweekdir_contents) {
push @NBlogs1, $log if $log !~ /bpcd|bpdbm|bptm/ and $log =~
/log.\d+/;
}
push @NBlogs1,
grep { $_ ne "." and $_ ne ".." and -f "$oneweekdir/$_" }
readdir(DIR1);
unless (! @NBlogs1) {
foreach my $nblogs (@NBlogs1) {
logroll($nblogs);
}
} ##-- End unless --##
} ##-- End -d if --##
else {
print LOG dateme(),
"\nDirectory $oldir does not exist, logs will not be rolled: $!";
die $!;
}
close LOG or warn "was unable to close runlog file: $!";
closedir DIR2 or warn "was unable to close DH: $!";
closedir DIR1 or warn "was unable to close DH: $!";
thank you
derek
Derek Bellner Smith
Unix Systems Engineer
Cardinal Health Dublin, Ohio
<mailto:[EMAIL PROTECTED]>
_________________________________________________
This message is for the designated recipient only and may contain privileged,
proprietary, or otherwise private information. If you have received it in
error, please notify the sender immediately and delete the original. Any other
use of the email by you is prohibited.
Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk
- Portuguese - Svenska: www.cardinalhealth.com/legal/email