Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the File-chdir CPAN distribution.

Report information
The Basics
Id: 14651
Status: resolved
Priority: 0/
Queue: File-chdir

People
Owner: Nobody in particular
Requestors: avised [...] kbcfp.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.08



Subject: File::chdir: what happens on error?
Date: Tue, 6 Sep 2005 08:39:45 +0100
From: "Avis, Ed" <avised [...] kbcfp.com>
To: <schwern [...] pobox.com>
The documentation for File::chdir doesn't specify what happens when you try to set $CWD but the chdir() call fails for some reason. In my opinion, it would be best to throw an exception, but whatever the behaviour is it needs to be documented. -- Ed Avis <avised@kbcfp.com>
From: krishnoid [...] wapacut.com
On Mon Sep 19 18:42:56 2005, avised@kbcfp.com wrote: Show quoted text
> In my opinion, it would be best to throw an exception, but whatever the > behaviour is it needs to be documented.
It seems to set $! from the chdir() call. It should also return false on failure and the new dir on success: sub STORE { return unless defined $_[1]; my $did_chdir = File::chdir::_chdir($_[1]); return $did_chdir ? $Real_CWD : $did_chdir; } but it doesn't seem to do so: Show quoted text
> perl -MFile::chdir -e '$foo = "/"; print +($CWD = $foo), "\n"' ;
/ Show quoted text
> perl -MFile::chdir -e '$foo = "/q"; print +($CWD = $foo), "\n"' ;
/home/scratchbox/doc
As of 0.08, File::chdir will throw an exception if the chdir fails.