root/trunk/gsdl/perllib/plugins/ArcPlug.pm @ 230

Revision 230, 1.6 KB (checked in by sjboddie, 21 years ago)

fixed typo I introduced last time

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1# plugin which recurses through directories processing
2# each file it finds
3
4package ArcPlug;
5
6use util;
7use BasPlug;
8use plugin;
9use arcinfo;
10
11BEGIN {
12    @ISA = ('BasPlug');
13}
14
15sub new {
16    my ($class) = @_;
17    my $self = new BasPlug ();
18
19    return bless $self, $class;
20}
21
22# return 1 if this class might recurse using $pluginfo
23sub is_recursive {
24    my $self = shift (@_);
25
26    return 1;
27}
28
29# return 1 if processed, 0 if not processed
30# Note that $base_dir might be "" and that $file might
31# include directories
32sub read {
33    my $self = shift (@_);
34    ($pluginfo, $base_dir, $file, $metadata, $processor) = @_;
35
36    # see if this has a archives information file within it
37    $archive_info_filename = &util::filename_cat($base_dir,$file,"archives.inf");
38
39    if (-e $archive_info_filename) {
40
41    # read in the archives information file
42    my $archive_info = new arcinfo ();
43    $archive_info->load_info ($archive_info_filename);
44   
45    my $file_list = $archive_info->get_file_list();
46
47    # process each file
48    foreach $subfile (@$file_list) {
49        # note: metadata is not carried on to the next level
50        my $tmp = &util::filename_cat ($file, $subfile->[0]);
51        next if $tmp eq $file;
52        &plugin::read ($pluginfo, $base_dir, $tmp, {}, $processor);
53    }
54   
55    # all books have been processed so need to output classifications
56    # to infodb - note that at present you have to import before building
57    if (defined $processor->{'mode'} && $processor->{'mode'} eq 'infodb') {
58        print STDERR "ArcPlug: Adding classifications to infodb\n";
59        $processor->process('classifications');
60    }
61
62    return 1;
63    }
64
65    # wasn't an archives directory, someone else will have to process it
66    return 0;
67}
68
691;
Note: See TracBrowser for help on using the browser.