| 1 | # $Id: Pushd.pm 1.7 Tue, 09 Sep 1997 17:07:06 -0400 jesse $ | ||
| 2 | |||
| 3 | package Sys::Pushd; | ||
| 4 | use strict; | ||
| 5 | use Cwd; | ||
| 6 | use vars qw($VERSION); | ||
| 7 | # $Format: "$VERSION='$SysPushdRelease$';"$ | ||
| 8 | $VERSION='0.001'; | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my $class=shift; | ||
| 12 | my @dirs=@_; | ||
| 13 | my $old=cwd; | ||
| 14 | my $dir; foreach $dir (@dirs) { | ||
| 15 | chdir $dir or die "Couldn't chdir from $old to $dir: $!"; | ||
| 16 | } | ||
| 17 | bless \$old, $class; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub DESTROY { | ||
| 21 | my $self=shift; | ||
| 22 | chdir $$self or die "Couldn't chdir back to $$self: $!"; | ||
| 23 | } | ||
| 24 | |||
| 25 | 1; | ||
| 26 | __END__ |