Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update dist.ini to generate meta files; add README.PATCHING

  • Loading branch information...
commit 4af02141cbf8c1d597afae7b3fbbc4dde5cf15e7 1 parent 75a2029
@dagolden authored
Showing with 277 additions and 1 deletion.
  1. +78 −0 META.json
  2. +42 −0 README.PATCHING
  3. +156 −0 README.pod
  4. +1 −1  dist.ini
View
78 META.json
@@ -0,0 +1,78 @@
+{
+ "abstract" : "change directory temporarily for a limited scope",
+ "author" : [
+ "David A Golden <dagolden@cpan.org>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.300002, CPAN::Meta::Converter version 2.112580",
+ "license" : [
+ "apache_2_0"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "File-pushd",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "examples",
+ "corpus"
+ ],
+ "package" : [
+ "DB"
+ ]
+ },
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.30"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Carp" : 0,
+ "Cwd" : 0,
+ "Exporter" : 0,
+ "File::Path" : 0,
+ "File::Spec" : 0,
+ "File::Temp" : 0,
+ "overload" : 0,
+ "perl" : "5.005",
+ "strict" : 0,
+ "vars" : 0,
+ "warnings" : 0
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Basename" : 0,
+ "File::Find" : 0,
+ "File::Spec::Functions" : 0,
+ "Test::More" : 0
+ }
+ }
+ },
+ "provides" : {
+ "File::pushd" : {
+ "file" : "lib/File/pushd.pm",
+ "version" : "1.002"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-file-pushd at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=File-pushd"
+ },
+ "homepage" : "https://github.com/dagolden/file-pushd",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/dagolden/file-pushd.git",
+ "web" : "https://github.com/dagolden/file-pushd"
+ }
+ },
+ "version" : "1.002"
+}
+
View
42 README.PATCHING
@@ -0,0 +1,42 @@
+README.PATCHING
+
+Thank you for considering contributing to this distribution. This file
+contains instructions that will help you work with the source code.
+
+The distribution is managed with Dist::Zilla. This means than many of the
+usual files you might expect are not in the repository, but are generated
+at release time (e.g. Makefile.PL).
+
+However, you can run tests directly using the 'prove' tool:
+
+ $ prove -l
+ $ prove -lv t/some_test_file.t
+
+For most distributions, 'prove' is entirely sufficent for you to test any
+patches you have.
+
+Likewise, much of the documentation Pod is generated at release time.
+Depending on the distribution, some documentation may be written in a Pod
+dialect called WikiDoc. (See Pod::WikiDoc on CPAN.) If you would like to
+submit a documentation edit, please limit yourself to the documentation you
+see.
+
+If you see typos or documentation issues in the generated docs, please
+email or open a bug ticket instead of patching.
+
+Dist::Zilla is a very powerful authoring tool, but requires a number of
+author-specific plugins. If you would like to use it for contributing,
+install it from CPAN, then run one of the following commands, depending on
+your CPAN client:
+
+ $ cpan `dzil authordeps`
+ $ dzil authordeps | cpanm
+
+Once installed, here are some dzil commands you might try:
+
+ $ dzil build
+ $ dzil test
+ $ dzil xtest
+
+You can learn more about Dist::Zilla at http://dzil.org/
+
View
156 README.pod
@@ -0,0 +1,156 @@
+=pod
+
+=head1 NAME
+
+File::pushd - change directory temporarily for a limited scope
+
+=head1 VERSION
+
+version 1.002
+
+=head1 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}
+
+ # tempd() is equivalent to pushd( File::Temp::tempdir )
+ {
+ my $dir = tempd();
+ }
+
+ # object stringifies naturally as an absolute path
+ {
+ my $dir = pushd( '/tmp' );
+ my $filename = File::Spec->catfile( $dir, "somefile.txt" );
+ # gives /tmp/somefile.txt
+ }
+
+=head1 DESCRIPTION
+
+File::pushd does a temporary C<<< chdir >>> that is easily and automatically
+reverted, similar to C<<< pushd >>> in some Unix command shells. It works by
+creating an object that caches the original working directory. When the object
+is destroyed, the destructor calls C<<< chdir >>> to revert to the original working
+directory. By storing the object in a lexical variable with a limited scope,
+this happens automatically at the end of the scope.
+
+This is very handy when working with temporary directories for tasks like
+testing; a function is provided to streamline getting a temporary
+directory from L<File::Temp>.
+
+For convenience, the object stringifies as the canonical form of the absolute
+pathname of the directory entered.
+
+=head1 USAGE
+
+ use File::pushd;
+
+Using File::pushd automatically imports the C<<< pushd >>> and C<<< tempd >>> functions.
+
+=head2 pushd
+
+ {
+ my $dir = pushd( $target_directory );
+ }
+
+Caches the current working directory, calls C<<< chdir >>> to change to the target
+directory, and returns a File::pushd object. When the object is
+destroyed, the working directory reverts to the original directory.
+
+The provided target directory can be a relative or absolute path. If
+called with no arguments, it uses the current directory as its target and
+returns to the current directory when the object is destroyed.
+
+If the target directory does not exist or if the directory change fails
+for some reason, C<<< pushd >>> will die with an error message.
+
+Can be given a hashref as an optional second argument. The only supported
+option is C<<< untaint_pattern >>>, which is used to untaint file paths involved.
+It defaults to C<<< qr{^([-+@\w./]+)$} >>>, which is reasonably restrictive (e.g.
+it does not even allow spaces in the path). Change this to suit your
+circumstances and security needs if running under taint mode. B<Note>: you
+must include the parentheses in the pattern to capture the untainted
+portion of the path.
+
+=head2 tempd
+
+ {
+ my $dir = tempd();
+ }
+
+This function is like C<<< pushd >>> but automatically creates and calls C<<< chdir >>> to
+a temporary directory created by L<File::Temp>. Unlike normal L<File::Temp>
+cleanup which happens at the end of the program, this temporary directory is
+removed when the object is destroyed. (But also see C<<< preserve >>>.) A warning
+will be issued if the directory cannot be removed.
+
+As with C<<< pushd >>>, C<<< tempd >>> will die if C<<< chdir >>> fails.
+
+It may be given a single options hash that will be passed internally
+to CE<lt>pushdE<gt>.
+
+=head2 preserve
+
+ {
+ my $dir = tempd();
+ $dir->preserve; # mark to preserve at end of scope
+ $dir->preserve(0); # mark to delete at end of scope
+ }
+
+Controls whether a temporary directory will be cleaned up when the object is
+destroyed. With no arguments, C<<< preserve >>> sets the directory to be preserved.
+With an argument, the directory will be preserved if the argument is true, or
+marked for cleanup if the argument is false. Only C<<< tempd >>> objects may be
+marked for cleanup. (Target directories to C<<< pushd >>> are always preserved.)
+C<<< preserve >>> returns true if the directory will be preserved, and false
+otherwise.
+
+=head1 SEE ALSO
+
+=over
+
+=item *
+
+L<File::chdir>
+
+=back
+
+=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders
+
+=head1 SUPPORT
+
+=head2 Bugs / Feature Requests
+
+Please report any bugs or feature requests through the issue tracker
+at L<http://rt.cpan.org/Public/Dist/Display.html?Name=File-pushd>.
+You will be notified automatically of any progress on your issue.
+
+=head2 Source Code
+
+This is open source software. The code repository is available for
+public review and contribution under the terms of the license.
+
+L<https://github.com/dagolden/file-pushd>
+
+ git clone https://github.com/dagolden/file-pushd.git
+
+=head1 AUTHOR
+
+David A Golden <dagolden@cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2011 by David A Golden.
+
+This is free software, licensed under:
+
+ The Apache License, Version 2.0, January 2004
+
View
2  dist.ini
@@ -7,4 +7,4 @@ copyright_holder = David A Golden
-bundle = @DAGOLDEN
-remove = MinimumPerl
-[CriticTests]
+[Test::Perl::Critic]
Please sign in to comment.
Something went wrong with that request. Please try again.