I just released File::pushd 0.20 to CPAN. It provides for a temporary directory change that reverts at the end of a scope (similar to File::chdir but works on Win32). From the synopsis:
use File::pushd; chdir $ENV{HOME}; # change directory again for a limited scope { my $dir = pushd( '/tmp' ); # working directory changed to /tmp } # working directory has reverted to $ENV{HOME} # equivalent to pushd( File::Temp::tempdir ) { my $dir = tempd(); }
I wrote this as a helper module for my test scripts and it seeemed like it might be useful to others. Comments and critique welcome.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Released: File::pushd
by diotalevi (Canon) on Sep 02, 2005 at 12:45 UTC | |
by kappa (Chaplain) on Sep 02, 2005 at 12:54 UTC | |
by diotalevi (Canon) on Sep 02, 2005 at 13:01 UTC | |
by demerphq (Chancellor) on Sep 03, 2005 at 17:16 UTC | |
by ysth (Canon) on Sep 04, 2005 at 05:37 UTC | |
by herveus (Prior) on Sep 02, 2005 at 15:14 UTC | |
by b10m (Vicar) on Sep 02, 2005 at 13:33 UTC | |
|
Re: Released: File::pushd
by merlyn (Sage) on Sep 02, 2005 at 12:44 UTC | |
by xdg (Monsignor) on Sep 02, 2005 at 13:33 UTC | |
by merlyn (Sage) on Sep 02, 2005 at 14:36 UTC | |
by Anonymous Monk on Sep 02, 2005 at 14:47 UTC | |
by merlyn (Sage) on Sep 02, 2005 at 20:13 UTC | |
by Anonymous Monk on Sep 03, 2005 at 03:55 UTC |