> How can you tell? Can you post some sample code? You might be doing
> something that doesn't work when reloaded, like closures.
Well, here's the code I'm trying to run. (I have verified that
Param('script_root') returns D:/htdocs, as expected). The initial code
was this:
<===================================================>
sub getImage {
my ($project, $shotprefix, $shot) = @_;
$shot =~ s/\./_/;
my $image = Param('script_root') . '/' .
"images/$project/$shotprefix/$shot.jpg";
# Check if the shot-specific image exists
if (!-e $image) {
# If not, use the generic image
$image = Param('script_root') . '/' .
"images/$project/generic.jpg";
if (!-e $image) {
$image = Param('script_root') . '/' . "images/no_image.gif";
}
}
warn "-- image is $image";
return $image;
}
<===================================================>
I changed it to this:
<===================================================>
sub getImage {
my ($project, $shotprefix, $shot) = @_;
$shot =~ s/\./_/;
my $image = "images/$project/$shotprefix/$shot.jpg";
# Check if the shot-specific image exists
if (!-e Param('script_root') . '/' . $image) {
# If not, use the generic image
$image = "images/$project/generic.jpg";
if (!-e Param('script_root') . '/' . $image) {
$image = "images/no_image.gif";
}
}
warn "-- image is $image";
return $image;
}
<===================================================>
The first piece of code would see that, for example,
"D:/htdocs/images/project/prefix/bob.jpg" exists, and return that whole
string.
The second piece of code would see that
"D:/htdocs/images/project/prefix/bob.jpg" exists but only return
"images/project/prefix/bob.jpg". That's what I want.
And I can see in the error_log that $image is still the absolute path
("D:/htdocs/images/project/prefix/bob.jpg" in our example) even after
the change.
J-S