@@ -1,18 +1,63 @@
-use Module::Build;
-my $build = Module::Build->new(
- module_name => "Archive::Any",
- license => 'perl',
- requires => {
- Archive::Tar => 0.22,
- Archive::Zip => 1.07,
- Cwd => 0,
- Module::Find => 0.05,
- MIME::Types => 1.16,
- File::MMagic => 1.27,
- File::Spec::Functions => 0,
- Test::More => 0.40,
- Test::Warn => 0,
- },
- );
-$build->create_build_script();
+use strict;
+use warnings;
+
+use Module::Build 0.3601;
+
+
+my %module_build_args = (
+ "build_requires" => {
+ "Module::Build" => "0.3601"
+ },
+ "configure_requires" => {
+ "ExtUtils::MakeMaker" => "6.30",
+ "Module::Build" => "0.3601"
+ },
+ "dist_abstract" => "Single interface to deal with file archives.",
+ "dist_author" => [
+ "Clint Moore",
+ "Michael G Schwern (author emeritus)",
+ "Olaf Alders (current maintainer)"
+ ],
+ "dist_name" => "Archive-Any",
+ "dist_version" => "0.0941",
+ "license" => "perl",
+ "module_name" => "Archive::Any",
+ "recommends" => {},
+ "recursive_test_files" => 1,
+ "requires" => {
+ "Archive::Tar" => 0,
+ "Archive::Zip" => 0,
+ "Cwd" => 0,
+ "File::MMagic" => 0,
+ "File::Spec::Functions" => 0,
+ "MIME::Types" => 0,
+ "Module::Find" => 0,
+ "base" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "script_files" => [],
+ "test_requires" => {
+ "Test::More" => 0,
+ "Test::Warn" => 0
+ }
+);
+
+
+unless ( eval { Module::Build->VERSION(0.4004) } ) {
+ my $tr = delete $module_build_args{test_requires};
+ my $br = $module_build_args{build_requires};
+ for my $mod ( keys %$tr ) {
+ if ( exists $br->{$mod} ) {
+ $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
+ }
+ else {
+ $br->{$mod} = $tr->{$mod};
+ }
+ }
+}
+
+my $build = Module::Build->new(%module_build_args);
+
+$build->create_build_script;
@@ -0,0 +1,10 @@
+
+# ARCHIVE-ANY CONTRIBUTORS #
+
+This is the (likely incomplete) list of people who have helped
+make this distribution what it is, either via code contributions,
+patches, bug reports, help with troubleshooting, etc. A huge
+thank to all of them.
+
+ * Olaf Alders <olaf@wundersolutions.com>
+ * unknown <unknown>
@@ -1,16 +1,25 @@
-0.931
+0.0941 2013-11-06 21:38:55 America/Toronto
+ - Fixes version number in lib/Archive/Any.pm
+ - Previous release had broken permissions.
+
+0.0940 2013-10-18 01:35:34 America/Toronto
+ - Adds x-bzip2 as per PERLER's patch in RT#67738.
+ - Converts dist to Dist::Zilla
+
+0.931 2008-04-23
- Resisted the urge to make large sweeping changes. Fixed a problem with
the tests and called it good.
-0.93
+
+0.93 2008-04-23
- DESTROY ALL TABS! [schwern]
- The example for Plugin->can_handle showed the wrong return value.
[schwern]
-0.92 Sat Aug 26 17:09:21 PDT 2006
+0.92 2006-08-26
- Added pod tests and a README for kwalitee. Not exactly a critical
update!
-0.91 Mon Aug 14 10:35:24 PDT 2006
+0.91 2006-08-14
- type() is there now. I'm not in the business of breaking other
people's scripts.
- Fixed several issues with the pod.
@@ -18,36 +27,36 @@
actually has useful information.
- Added a test for the backwardsness.
-0.09 Sun Aug 13 23:25:13 PDT 2006
+0.09 2006-08-13
- Complete rework of the module.
- Supports simple plugins for adding support for archive formats.
-0.06 Wed Oct 29 14:39:15 PST 2003
+0.06 2003-10-29
- Updating to Archive::Zip 1.07 which fixes extractTree().
* Forgot to include *.tar in the "what is a tarball" logic!
[Thanks Kevin Pease]
- Minor doc improvements.
-0.05 Mon Oct 20 04:28:31 PDT 2003
+0.05 2003-10-20
* Archive::Any->new($file, $type) wasn't working (thanks to Simon Wistow
for catching this).
-0.04 Mon Oct 20 01:53:27 PDT 2003
+0.04 2003-10-20
* Removing unzip binary hack around Archive::Zip->extractMember bug.
- Working around new extractTree() bug which can cause directories to
be unzipped with permissions set to 0000.
- Fixing is_impolite() and is_naughty() so they return true or false
instead of the scalar result of a grep.
- Failing gracefully should Archive::Tar/Zip->new() fail.
- * Fixing list_archive() and extract_archive() misuse so we work with
+ * Fixing list_archive() and extract_archive() misuse so we work with
modern Archive::Tar.
- Class::Virtually::Abstract now has a version # on CPAN.
* is_naughty() would screw up if the first file in the archive wasn't
a lone directory
-0.03 Mon Sep 3 22:18:28 EDT 2001
+0.03 2001-09-03
* It is now safe to chdir() after creating an Archive::Any object
-0.01 Sun Aug 26 02:09:51 EDT 2001
+0.01 2001-08-26
* First working version
* Archive::Zip is broken. Using unzip binary to extract.
@@ -0,0 +1,44 @@
+
+This is the Perl distribution Archive-Any.
+
+Installing Archive-Any is straightforward.
+
+## Installation with cpanm
+
+If you have cpanm, you only need one line:
+
+ % cpanm Archive::Any
+
+If you are installing into a system-wide directory, you may need to pass the
+"-S" flag to cpanm, which uses sudo to install the module:
+
+ % cpanm -S Archive::Any
+
+## Installing with the CPAN shell
+
+Alternatively, if your CPAN shell is set up, you should just be able to do:
+
+ % cpan Archive::Any
+
+## Manual installation
+
+As a last resort, you can manually install it. Download the tarball, untar it,
+then build it:
+
+ % perl Makefile.PL
+ % make && make test
+
+Then install it:
+
+ % make install
+
+If you are installing into a system-wide directory, you may need to run:
+
+ % sudo make install
+
+## Documentation
+
+Archive-Any documentation is available as POD.
+You can run perldoc from a shell to read the documentation:
+
+ % perldoc Archive::Any
@@ -0,0 +1,379 @@
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+Terms of the Perl programming language system itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+--- The GNU General Public License, Version 1, February 1989 ---
+
+This software is Copyright (c) 2013 by Olaf Alders.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 1, February 1989
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The license agreements of most software companies try to keep users
+at the mercy of those companies. By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License. The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications. Each
+licensee is addressed as "you".
+
+ 1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program. You may charge a fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish, that
+ in whole or in part contains the Program or any part thereof, either
+ with or without modifications, to be licensed at no charge to all
+ third parties under the terms of this General Public License (except
+ that you may choose to grant warranty protection to some or all
+ third parties, at your option).
+
+ c) If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use
+ in the simplest and most usual way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this General
+ Public License.
+
+ d) You may charge a fee for the physical act of transferring a
+ copy, and you may at your option offer warranty protection in
+ exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+ 3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal charge
+ for the cost of distribution) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it. For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+ 4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License. However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+ 5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+ 7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+ 8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+ To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19xx name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (a program to direct compilers to make passes
+ at assemblers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+--- The Artistic License 1.0 ---
+
+This software is Copyright (c) 2013 by Olaf Alders.
+
+This is free software, licensed under:
+
+ The Artistic License 1.0
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ - "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through
+ textual modification.
+ - "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+ - "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ - "You" is you, if you're thinking about copying or distributing this Package.
+ - "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will
+ not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+ - "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+from the Public Domain or from the Copyright Holder. A Package modified in such
+a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that
+you insert a prominent notice in each changed file stating how and when you
+changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site
+ such as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to
+ get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package
+ with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard
+ names, and clearly documenting the differences in manual pages (or
+ equivalent), together with instructions on where to get the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package. You
+may not charge a fee for this Package itself. However, you may distribute this
+Package in aggregate with other (possibly commercial) programs as part of a
+larger (possibly commercial) software distribution provided that you do not
+advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+from the programs of this Package do not automatically fall under the copyright
+of this Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
@@ -1,23 +1,34 @@
+Build.PL
+CONTRIBUTORS
Changes
+INSTALL
+LICENSE
+MANIFEST
+META.json
+Makefile.PL
+README
+dist.ini
lib/Archive/Any.pm
lib/Archive/Any/Plugin.pm
lib/Archive/Any/Plugin/Tar.pm
lib/Archive/Any/Plugin/Zip.pm
-Makefile.PL
-MANIFEST
-META.yml
+lib/Archive/Any/Tar.pm
+lib/Archive/Any/Zip.pm
+perltidy.LOG
t/00compile.t
+t/Acme-POE-Knee-1.10.zip
t/Any.t
+t/LoadHtml.5_0.tar.gz
t/fail.t
t/garbage.foo
+t/im_not_really_a.zip
t/impolite.tar.gz
t/lib.tgz
t/lib.zip
t/naughty.hominawoof
t/naughty.tar
+t/naughty.tar.gz
t/not_a_zip.zip
+t/release-cpan-changes.t
t/type.t
-t/pod.t
-t/pod-coverage.t
-Build.PL
-README
+t/your-0.01.tar.gz
@@ -0,0 +1,74 @@
+{
+ "abstract" : "Single interface to deal with file archives.",
+ "author" : [
+ "Clint Moore",
+ "Michael G Schwern (author emeritus)",
+ "Olaf Alders (current maintainer)"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.300035, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Archive-Any",
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Module::Build" : "0.3601"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.30",
+ "Module::Build" : "0.3601"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Test::CPAN::Changes" : "0.19"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Archive::Tar" : "0",
+ "Archive::Zip" : "0",
+ "Cwd" : "0",
+ "File::MMagic" : "0",
+ "File::Spec::Functions" : "0",
+ "MIME::Types" : "0",
+ "Module::Find" : "0",
+ "base" : "0",
+ "strict" : "0",
+ "warnings" : "0"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0",
+ "Test::Warn" : "0"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "http://github.com/oalders/Archive-Any/issues"
+ },
+ "homepage" : "https://github.com/oalders/archive-any",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/oalders/archive-any.git",
+ "web" : "https://github.com/oalders/archive-any"
+ }
+ },
+ "version" : "0.0941",
+ "x_contributors" : [
+ "Olaf Alders <olaf@wundersolutions.com>",
+ "unknown <unknown>"
+ ]
+}
+
@@ -1,21 +0,0 @@
---- #YAML:1.0
-name: Archive-Any
-version: 0.0932
-abstract: ~
-license: perl
-generated_by: ExtUtils::MakeMaker version 6.30_03
-author: ~
-distribution_type: module
-requires:
- Archive::Tar: 0.22
- Archive::Zip: 1.07
- Cwd: 0
- File::MMagic: 1.27
- File::Spec::Functions: 0
- MIME::Types: 1.16
- Module::Find: 0.05
- Test::More: 0.4
- Test::Warn: 0
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-new.html
- version: 1.1
@@ -1,66 +1,80 @@
-# A template for Makefile.PL.
-# - Set the $PACKAGE variable to the name of your module.
-# - Set $LAST_API_CHANGE to reflect the last version you changed the API
-# of your module.
-# - Fill in your dependencies in PREREQ_PM
-# Alternatively, you can say the hell with this and use h2xs.
-use ExtUtils::MakeMaker;
+use strict;
+use warnings;
-$PACKAGE = 'Archive::Any';
-($PACKAGE_FILE = $PACKAGE) =~ s|::|/|g;
-$LAST_API_CHANGE = 0;
-eval "require $PACKAGE";
-unless ($@) { # Make sure we did find the module.
- print <<"CHANGE_WARN" if ${$PACKAGE.'::VERSION'} < $LAST_API_CHANGE;
+use ExtUtils::MakeMaker 6.30;
-NOTE: There have been API changes between this version and any older
-than version $LAST_API_CHANGE! Please read the Changes file if you
-are upgrading from a version older than $LAST_API_CHANGE.
-CHANGE_WARN
-}
-WriteMakefile(
- NAME => $PACKAGE,
- VERSION_FROM => "lib/$PACKAGE_FILE.pm", # finds $VERSION
- PREREQ_PM => {
- Archive::Tar => 0.22,
- Archive::Zip => 1.07,
- Cwd => 0,
- Module::Find => 0.05,
- MIME::Types => 1.16,
- File::MMagic => 1.27,
- File::Spec::Functions => 0,
- Test::More => 0.40,
- Test::Warn => 0,
- },
- 'dist' => {
- COMPRESS => 'gzip -9',
- SUFFIX => '.gz',
- DIST_DEFAULT => 'all tardist',
- },
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "Single interface to deal with file archives.",
+ "AUTHOR" => "Clint Moore, Michael G Schwern (author emeritus), Olaf Alders (current maintainer)",
+ "BUILD_REQUIRES" => {
+ "Module::Build" => "0.3601"
+ },
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => "6.30",
+ "Module::Build" => "0.3601"
+ },
+ "DISTNAME" => "Archive-Any",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "NAME" => "Archive::Any",
+ "PREREQ_PM" => {
+ "Archive::Tar" => 0,
+ "Archive::Zip" => 0,
+ "Cwd" => 0,
+ "File::MMagic" => 0,
+ "File::Spec::Functions" => 0,
+ "MIME::Types" => 0,
+ "Module::Find" => 0,
+ "base" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "TEST_REQUIRES" => {
+ "Test::More" => 0,
+ "Test::Warn" => 0
+ },
+ "VERSION" => "0.0941",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
);
-{
- package MY;
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
+ my $br = $WriteMakefileArgs{BUILD_REQUIRES};
+ for my $mod ( keys %$tr ) {
+ if ( exists $br->{$mod} ) {
+ $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
+ }
+ else {
+ $br->{$mod} = $tr->{$mod};
+ }
+ }
+}
- sub test_via_harness {
- my($self, $orig_perl, $tests) = @_;
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+ my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
+ for my $mod ( keys %$br ) {
+ if ( exists $pp->{$mod} ) {
+ $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+ }
+ else {
+ $pp->{$mod} = $br->{$mod};
+ }
+ }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
- my @perls = ($orig_perl);
- push @perls, qw(bleadperl perl5.005_03 perl5.004_05 perl5.004_04
- perl5.004)
- if $ENV{PERL_TEST_ALL};
- my $out;
- foreach my $perl (@perls) {
- $out .= $self->SUPER::test_via_harness($perl, $tests);
- }
- return $out;
- }
-}
@@ -1,63 +1,66 @@
NAME
Archive::Any - Single interface to deal with file archives.
+VERSION
+ version 0.0941
+
SYNOPSIS
- use Archive::Any;
+ use Archive::Any;
- my $archive = Archive::Any->new($archive_file);
+ my $archive = Archive::Any->new( $archive_file );
- my @files = $archive->files;
+ my @files = $archive->files;
- $archive->extract;
+ $archive->extract;
- my $type = $archive->type;
+ my $type = $archive->type;
- $archive->is_impolite;
- $archive->is_naughty;
+ $archive->is_impolite;
+ $archive->is_naughty;
DESCRIPTION
This module is a single interface for manipulating different archive
formats. Tarballs, zip files, etc.
new
- my $archive = Archive::Any->new($archive_file);
- my $archive = Archive::Any->new($archive_file, $type);
+ my $archive = Archive::Any->new( $archive_file );
+ my $archive = Archive::Any->new( $archive_file, $type );
- $type is optional. It lets you force the file type in-case
+ $type is optional. It lets you force the file type in case
Archive::Any can't figure it out.
extract
- $archive->extract;
- $archive->extract($directory);
+ $archive->extract;
+ $archive->extract( $directory );
Extracts the files in the archive to the given $directory. If no
$directory is given, it will go into the current working directory.
files
- my @file = $archive->files;
+ my @file = $archive->files;
A list of files in the archive.
mime_type
- my $mime_type = $archive->mime_type();
+ my $mime_type = $archive->mime_type();
Returns the mime type of the archive.
is_impolite
- my $is_impolite = $archive->is_impolite;
+ my $is_impolite = $archive->is_impolite;
Checks to see if this archive is going to unpack into the current
directory rather than create its own.
is_naughty
- my $is_naughty = $archive->is_naughty;
+ my $is_naughty = $archive->is_naughty;
Checks to see if this archive is going to unpack outside the current
directory.
DEPRECATED
type
- my $type = $archive->type;
+ my $type = $archive->type;
Returns the type of archive. This method is provided for backwards
compatibility in the Tar and Zip plugins and will be going away soon
@@ -67,41 +70,34 @@ PLUGINS
For detailed information on writing plugins to work with Archive::Any,
please see the pod documentation for Archive::Any::Plugin.
-AUTHOR
- Clint Moore <cmoore@cpan.org>
-
-AUTHOR EMERITUS
- Michael G Schwern
-
SEE ALSO
Archive::Any::Plugin
SUPPORT
You can find documentation for this module with the perldoc command.
- perldoc Archive::Any
+ perldoc Archive::Any
You can also look for information at:
- * AnnoCPAN: Annotated CPAN documentation
-
- <http://annocpan.org/dist/Archive-Any>
+ * MetaCPAN
- * CPAN Ratings
+ <https://metacpan.org/module/Archive::Any>
- <http://cpanratings.perl.org/d/Archive-Any>
+ * Issue tracker
- * RT: CPAN's request tracker
+ <https://github.com/oalders/archive-any/issues>
- <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Archive-Any>
+AUTHORS
+ * Clint Moore
- * Search CPAN
+ * Michael G Schwern (author emeritus)
- <http://search.cpan.org/dist/Archive-Any>
+ * Olaf Alders (current maintainer)
-LICENSE
- This program is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
+COPYRIGHT AND LICENSE
+ This software is copyright (c) 2013 by Olaf Alders.
- See <http://www.perl.com/perl/misc/Artistic.html>
+ This is free software; you can redistribute it and/or modify it under
+ the same terms as the Perl 5 programming language system itself.
@@ -0,0 +1,47 @@
+name = Archive-Any
+author = Clint Moore
+author = Michael G Schwern (author emeritus)
+author = Olaf Alders (current maintainer)
+license = Perl_5
+version = 0.0941
+main_module = lib/Archive/Any.pm
+
+[GatherDir]
+[PruneCruft]
+[ManifestSkip]
+[License]
+[ExtraTests]
+[ExecDir]
+[ShareDir]
+[PkgVersion]
+
+[MakeMaker]
+[Manifest]
+
+[TestRelease]
+[ConfirmRelease]
+[UploadToCPAN]
+
+[MetaResources]
+[MetaJSON]
+[Bugtracker]
+web = http://github.com/oalders/%s/issues
+[GithubMeta]
+
+[AutoPrereqs]
+
+;[Test::Perl::Critic]
+;[PodCoverageTests]
+[Test::CPAN::Changes]
+[ReadmeFromPod]
+[InstallGuide]
+[ModuleBuild]
+[PodWeaver]
+[CopyReadmeFromBuild]
+[NextRelease]
+format = %-1v %{yyyy-MM-dd HH:mm:ss VVVV}d
+
+[ContributorsFromGit]
+[ContributorsFile]
+
+[@Git]
@@ -1,30 +1,23 @@
package Archive::Any::Plugin::Tar;
+{
+ $Archive::Any::Plugin::Tar::VERSION = '0.0941';
+}
+
use strict;
use base 'Archive::Any::Plugin';
use Archive::Tar;
use Cwd;
-=head1 NAME
-
-Archive::Any::Plugin::Tar - Archive::Any wrapper around Archive::Tar
-
-=head1 SYNOPSIS
-
-Do not use this module directly. Instead, use Archive::Any.
-
-=cut
-
sub can_handle {
- return(
- 'application/x-tar',
- 'application/x-gtar',
- 'application/x-gzip',
- );
+ return (
+ 'application/x-tar', 'application/x-gtar',
+ 'application/x-gzip', 'application/x-bzip2',
+ );
}
sub files {
- my( $self, $file ) = @_;
+ my ( $self, $file ) = @_;
my $t = Archive::Tar->new( $file );
return $t->list_files;
}
@@ -41,10 +34,53 @@ sub type {
return 'tar';
}
+1;
+
+# ABSTRACT: Archive::Any wrapper around Archive::Tar
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Archive::Any::Plugin::Tar - Archive::Any wrapper around Archive::Tar
+
+=head1 VERSION
+
+version 0.0941
+
+=head1 SYNOPSIS
+
+Do not use this module directly. Instead, use L<Archive::Any>.
+
=head1 SEE ALSO
-Archive::Any, Archive::Tar
+L<Archive::Any>, L<Archive::Tar>
-=cut
+=head1 AUTHORS
-1;
+=over 4
+
+=item *
+
+Clint Moore
+
+=item *
+
+Michael G Schwern (author emeritus)
+
+=item *
+
+Olaf Alders (current maintainer)
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
@@ -1,47 +1,27 @@
package Archive::Any::Plugin::Zip;
+{
+ $Archive::Any::Plugin::Zip::VERSION = '0.0941';
+}
use strict;
-use vars qw($VERSION);
-$VERSION = 0.03;
use base qw(Archive::Any::Plugin);
use Archive::Zip qw(:ERROR_CODES);
-=head1 NAME
-
-Archive::Any::Plugin::Zip - Archive::Any wrapper around Archive::Zip
-
-=head1 SYNOPSIS
-
-B<DO NOT USE THIS MODULE DIRECTLY>
-
-Use Archive::Any instead.
-
-=head1 DESCRIPTION
-
-Wrapper around Archive::Zip for Archive::Any.
-
-=cut
-
sub can_handle {
- return(
- 'application/x-zip',
- 'application/x-jar',
- 'application/zip',
- );
+ return ( 'application/x-zip', 'application/x-jar', 'application/zip', );
}
sub files {
- my( $self, $file ) = @_;
+ my ( $self, $file ) = @_;
my $z = Archive::Zip->new( $file );
return $z->memberNames;
}
-
sub extract {
- my($self, $file) = @_;
+ my ( $self, $file ) = @_;
my $z = Archive::Zip->new( $file );
$z->extractTree;
@@ -54,11 +34,55 @@ sub type {
return 'zip';
}
+1;
-=head1 SEE ALSO
+# ABSTRACT: Archive::Any wrapper around Archive::Zip
-Archive::Any, Archive::Zip
+__END__
-=cut
+=pod
-1;
+=head1 NAME
+
+Archive::Any::Plugin::Zip - Archive::Any wrapper around Archive::Zip
+
+=head1 VERSION
+
+version 0.0941
+
+=head1 SYNOPSIS
+
+B<DO NOT USE THIS MODULE DIRECTLY>
+
+Use L<Archive::Any> instead.
+
+=head1 DESCRIPTION
+
+Wrapper around L<Archive::Zip> for L<Archive::Any>.
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Clint Moore
+
+=item *
+
+Michael G Schwern (author emeritus)
+
+=item *
+
+Olaf Alders (current maintainer)
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
@@ -1,4 +1,7 @@
package Archive::Any::Plugin;
+{
+ $Archive::Any::Plugin::VERSION = '0.0941';
+}
use strict;
use warnings;
@@ -6,17 +9,49 @@ use warnings;
use Module::Find;
use Cwd;
+sub _extract {
+ my ( $self, $file, $dir ) = @_;
+
+ my $orig_dir;
+ if ( defined $dir ) {
+ $orig_dir = getcwd;
+ chdir $dir;
+ }
+
+ my $success = $self->extract( $file );
+
+ if ( defined $dir ) {
+ chdir $orig_dir;
+ }
+
+ return 1;
+}
+
+1;
+
+# ABSTRACT: Anatomy of an Archive::Any plugin.
+
+__END__
+
+=pod
+
=head1 NAME
Archive::Any::Plugin - Anatomy of an Archive::Any plugin.
+=head1 VERSION
+
+version 0.0941
+
=head1 SYNOPSIS
Explains what is required for a working plugin to Archive::Any.
=head1 PLUGINS
-Archive::Any requires that your plugin define three methods, all of which are passed the absolute filename of the file. This module uses the source of Archive::Any::Plugin::Tar as an example.
+Archive::Any requires that your plugin define three methods, all of which are
+passed the absolute filename of the file. This module uses the source of
+Archive::Any::Plugin::Tar as an example.
=over 4
@@ -48,44 +83,45 @@ Return a list of items inside the archive.
=item B<extract>
-This method should extract the contents of $file to the current directory. L<Archive::Any::Plugin> handles negotiating directories for you.
+This method should extract the contents of $file to the current directory.
+L<Archive::Any::Plugin> handles negotiating directories for you.
sub extract {
my ( $self, $file ) = @_;
-
+
my $t = Archive::Tar->new( $file );
return $t->extract;
}
=back
-=head1 AUTHOR
-
-Clint Moore E<lt>cmoore@cpan.orgE<gt>
-
=head1 SEE ALSO
Archive::Any
-=cut
+=head1 AUTHORS
+=over 4
-sub _extract {
- my($self, $file, $dir) = @_;
+=item *
- my $orig_dir;
- if( defined $dir ) {
- $orig_dir = getcwd;
- chdir $dir;
- }
+Clint Moore
- my $success = $self->extract( $file );
+=item *
- if( defined $dir) {
- chdir $orig_dir;
- }
+Michael G Schwern (author emeritus)
- return 1;
-}
+=item *
-1;
+Olaf Alders (current maintainer)
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
@@ -0,0 +1,110 @@
+package Archive::Any::Tar;
+{
+ $Archive::Any::Tar::VERSION = '0.0941';
+}
+
+use strict;
+
+require Archive::Any;
+@ISA = qw(Archive::Any);
+
+use Archive::Tar;
+use Cwd;
+
+sub new {
+ my ( $class, $file ) = @_;
+
+ my $self = bless {}, $class;
+
+ $self->{handler} = Archive::Tar->new( $file );
+ return unless $self->{handler};
+
+ $self->{file} = $file;
+
+ return $self;
+}
+
+sub files {
+ my ( $self ) = shift;
+
+ $self->{handler}->list_files;
+}
+
+sub extract {
+ my ( $self, $dir ) = @_;
+
+ my $orig_dir;
+ if ( $dir ) {
+ $orig_dir = getcwd;
+ chdir $dir;
+ }
+
+ my $success = $self->{handler}->extract;
+
+ if ( $dir ) {
+ chdir $orig_dir;
+ }
+
+ return $success;
+}
+
+sub type {
+ return 'tar';
+}
+
+1;
+
+# ABSTRACT: Archive::Any wrapper around Archive::Tar
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Archive::Any::Tar - Archive::Any wrapper around Archive::Tar
+
+=head1 VERSION
+
+version 0.0941
+
+=head1 SYNOPSIS
+
+B<DO NOT USE THIS MODULE DIRECTLY>
+
+Use L<Archive::Any> instead.
+
+=head1 DESCRIPTION
+
+Wrapper around L<Archive::Tar> for L<Archive::Any>.
+
+=head1 SEE ALSO
+
+L<Archive::Any>, L<Archive::Tar>
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Clint Moore
+
+=item *
+
+Michael G Schwern (author emeritus)
+
+=item *
+
+Olaf Alders (current maintainer)
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
@@ -0,0 +1,108 @@
+package Archive::Any::Zip;
+{
+ $Archive::Any::Zip::VERSION = '0.0941';
+}
+
+use strict;
+
+require Archive::Any;
+@ISA = qw(Archive::Any);
+
+use Archive::Zip qw(:ERROR_CODES);
+use Cwd;
+
+sub new {
+ my ( $class, $file ) = @_;
+
+ my $self = bless {}, $class;
+
+ Archive::Zip::setErrorHandler( sub { } );
+ $self->{handler} = Archive::Zip->new( $file );
+ return unless $self->{handler};
+
+ $self->{file} = $file;
+
+ return $self;
+}
+
+sub files {
+ my ( $self ) = shift;
+
+ $self->{handler}->memberNames;
+}
+
+sub extract {
+ my ( $self, $dir ) = @_;
+
+ my $orig_dir;
+ if ( $dir ) {
+ $orig_dir = getcwd;
+ chdir $dir;
+ }
+
+ $self->{handler}->extractTree;
+
+ if ( $dir ) {
+ chdir $orig_dir;
+ }
+
+ return 1;
+}
+
+sub type {
+ return 'zip';
+}
+
+# ABSTRACT: Archive::Any wrapper around Archive::Zip
+
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Archive::Any::Zip - Archive::Any wrapper around Archive::Zip
+
+=head1 VERSION
+
+version 0.0941
+
+=head1 SYNOPSIS
+
+B<DO NOT USE THIS MODULE DIRECTLY>
+
+Use L<Archive::Any> instead.
+
+=head1 DESCRIPTION
+
+Wrapper around L<Archive::Zip> for L<Archive::Any>.
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Clint Moore
+
+=item *
+
+Michael G Schwern (author emeritus)
+
+=item *
+
+Olaf Alders (current maintainer)
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2013 by Olaf Alders.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
@@ -1,66 +1,188 @@
+package Archive::Any;
+{
+ $Archive::Any::VERSION = '0.0941';
+}
+
+use strict;
+use warnings;
+
+use Archive::Any::Plugin;
+use File::Spec::Functions qw( rel2abs splitdir );
+use File::MMagic;
+use MIME::Types qw(by_suffix);
+
+sub new {
+ my ( $class, $file, $type ) = @_;
+
+ $file = rel2abs( $file );
+ return unless -f $file;
+
+ my %available;
+
+ my @plugins = Archive::Any::Plugin->findsubmod;
+ foreach my $plugin ( @plugins ) {
+ eval "require $plugin";
+ next if $@;
+
+ my @types = $plugin->can_handle();
+ foreach my $type ( @types ) {
+ next if exists( $available{$type} );
+ $available{$type} = $plugin;
+ }
+ }
+
+ my $mime_type;
+
+ if ( $type ) {
+
+ # The user forced the type.
+ ( $mime_type ) = by_suffix( $type );
+ unless ( $mime_type ) {
+ warn "No mime type found for type '$type'";
+ return;
+ }
+ }
+ else {
+ # Autodetect the type.
+ $mime_type = File::MMagic->new()->checktype_filename( $file );
+ }
+
+ my $handler = $available{$mime_type};
+ if ( !$handler ) {
+ warn "No handler available for type '$mime_type'";
+ return;
+ }
+
+ return bless {
+ file => $file,
+ handler => $handler,
+ type => $mime_type,
+ }, $class;
+}
+
+sub extract {
+ my $self = shift;
+ my $dir = shift;
+
+ return defined( $dir )
+ ? $self->{handler}->_extract( $self->{file}, $dir )
+ : $self->{handler}->_extract( $self->{file} );
+}
+
+sub files {
+ my $self = shift;
+ return $self->{handler}->files( $self->{file} );
+}
+
+sub is_impolite {
+ my $self = shift;
+
+ my @files = $self->files;
+ my $first_file = $files[0];
+ my ( $first_dir ) = splitdir( $first_file );
+
+ return grep( !/^\Q$first_dir\E/, @files ) ? 1 : 0;
+}
+
+sub is_naughty {
+ my ( $self ) = shift;
+ return ( grep {m{^(?:/|(?:\./)*\.\./)}} $self->files ) ? 1 : 0;
+}
+
+sub mime_type {
+ my $self = shift;
+ return $self->{type};
+}
+
+#
+# This is not really here. You are not seeing this.
+#
+sub type {
+ my $self = shift;
+ return $self->{handler}->type();
+}
+
+# End of what you are not seeing.
+
+1;
+
+# ABSTRACT: Single interface to deal with file archives.
+
+__END__
+
+=pod
=head1 NAME
Archive::Any - Single interface to deal with file archives.
+=head1 VERSION
+
+version 0.0941
+
=head1 SYNOPSIS
- use Archive::Any;
+ use Archive::Any;
- my $archive = Archive::Any->new($archive_file);
+ my $archive = Archive::Any->new( $archive_file );
- my @files = $archive->files;
+ my @files = $archive->files;
- $archive->extract;
+ $archive->extract;
- my $type = $archive->type;
+ my $type = $archive->type;
- $archive->is_impolite;
- $archive->is_naughty;
+ $archive->is_impolite;
+ $archive->is_naughty;
=head1 DESCRIPTION
-This module is a single interface for manipulating different archive formats. Tarballs, zip files, etc.
+This module is a single interface for manipulating different archive formats.
+Tarballs, zip files, etc.
=over 4
=item B<new>
- my $archive = Archive::Any->new($archive_file);
- my $archive = Archive::Any->new($archive_file, $type);
+ my $archive = Archive::Any->new( $archive_file );
+ my $archive = Archive::Any->new( $archive_file, $type );
-$type is optional. It lets you force the file type in-case Archive::Any can't figure it out.
+$type is optional. It lets you force the file type in case Archive::Any can't
+figure it out.
=item B<extract>
- $archive->extract;
- $archive->extract($directory);
+ $archive->extract;
+ $archive->extract( $directory );
-Extracts the files in the archive to the given $directory. If no $directory is given, it will go into the current working directory.
+Extracts the files in the archive to the given $directory. If no $directory is
+given, it will go into the current working directory.
=item B<files>
- my @file = $archive->files;
+ my @file = $archive->files;
A list of files in the archive.
=item B<mime_type>
- my $mime_type = $archive->mime_type();
+ my $mime_type = $archive->mime_type();
Returns the mime type of the archive.
=item B<is_impolite>
- my $is_impolite = $archive->is_impolite;
+ my $is_impolite = $archive->is_impolite;
-Checks to see if this archive is going to unpack into the current directory rather than create its own.
+Checks to see if this archive is going to unpack into the current directory
+rather than create its own.
=item B<is_naughty>
- my $is_naughty = $archive->is_naughty;
+ my $is_naughty = $archive->is_naughty;
-Checks to see if this archive is going to unpack B<outside> the current directory.
+Checks to see if this archive is going to unpack B<outside> the current
+directory.
=back
@@ -70,23 +192,18 @@ Checks to see if this archive is going to unpack B<outside> the current director
=item B<type>
- my $type = $archive->type;
+ my $type = $archive->type;
-Returns the type of archive. This method is provided for backwards compatibility in the Tar and Zip plugins and will be going away B<soon> in favor of C<mime_type>.
+Returns the type of archive. This method is provided for backwards
+compatibility in the Tar and Zip plugins and will be going away B<soon> in
+favor of C<mime_type>.
=back
=head1 PLUGINS
-For detailed information on writing plugins to work with Archive::Any, please see the pod documentation for L<Archive::Any::Plugin>.
-
-=head1 AUTHOR
-
-Clint Moore E<lt>cmoore@cpan.orgE<gt>
-
-=head1 AUTHOR EMERITUS
-
-Michael G Schwern
+For detailed information on writing plugins to work with Archive::Any, please
+see the pod documentation for L<Archive::Any::Plugin>.
=head1 SEE ALSO
@@ -96,138 +213,45 @@ Archive::Any::Plugin
You can find documentation for this module with the perldoc command.
- perldoc Archive::Any
+ perldoc Archive::Any
You can also look for information at:
=over 4
-=item * AnnoCPAN: Annotated CPAN documentation
+=item * MetaCPAN
-L<http://annocpan.org/dist/Archive-Any>
+L<https://metacpan.org/module/Archive::Any>
-=item * CPAN Ratings
+=item * Issue tracker
-L<http://cpanratings.perl.org/d/Archive-Any>
-
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Archive-Any>
-
-=item * Search CPAN
-
-L<http://search.cpan.org/dist/Archive-Any>
+L<https://github.com/oalders/archive-any/issues>
=back
-=head1 LICENSE
-
-This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
-
-See L<http://www.perl.com/perl/misc/Artistic.html>
-
-=cut
-
-package Archive::Any;
-use strict;
-use warnings;
-
-use vars qw($VERSION);
-$VERSION = 0.0932;
-
-use Archive::Any::Plugin;
-use File::Spec::Functions qw( rel2abs splitdir );
-use File::MMagic;
-use MIME::Types qw(by_suffix);
-
-sub new {
- my ( $class, $file, $type ) = @_;
-
- $file = rel2abs($file);
- return unless -f $file;
-
- my %available;
-
- my @plugins = Archive::Any::Plugin->findsubmod;
- foreach my $plugin (@plugins) {
- eval "require $plugin";
- next if $@;
-
- my @types = $plugin->can_handle();
- foreach my $type ( @types ) {
- next if exists( $available{$type} );
- $available{$type} = $plugin;
- }
- }
-
- my $mime_type;
-
- if ($type) {
- # The user forced the type.
- ($mime_type) = by_suffix($type);
- unless( $mime_type ) {
- warn "No mime type found for type '$type'";
- return;
- }
- } else {
- # Autodetect the type.
- $mime_type = File::MMagic->new()->checktype_filename($file);
- }
+=head1 AUTHORS
- my $handler = $available{$mime_type};
- if( ! $handler ) {
- warn "No handler available for type '$mime_type'";
- return;
- }
+=over 4
- return bless {
- file => $file,
- handler => $handler,
- type => $mime_type,
- }, $class;
-}
+=item *
-sub extract {
- my $self = shift;
- my $dir = shift;
+Clint Moore
- return defined($dir)
- ? $self->{handler}->_extract( $self->{file}, $dir )
- : $self->{handler}->_extract( $self->{file} );
-}
+=item *
-sub files {
- my $self = shift;
- return $self->{handler}->files( $self->{file} );
-}
+Michael G Schwern (author emeritus)
-sub is_impolite {
- my $self = shift;
+=item *
- my @files = $self->files;
- my $first_file = $files[0];
- my ($first_dir) = splitdir($first_file);
+Olaf Alders (current maintainer)
- return grep( !/^\Q$first_dir\E/, @files ) ? 1 : 0;
-}
+=back
-sub is_naughty {
- my ($self) = shift;
- return ( grep { m{^(?:/|(?:\./)*\.\./)} } $self->files ) ? 1 : 0;
-}
+=head1 COPYRIGHT AND LICENSE
-sub mime_type {
- my $self = shift;
- return $self->{type};
-}
+This software is copyright (c) 2013 by Olaf Alders.
-#
-# This is not really here. You are not seeing this.
-#
-sub type {
- my $self = shift;
- return $self->{handler}->type();
-}
-# End of what you are not seeing.
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
-1;
+=cut
@@ -0,0 +1,21 @@
+perltidy version 20121207 log file on a darwin system, OLD_PERL_VERSION=5.018000
+Found Configuration File >>> /Users/olaf/.perltidyrc
+Configuration and command line parameters for this run:
+-pbp -nst -pt=0
+To find error messages search for 'WARNING' with your editor
+Indentation will be with 4 spaces
+Line 1 implies starting-indentation-level = 0
+The nesting depths in the table below are at the start of the lines.
+The indicated output line numbers are not always exact.
+ci = levels of continuation indentation; bk = 1 if in BLOCK, 0 if not.
+
+in:out indent c b nesting code + messages; (messages begin with >>>)
+lines levels i k (code begins with one '.' per indent level)
+------ ----- - - -------- -------------------------------------------
+L19:20 i0:0 0 1 { >>>Last line
+
+No indentation disagreement seen
+
+No lines exceeded 78 characters
+ Maximum output line length was 76 at line 16
+Suggest including 'use strict;'
@@ -2,7 +2,7 @@
use Test::More 'no_plan';
-use_ok('Archive::Any');
-use_ok('Archive::Any::Plugin');
-use_ok('Archive::Any::Plugin::Zip');
-use_ok('Archive::Any::Plugin::Tar');
+use_ok( 'Archive::Any' );
+use_ok( 'Archive::Any::Plugin' );
+use_ok( 'Archive::Any::Plugin::Zip' );
+use_ok( 'Archive::Any::Plugin::Tar' );
diff --git a/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/Acme-POE-Knee-1.10.zip b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/Acme-POE-Knee-1.10.zip
new file mode 100644
index 00000000..de65a960
Binary files /dev/null and b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/Acme-POE-Knee-1.10.zip differ
@@ -6,104 +6,112 @@ use Archive::Any;
use File::Spec::Functions qw(updir);
my %tests = (
- 't/lib.zip' => {
- impolite=> 0,
- naughty => 0,
- handler => 'Archive::Any::Plugin::Zip',
- type => 'zip',
- files => [qw(
- lib/
- lib/Archive/
- lib/Archive/Any.pm
- lib/Archive/Any/
- lib/Archive/Any/Tar.pm
- lib/Archive/Any/Zip.pm
- lib/Archive/Any/Zip.pm~
- lib/Archive/Any/Tar.pm~
- lib/Archive/Any.pm~
- )],
- },
- 't/lib.tgz' => {
- impolite => 0,
- naughty => 0,
- handler => 'Archive::Any::Plugin::Tar',
- type => 'tar',
- files => [qw(
- lib/
- lib/Archive/
- lib/Archive/Any.pm
- lib/Archive/Any/
- lib/Archive/Any/Tar.pm
- lib/Archive/Any/Zip.pm
- lib/Archive/Any/Zip.pm~
- lib/Archive/Any/Tar.pm~
- lib/Archive/Any.pm~
- )],
- },
- 't/impolite.tar.gz' => {
- impolite => 1,
- naughty => 0,
- handler => 'Archive::Any::Plugin::Tar',
- type => 'tar',
- files => [qw(
- type.t
- Any.t
- 00compile.t
- fail.t
- )],
- },
- 't/naughty.tar' => {
- impolite => 0,
- naughty => 1,
- handler => 'Archive::Any::Plugin::Tar',
- type => 'tar',
- files => [qw(
- /tmp/lib/
- /tmp/lib/Archive/
- /tmp/lib/Archive/Any/
- /tmp/lib/Archive/Any/Tar.pm
- /tmp/lib/Archive/Any/Zip.pm
- /tmp/lib/Archive/Any.pm
- )],
- },
+ 't/lib.zip' => {
+ impolite => 0,
+ naughty => 0,
+ handler => 'Archive::Any::Plugin::Zip',
+ type => 'zip',
+ files => [
+ qw(
+ lib/
+ lib/Archive/
+ lib/Archive/Any.pm
+ lib/Archive/Any/
+ lib/Archive/Any/Tar.pm
+ lib/Archive/Any/Zip.pm
+ lib/Archive/Any/Zip.pm~
+ lib/Archive/Any/Tar.pm~
+ lib/Archive/Any.pm~
+ )
+ ],
+ },
+ 't/lib.tgz' => {
+ impolite => 0,
+ naughty => 0,
+ handler => 'Archive::Any::Plugin::Tar',
+ type => 'tar',
+ files => [
+ qw(
+ lib/
+ lib/Archive/
+ lib/Archive/Any.pm
+ lib/Archive/Any/
+ lib/Archive/Any/Tar.pm
+ lib/Archive/Any/Zip.pm
+ lib/Archive/Any/Zip.pm~
+ lib/Archive/Any/Tar.pm~
+ lib/Archive/Any.pm~
+ )
+ ],
+ },
+ 't/impolite.tar.gz' => {
+ impolite => 1,
+ naughty => 0,
+ handler => 'Archive::Any::Plugin::Tar',
+ type => 'tar',
+ files => [
+ qw(
+ type.t
+ Any.t
+ 00compile.t
+ fail.t
+ )
+ ],
+ },
+ 't/naughty.tar' => {
+ impolite => 0,
+ naughty => 1,
+ handler => 'Archive::Any::Plugin::Tar',
+ type => 'tar',
+ files => [
+ qw(
+ /tmp/lib/
+ /tmp/lib/Archive/
+ /tmp/lib/Archive/Any/
+ /tmp/lib/Archive/Any/Tar.pm
+ /tmp/lib/Archive/Any/Zip.pm
+ /tmp/lib/Archive/Any.pm
+ )
+ ],
+ },
);
+while ( my ( $file, $expect ) = each %tests ) {
-while( my($file, $expect) = each %tests ) {
# Test it once with type auto-discover and once with the type
# forced. Forced typing was broken until 0.05.
- test_archive($file, $expect);
- test_archive($file, $expect, $expect->{type});
+ test_archive( $file, $expect );
+ test_archive( $file, $expect, $expect->{type} );
}
sub test_archive {
- my($file, $expect, $type) = @_;
+ my ( $file, $expect, $type ) = @_;
- my $archive = Archive::Any->new($file, $type);
+ my $archive = Archive::Any->new( $file, $type );
# And now we chdir out from under it. This causes serious problems
# if we're not careful to use absolute paths internally.
- chdir('t');
+ chdir( 't' );
- ok( defined $archive, "new($file)" );
- ok( $archive->isa('Archive::Any'), " it's an object" );
+ ok( defined $archive, "new($file)" );
+ ok( $archive->isa( 'Archive::Any' ), " it's an object" );
- ok( eq_set([$archive->files], $expect->{files}),
- ' lists the right files' );
+ ok( eq_set( [ $archive->files ], $expect->{files} ),
+ ' lists the right files' );
ok( $archive->type(), "backwards compatibility" );
-# is( $archive->handler, $expect->{handler}, ' right handler' );
+ # is( $archive->handler, $expect->{handler}, ' right handler' );
- is( $archive->is_impolite, $expect->{impolite}, " impolite?" );
- is( $archive->is_naughty, $expect->{naughty}, " naughty?" );
+ is( $archive->is_impolite, $expect->{impolite}, " impolite?" );
+ is( $archive->is_naughty, $expect->{naughty}, " naughty?" );
- unless( $archive->is_impolite || $archive->is_naughty ) {
- ok($archive->extract(), "extract($file)");
- foreach my $file (reverse $archive->files) {
+ unless ( $archive->is_impolite || $archive->is_naughty ) {
+ ok( $archive->extract(), "extract($file)" );
+ foreach my $file ( reverse $archive->files ) {
ok( -e $file, " $file" );
-d $file ? rmdir $file : unlink $file;
}
}
- chdir(updir);
+ chdir( updir );
}
diff --git a/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/LoadHtml.5_0.tar.gz b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/LoadHtml.5_0.tar.gz
new file mode 100644
index 00000000..6a4287f5
Binary files /dev/null and b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/LoadHtml.5_0.tar.gz differ
@@ -4,4 +4,4 @@ use Archive::Any;
use Test::More tests => 1;
chdir 't';
-ok( !Archive::Any->new("im_not_really_a.zip") );
+ok( !Archive::Any->new( "im_not_really_a.zip" ) );
diff --git a/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/im_not_really_a.zip b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/im_not_really_a.zip
new file mode 100644
index 00000000..080777b4
Binary files /dev/null and b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/im_not_really_a.zip differ
diff --git a/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/naughty.tar.gz b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/naughty.tar.gz
new file mode 100644
index 00000000..45f563f3
Binary files /dev/null and b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/naughty.tar.gz differ
@@ -1,9 +0,0 @@
-
-use Test::More;
-
-eval "use Test::Pod::Coverage";
-plan skip_all => "Test::Pod::Coverage required for testing POD" if $@;
-
-plan tests => 2;
-pod_coverage_ok( "Archive::Any", "Pod documentation coverage" );
-pod_coverage_ok( "Archive::Any::Plugin", "Plugin documentation coverage" );
@@ -1,7 +0,0 @@
-
-use Test::More;
-
-eval "use Test::Pod 1.00";
-plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
-all_pod_files_ok();
-
@@ -0,0 +1,19 @@
+#!perl
+
+BEGIN {
+ unless ($ENV{RELEASE_TESTING}) {
+ require Test::More;
+ Test::More::plan(skip_all => 'these tests are for release candidate testing');
+ }
+}
+
+
+use strict;
+use warnings;
+
+use Test::More 0.96 tests => 2;
+use_ok('Test::CPAN::Changes');
+subtest 'changes_ok' => sub {
+ changes_file_ok('Changes');
+};
+done_testing();
@@ -5,15 +5,17 @@ use Test::Warn;
use_ok 'Archive::Any';
-isa_ok( Archive::Any->new('t/naughty.tar', 'tar'), 'Archive::Any' );
+isa_ok( Archive::Any->new( 't/naughty.tar', 'tar' ), 'Archive::Any' );
# Recognizes tar files with weird extensions
-isa_ok( Archive::Any->new('t/naughty.hominawoof'), 'Archive::Any' );
+isa_ok( Archive::Any->new( 't/naughty.hominawoof' ), 'Archive::Any' );
warning_like {
- ok( !Archive::Any->new('t/naughty.tar', 'hominawoof') );
-} qr{No mime type found for type 'hominawoof'}, "right warning, unknown type";
+ ok( !Archive::Any->new( 't/naughty.tar', 'hominawoof' ) );
+}
+qr{No mime type found for type 'hominawoof'}, "right warning, unknown type";
warning_like {
- ok( !Archive::Any->new('t/garbage.foo' ) );
-} qr{No handler available for type 'text/plain'}, "right warning, no type";
+ ok( !Archive::Any->new( 't/garbage.foo' ) );
+}
+qr{No handler available for type 'text/plain'}, "right warning, no type";
diff --git a/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/your-0.01.tar.gz b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/your-0.01.tar.gz
new file mode 100644
index 00000000..8ebb7d9e
Binary files /dev/null and b/var/tmp/source/OALDERS/Archive-Any-0.0941/Archive-Any-0.0941/t/your-0.01.tar.gz differ