Changeset 16392 for gsdl/trunk/perllib/plugins/LOMPlugin.pm
- Timestamp:
- 2008-07-14T14:57:38+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/LOMPlugin.pm
r16019 r16392 106 106 107 107 108 108 sub can_process_this_file { 109 my $self = shift(@_); 110 my ($filename) = @_; 111 112 if ($self->SUPER::can_process_this_file($filename) && $self->check_doctype($filename)) { 113 return 1; # its a file for us 114 } 115 return 0; 116 } 109 117 110 118 sub metadata_read { 111 119 my $self = shift (@_); 112 my ($pluginfo, $base_dir, $file, $ metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;120 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_; 113 121 114 122 my $outhandle = $self->{'outhandle'}; 115 123 116 my $filename = $file; 117 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/; 118 119 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) { 120 return undef; # can't recognise 121 } 122 if (!$self->check_doctype($filename)) { 123 # this file is not for us 124 return undef; 125 } 124 # can we process this file?? 125 my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file); 126 return undef unless $self->can_process_this_file($filename_full_path); 126 127 127 128 $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up … … 130 131 if $self->{'verbosity'} > 1; 131 132 132 my ($dir,$tail) = $filename =~ /^(.*?)([^\/\\]*)$/;133 my ($dir,$tail) = $filename_full_path =~ /^(.*?)([^\/\\]*)$/; 133 134 $self->{'output_dir'} = $dir; 134 135 135 136 eval { 136 $self->{'parser'}->parsefile($filename );137 $self->{'parser'}->parsefile($filename_full_path); 137 138 }; 138 139 139 140 if ($@) { 140 print $outhandle "LOMPlugin: skipping $filename as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1);141 print $outhandle "LOMPlugin: skipping $filename_full_path as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1); 141 142 print $outhandle "\n Perl Error:\n $@\n" if ($self->{'verbosity'}>2); 142 143 return 0; … … 212 213 sub read { 213 214 my $self = shift (@_); 214 my ($pluginfo, $base_dir, $file, $ metadata, $processor, $maxdocs, $total_count, $gli) = @_;215 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_; 215 216 216 217 my $outhandle = $self->{'outhandle'}; … … 218 219 return 0 if (defined $self->{'extra_blocks'}->{$file}); 219 220 220 # need to check whether this file is for us 221 my ($block_status,$filename) = $self->read_block(@_); 222 return $block_status if ((!defined $block_status) || ($block_status==0)); 223 if (!$self->check_doctype($filename)) { 224 # this file is not for us 225 return undef; 226 } 221 # can we process this file?? 222 my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file); 223 return undef unless $self->can_process_this_file($filename_full_path); 227 224 228 225 $self->{'metadata_table'} = $metadata;
Note:
See TracChangeset
for help on using the changeset viewer.