Embperl 2.0 chdir quirkiness
ah AH! It took me almost one year, but I finally got the sucker!
In the PerlWar web interface, I have this Embperl upload page. Except that ever since its conception, the little devil fails something like once every five times, without any visible reason.
Well, the reason, it turns out, is that Embperl 2 doesn't chdir to the page's directory (whereas Embperl 1 did). So if you're trying to open a file using a relative path, it'll work or not depending of the mood and state of the apache process the request is riding.
The solution? Add the following to the top of the page:
[-comments powered by Disqus
$path = $epreq->component->cwd;
chdir $path or die "couldn't chdir to $path: $!";