Changeset 900 for trunk/gsdl/perllib/mgbuildproc.pm
- Timestamp:
- 2000-02-03T10:06:40+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/mgbuildproc.pm
r810 r900 34 34 use docproc; 35 35 use util; 36 37 36 38 37 BEGIN { … … 187 186 sub assoc_files { 188 187 my $self = shift (@_); 189 my ($doc_obj) = @_; 188 my ($doc_obj, $archivedir) = @_; 189 my ($afile); 190 190 191 foreach $assoc_file (@{$doc_obj->get_assoc_files()}) { 192 $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]); 191 foreach my $assoc_file (@{$doc_obj->get_assoc_files()}) { 192 # if assoc file contains directory structure of 193 # its own use it, otherwise use HASH... directory 194 if ($assoc_file->[1] =~ /[\/\\]/) { 195 $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]); 196 } else { 197 $afile = &util::filename_cat($self->{'assocdir'}, $archivedir, $assoc_file->[1]); 198 } 193 199 &util::hard_link ($assoc_file->[0], $afile); 194 200 } … … 201 207 # $handle = "main::STDOUT"; 202 208 203 $self->assoc_files ($doc_obj);204 205 209 my $doctype = $doc_obj->get_doc_type(); 206 210 207 211 # only output this document if it is one to be indexed 208 212 return if ($doctype ne "indexed_doc"); 213 214 my ($archivedir) = $filename =~ /^(.*?)(?:\/|\\)[^\/\\]*$/; 215 $archivedir = "" unless defined $archivedir; 216 $archivedir =~ s/\\/\//g; 217 $archivedir =~ s/^\/+//; 218 $archivedir =~ s/\/+$//; 219 220 $self->assoc_files ($doc_obj, $archivedir); 209 221 210 222 # this is another document … … 239 251 # output all the section metadata 240 252 my $metadata = $doc_obj->get_all_metadata ($section); 241 foreach $pair (@$metadata) {253 foreach my $pair (@$metadata) { 242 254 my ($field, $value) = (@$pair); 243 255 … … 266 278 # output archivedir if at top level 267 279 if ($section eq $doc_obj->get_top_section()) { 268 my ($archivedir) = $filename =~ /^(.*?)(?:\/|\\)[^\/\\]*$/;269 $archivedir = "" unless defined $archivedir;270 $archivedir =~ s/\\/\//g;271 $archivedir =~ s/^\/+//;272 $archivedir =~ s/\/+$//;273 280 print $handle "<archivedir>$archivedir\n"; 274 281 } … … 285 292 print $handle "<contains>"; 286 293 my $firstchild = 1; 287 foreach $child (@$children) {294 foreach my $child (@$children) { 288 295 print $handle ";" unless $firstchild; 289 296 $firstchild = 0; … … 348 355 349 356 # see if this document belongs to this subcollection 350 foreach $indexexp (@{$self->{'indexexparr'}}) {357 foreach my $indexexp (@{$self->{'indexexparr'}}) { 351 358 $indexed_doc = 0; 352 359 my ($field, $exp, $options) = split /\//, $indexexp; … … 397 404 if ($indexed_doc) { 398 405 $self->{'num_bytes'} += $doc_obj->get_text_length ($section); 399 foreach $field (split (/,/, $fields)) {406 foreach my $field (split (/,/, $fields)) { 400 407 # only deal with this field if it doesn't start with top or 401 408 # this is the first section
Note:
See TracChangeset
for help on using the changeset viewer.