Changeset 11090 for trunk/gsdl/perllib/plugins/ZIPPlug.pm
- Timestamp:
- 2006-01-24T10:29:34+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/ZIPPlug.pm
r10254 r11090 82 82 my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs); 83 83 84 # BasPlug is explicitly set not to set process_exp if recursive plugin85 # Not sure of this reasoning. Want it to be set in ZIPPlug, so explicitly86 # pass it in as default value87 88 ## do we need this???? --kjdon89 if (!$self->{'process_exp'}) {90 $self->{'process_exp'} = get_default_process_exp();91 }92 93 84 return bless $self, $class; 94 85 } … … 113 104 my $outhandle = $self->{'outhandle'}; 114 105 115 if ($file =~ /$self->{'process_exp'}/) { 116 117 my $filename = $file; 118 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/; 119 if (!-e $filename) { 120 print $outhandle "ZIPPLug: WARNING: $filename does not exist\n"; 121 return undef; 122 } 106 # check process_exp, block_exp, associate_ext etc 107 my ($block_status,$filename) = $self->read_block(@_); 108 return $block_status if ((!defined $block_status) || ($block_status==0)); 123 109 124 my ($file_only) = $file =~ /([^\\\/]*)$/; 125 my $tmpdir = &util::get_tmp_filename (); 126 &util::mk_all_dir ($tmpdir); 127 128 print $outhandle "ZIPPlug: extracting $file_only to $tmpdir\n" 129 if $self->{'verbosity'} > 1; 130 131 # save current working directory 132 my $cwd = cwd(); 133 chdir ($tmpdir) || die "Unable to change to $tmpdir"; 134 &util::cp ($filename, $tmpdir); 135 136 if ($file =~ /\.bz$/i) { 137 $self->bunzip ($file_only); 138 } elsif ($file =~ /\.bz2$/i) { 139 $self->bunzip2 ($file_only); 140 } elsif ($file =~ /\.(zip|jar)$/i) { 141 $self->unzip ($file_only); 142 } elsif ($file =~ /\.tar$/i) { 143 $self->untar ($file_only); 144 } else { 145 $self->gunzip ($file_only); 146 } 147 148 chdir ($cwd) || die "Unable to change back to $cwd"; 149 150 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs, $total_count, $gli); 151 &util::rm_r ($tmpdir); 152 153 $self->{'num_archives'} ++; 154 155 return $numdocs; 156 110 my ($file_only) = $file =~ /([^\\\/]*)$/; 111 my $tmpdir = &util::get_tmp_filename (); 112 &util::mk_all_dir ($tmpdir); 113 114 print $outhandle "ZIPPlug: extracting $file_only to $tmpdir\n" 115 if $self->{'verbosity'} > 1; 116 117 # save current working directory 118 my $cwd = cwd(); 119 chdir ($tmpdir) || die "Unable to change to $tmpdir"; 120 &util::cp ($filename, $tmpdir); 121 122 if ($file =~ /\.bz$/i) { 123 $self->bunzip ($file_only); 124 } elsif ($file =~ /\.bz2$/i) { 125 $self->bunzip2 ($file_only); 126 } elsif ($file =~ /\.(zip|jar)$/i) { 127 $self->unzip ($file_only); 128 } elsif ($file =~ /\.tar$/i) { 129 $self->untar ($file_only); 157 130 } else { 158 return undef;131 $self->gunzip ($file_only); 159 132 } 133 134 chdir ($cwd) || die "Unable to change back to $cwd"; 135 136 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $metadata, $processor, $maxdocs, $total_count, $gli); 137 &util::rm_r ($tmpdir); 138 139 $self->{'num_archives'} ++; 140 141 return $numdocs; 142 160 143 } 161 144
Note:
See TracChangeset
for help on using the changeset viewer.