|
From: Mojo N. <moj...@us...> - 2004-08-18 03:41:59
|
Update of /cvsroot/sprawler/sprawler/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9674/lib Modified Files: Sprawler.pm Log Message: Added creating of necessary directories. Unfortunately master.pl fails on the first pass at creating master_indexes and log directories... on second try it works, something about trying to use the log file prior to the path being defined and it happens when the list needs to be seeded. I'll try to fix it shortly. mojo Index: Sprawler.pm =================================================================== RCS file: /cvsroot/sprawler/sprawler/lib/Sprawler.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Sprawler.pm 25 Jun 2004 02:31:05 -0000 1.9 --- Sprawler.pm 18 Aug 2004 03:41:37 -0000 1.10 *************** *** 23,26 **** --- 23,35 ---- $self->{$var}=$value; } + if ($var=~/PATH/) { + if( $self->{$var}=~m/ARRAY/) { + print STDERR "VAR $var <>$self->{$var} \n"; + + } else { + + $self->mkrdir($self->{$var}); + } + } } close(CONFIG); *************** *** 73,80 **** my $self=shift; my $path=shift; if (! -e "$path") { foreach my $d (split(/\//,$path)) { $dir.=$d."/"; ! if (! -e "$dir") { mkdir("$dir") || die "unable to create $dir\n" ; --- 82,91 ---- my $self=shift; my $path=shift; + if (! -e "$path") { foreach my $d (split(/\//,$path)) { $dir.=$d."/"; ! #print STDERR "DIR $dir"; ! if (! -e "$dir") { mkdir("$dir") || die "unable to create $dir\n" ; *************** *** 83,87 **** } } ! sub logf { --- 94,98 ---- } } ! sub logf { *************** *** 90,98 **** --- 101,114 ---- my $timestamp = scalar localtime; chomp($timestamp); + #print STDERR "LOG FILE $logfile\n"; if($self->{LOGFILE}) { $logfile=$self->{LOGFILE}; my $path=$logfile; $path=~s/(.*)\/(.*)$/$1/; + #print STDERR "PATH: $path\n"; + + $self->mkrdir($path); + } else { $logfile="/dev/null"; *************** *** 107,113 **** $self->{LOGFILE}=$1; } ! open(LOG,">> $logfile"); print LOG "$timestamp $string"; ! close; } --- 123,131 ---- $self->{LOGFILE}=$1; } ! open(LOG,">> $logfile") or die "ERROR $!\n"; ! print LOG "$timestamp $string"; ! ! close LOG; } |