On Thu Oct 25 18:17:19 2007, krishnoid@wapacut.com wrote:
Show quoted text> Does pushd() return undef (I'd prefer this) or throw an exception on
> error when trying to chdir to the new directory? Also, does it set
$! on
Show quoted text> error?
It looks like it croaks:
sub pushd {
...
croak "Can't locate directory $target_dir: $@" if $@;
if ($dest ne $orig) {
chdir $dest or croak "Can't chdir to $dest\: $!";
}
}
But it doesn't croak in DESTROY when it can't chdir back to the
previous directory:
sub DESTROY {
...
my $orig = $self->{_original};
chdir $orig if $orig; # should always be so, but just in case...
...
}
In any case, it would be helpful to describe both of these behaviors
in the docs and show an example using eval {} for error-handling.