Ignore:
Timestamp:
1999-06-30T15:36:35+12:00 (25 years ago)
Author:
sjboddie
Message:

Added maxdocs option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r136 r317  
    2727}
    2828
    29 # return 1 if processed, 0 if not processed
     29
     30# return number of files processed, undef if can't process
    3031# Note that $base_dir might be "" and that $file might
    3132# include directories
    3233sub read {
    3334    my $self = shift (@_);
    34     my ($pluginfo, $base_dir, $file, $metadata, $processor) = @_;
    35 
     35    my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs) = @_;
    3636
    3737    my (@dir, $subfile);
     38
     39    my $count = 0;
    3840
    3941    # see if this is a directory
     
    4749    closedir (DIR);
    4850
     51    print STDERR "RecPlug: getting directory $dirname\n";
     52
    4953    # process each file
    5054    foreach $subfile (@dir) {
     55        last if (defined $maxdocs && $maxdocs =~ /\d/ && $count >= $maxdocs);
     56
    5157        if ($subfile !~ /^\.\.?$/) {
    5258        # note: metadata is not carried on to the next level
    53         &plugin::read ($pluginfo, $base_dir, &util::filename_cat($file, $subfile),
    54                    {}, $processor);
     59        $count += &plugin::read ($pluginfo, $base_dir, &util::filename_cat($file, $subfile),
     60                     {}, $processor, $maxdocs);
    5561        }
    5662    }
    57 
    58     return 1;
     63    return $count;
    5964    }
    6065
    6166    # wasn't a directory, someone else will have to process it
    62     return 0;
     67    return undef;
    6368}
    6469
Note: See TracChangeset for help on using the changeset viewer.