Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Yanick (3196)

Yanick
  (email not shown publicly)
http://babyl.dyndns.org/techblog

Journal of Yanick (3196)

Thursday September 14, 2006
01:50 PM

Embperl 2.0 chdir quirkiness

[ #30997 ]

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:

    [-
        $path = $epreq->component->cwd;
        chdir $path or die "couldn't chdir to $path: $!";
    -]

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.