[greenstone-devel] cache_generated_images problem (and solution)

From Vladimir Risojevic
DateThu Dec 4 22:24:29 2008
Subject [greenstone-devel] cache_generated_images problem (and solution)
Dear Greenstone team,

Since I am currently maintaining a few collections which consist mainly of
scanned images, I welcome cache_generated_images option in Greenstone 2.81.
However, when I tried to build a collection with
cache_generated_images=true on a
WinXP machine I got the following error messages: Use of uninitialized
value in substitution (s///) at C:\Program
Files\Greenstone/perllib/plugins/BaseMediaConverter.pm line 84. and ****
Error is: fileparse(): need a valid pathname at C:\Program
Files\Greenstone/perllib/plugins/BaseMediaConverter.pm line 88.
I traced the problem to BaseMediaConverter.pm and found out that the first
message appears because regexp in line 84 cannot match $base_dir because on
windows $base_dir contains slashes as directory separators, while in
directory separators are backslashes. The second error message is merely a
consequence of the first one, because $file is empty.
In order to solve this either $base_dir or $filename has to be fixed. I
find where $self->{'base_dir'} is set. It seems that it is not in line
67 of
BaseMediaConverter.pm since $base_dir there is an empty string. In the
end (and
because it is very late night) I decided to use a quick and dirty
approach and
$filename =~ s/\\/\//g;
before the regexp in line 84 and fix the $filename. This solved the
problem, and
I hope it will be helpful to others.
Maybe a better way to solve this problem would be to construct
$self->{'base_dir'} with backslashes or slashes depending on the operating
system, as utils::filename_cat does. However, as I said I cannot find
where it
is defined.

Best regards,


Vladimir Risojevic
Teaching Assistant
Faculty of Electrical Engineering
University of Banjaluka
Patre 5
78000 Banjaluka
Bosnia and Herzegovina

Phone: +387 51 221 847, +387 51 221 876
Fax: +387 51 211 408
Email: vlado@etfbl.net
WWW: http://www.etfbl.net