[libcode-tidyall-perl] 162/374: actually add our own implementation of pushd

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:26:10 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit a57bb26af66120039e16d0d1b669dd255db9e562
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Sun Sep 2 08:02:42 2012 -0700

    actually add our own implementation of pushd
---
 dist.ini                 |    2 +-
 lib/Code/TidyAll/Util.pm |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dist.ini b/dist.ini
index 4c4428e..0a36962 100644
--- a/dist.ini
+++ b/dist.ini
@@ -41,10 +41,10 @@ Digest::SHA1          = 0
 File::Basename        = 0
 File::Find            = 0
 File::Path            = 0
-File::pushd           = 0
 File::Slurp           = 0
 File::Temp            = 0
 File::Zglob           = 0
+Guard                 = 0
 Hash::MoreUtils       = 0
 Log::Any              = 0
 List::MoreUtils       = 0
diff --git a/lib/Code/TidyAll/Util.pm b/lib/Code/TidyAll/Util.pm
index 26329c6..212eb9b 100644
--- a/lib/Code/TidyAll/Util.pm
+++ b/lib/Code/TidyAll/Util.pm
@@ -3,7 +3,6 @@ use Cwd qw(realpath);
 use Data::Dumper;
 use File::Basename;
 use File::Path;
-use File::pushd qw(pushd);
 use File::Slurp qw(read_file write_file read_dir);
 use File::Spec::Functions qw(abs2rel rel2abs);
 use File::Temp qw(tempdir);
@@ -51,4 +50,12 @@ sub dump_one_line {
     return Data::Dumper->new( [$value] )->Indent(0)->Sortkeys(1)->Quotekeys(0)->Terse(1)->Dump();
 }
 
+sub pushd {
+    my ($dir) = @_;
+
+    my $cwd = realpath();
+    chdir($dir);
+    return guard { chdir($cwd) };
+}
+
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git



More information about the Pkg-perl-cvs-commits mailing list