Mercurial > hg > foxridge-archiver
changeset 6:a3feffd94021
small fixes
author | casties |
---|---|
date | Tue, 13 Jul 2004 20:32:49 +0200 |
parents | 1a377102b1ce |
children | c4e6fc065b6d |
files | HarvestmetaHandler.pm harvestmeta.pl |
diffstat | 2 files changed, 12 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/HarvestmetaHandler.pm Mon Jul 12 17:49:17 2004 +0200 +++ b/HarvestmetaHandler.pm Tue Jul 13 20:32:49 2004 +0200 @@ -45,14 +45,12 @@ push @elements, [$elem, "", $currAttrib]; } # element name is either LocalName or Name - my $name = $$el{'LocalName'}; - $name = $$el{'Name'} unless ($name); + my $name = $$el{'LocalName'} or $$el{'Name'}; #logger('DEBUG', " name: $name"); # assemble attributes string - $currAttrib =""; + $currAttrib = ""; foreach my $attr (values %{$$el{'Attributes'}}) { - my $key = $$attr{'LocalName'}; - $key = $$attr{'Name'} unless ($key); + my $key = $$attr{'LocalName'} or $$attr{'Name'}; my $val = $$attr{'Value'}; $currAttrib .= "$key=\"$val\" "; } @@ -68,8 +66,7 @@ # process element end event logger('DEBUG', "endelem: $self, $$el{'LocalName'}") if ($debugElem); # check element name - my $name = $$el{'LocalName'}; - $name = $$el{'Name'} unless ($name); + my $name = $$el{'LocalName'} or $$el{'Name'}; my $lastag = $currElemPath[$#currElemPath]; if ($lastag ne $name) { logger('ERROR', "closing tag '$lastag' doesn't match '$name'!"); @@ -94,10 +91,10 @@ sub characters { my ($self, $char) = @_; # process character data event - logger('DEBUG', "characters: $self, $char") if ($debugElem); + logger('DEBUG', "characters: $self, $char") if ($debugElem > 1); # add to current content $currText .= $$char{'Data'}; - logger('DEBUG', " Text: $currText") if ($debugCont); + logger('DEBUG', " Text: $currText") if ($debugCont > 1); }
--- a/harvestmeta.pl Mon Jul 12 17:49:17 2004 +0200 +++ b/harvestmeta.pl Tue Jul 13 20:32:49 2004 +0200 @@ -17,7 +17,7 @@ # # program version -my $version = "0.2 (08.07.2004)"; +my $version = "0.2.1 (13.07.2004)"; # read command line parameters my $args = MPIWGStor::parseargs; @@ -227,8 +227,8 @@ foreach my $me (@indexdata) { $cnt++; my ($tag, $val, $attr) = @$me; - my $meta; - my $file; + my $meta = ""; + my $file = ""; if ($tag =~ /index\/resource$/) { if ($attr =~ /metaLink=\"([^\"]+)\"/) { $meta = $1; @@ -263,7 +263,7 @@ } my @data = $metaParserHandler->getData(); logger('DEBUG', "parsed $#data+1 elements"); - if ($data[0][0] eq "html") { + if (lc $data[0][0] eq "html") { # oops, wrong logger('WARNING', "invalid HTML content from $metaurl"); $warncnt++; @@ -384,14 +384,14 @@ logger("INFO", "harvestmeta $version"); initDB(); -my $fnum; +my $fnum = 0; if ($basedir) { # read and process all files under $basedir $fnum = readAllFiles($basedir, ""); # delete orphaned data (under $basedir) cleanUnmarkedFiles($basedir); -} elsif ($baseurl) { +} elsif ($indexurl) { # read and process XML index $fnum = readURLIndex($indexurl); if ($baseurl) {