Changeset 18319 for gsdl/trunk/perllib/doc.pm
- Timestamp:
- 2009-01-06T18:40:53+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/doc.pm
r17057 r18319 49 49 sub new { 50 50 my $class = shift (@_); 51 my ($source_filename, $doc_type ) = @_;51 my ($source_filename, $doc_type, $rename_method) = @_; 52 52 53 53 … … 67 67 if (defined $source_filename) { 68 68 $source_filename = &util::filename_within_collection($source_filename); 69 $self->set_source_filename ($source_filename); 69 print STDERR "******doc.pm::new(): no file rename method provided\n" unless $rename_method; 70 $self->set_source_filename ($source_filename, $rename_method); 70 71 } 71 72 … … 144 145 sub set_source_filename { 145 146 my $self = shift (@_); 146 my ($source_filename ) = @_;147 my ($source_filename, $rename_method) = @_; 147 148 148 149 # Since the gsdlsourcefilename element goes into the doc.xml it has 149 150 # to be utf8. However, it should also *represent* the source filename 150 151 # (in the import directory) which may not be utf8 at all. 151 # For instance, if this meta element (gsdlsourcefilename) will be 152 # usedby other applications that parse doc.xml in order to locate153 # gsdlsourcefilename. Therefore, the solution is to URLencode the real154 # filename as this is a binary-to-text encoding meaning that the155 # resulting string is ASCII (utf8).156 157 # print STDERR "******URL encoding the gsdl_source_filename $source_filename ";158 152 # For instance, if this meta element (gsdlsourcefilename) will be used 153 # by other applications that parse doc.xml in order to locate 154 # gsdlsourcefilename. Therefore, the solution is to URLencode or base64 155 # encode the real filename as this is a binary-to-text encoding meaning 156 # that the resulting string is ASCII (utf8). Decoding will give the original. 157 158 # print STDERR "******URL/base64 encoding the gsdl_source_filename $source_filename "; 159 159 160 # URLencode just the gsdl_source_filename, not the directory. Then prepend dir 160 161 my ($srcfilename,$dirname,$suffix) 161 162 = &File::Basename::fileparse($source_filename, "\\.[^\\.]+\$"); 162 163 # print STDERR "-> $srcfilename -> "; 163 $srcfilename = &u nicode::url_encode($srcfilename.$suffix);164 $srcfilename = &util::rename_file($srcfilename.$suffix, $rename_method); 164 165 $source_filename = &util::filename_cat($dirname, $srcfilename); 165 166 # print STDERR "$source_filename\n";
Note:
See TracChangeset
for help on using the changeset viewer.