@@ -1,3 +1,38 @@
+1.12 2015-03-07
+
+- The constructor now accepts named params. In addition to a magic_file param,
+ it now accepts follow_symlinks and uncompress params. These do what you'd
+ expect, tell the object to follow symlinks and/or uncompress files when
+ getting info from them. The old single parameter constructor is still
+ supported, but is no longer documented.
+
+- The old APIs are now called "discouraged" rather than "deprecated" in the
+ documentation. I have no plan to remove these APIs any time soon or to make
+ them warn, so "deprecated" was too strong a word.
+
+- Changed a test to hopefully skip rather than fail on OpenBSD systems.
+
+
+1.11 2015-03-01
+
+- The info_from_handle() method did not handle binary data correctly, which
+ could lead to incorrect results.
+
+- The info_from_*() methods returned a full mime type with encoding in the
+ "mime_type" key rather than just the mime type alone.
+
+- Allow File::LibMagic->new() to accept an array reference containing multiple
+ magic file paths.
+
+
+1.10 2015-02-01
+
+- Fixed Makefile.PL to actually use --lib and --include properly. Previously
+ it did the wrong thing with both of these arguments, and they were
+ essentially ignored. Reported by WATANABE Hiroaki. Patch by Mithun
+ Ayachit. RT #101715.
+
+
1.09 2014-12-20
- No code changes. This release just removes some junk that accidentally ended
@@ -1,4 +1,4 @@
-This software is copyright (c) 2014 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
+This software is copyright (c) 2015 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2014 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
+This software is Copyright (c) 2015 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
This is free software, licensed under:
@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2014 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
+This software is Copyright (c) 2015 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
This is free software, licensed under:
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.029.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.032.
Changes
INSTALL.md
LICENSE
@@ -19,19 +19,22 @@ inc/MyMakeMaker.pm
lib/File/LibMagic.pm
lib/File/LibMagic.xs
lib/File/typemap
+perlcriticrc
+perltidyrc
ppport.h
t/00-compile.t
t/00-report-prereqs.dd
t/00-report-prereqs.t
-t/all-exports.t
t/author-eol.t
t/author-no-tabs.t
t/author-pod-spell.t
-t/basic.t
-t/complete-interface-errors.t
-t/complete-interface.t
-t/easy-interface.t
+t/constructor-params.t
t/lib/Test/AnyOf.pm
+t/lib/Test/Exports.pm
+t/old-apis/all-exports.t
+t/old-apis/complete-interface-errors.t
+t/old-apis/complete-interface.t
+t/old-apis/easy-interface.t
t/oo-api.t
t/release-cpan-changes.t
t/release-pod-coverage.t
@@ -39,9 +42,15 @@ t/release-pod-linkcheck.t
t/release-pod-syntax.t
t/release-portability.t
t/release-synopsis.t
+t/release-test-version.t
+t/release-tidyall.t
t/samples/foo.c
t/samples/foo.foo
t/samples/foo.txt
t/samples/magic
t/samples/magic.mime
+t/samples/tiny-pdf.gz
+t/samples/tiny.pdf
t/version.t
+tidyall.ini
+weaver.ini
@@ -6,38 +6,45 @@
"Dave Rolsky <autarch@urth.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 5.029, CPAN::Meta::Converter version 2.143240",
+ "generated_by" : "Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "File-LibMagic",
"prereqs" : {
"configure" : {
"requires" : {
+ "ExtUtils::CBuilder" : "0",
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
+ "Code::TidyAll" : "0.24",
+ "Perl::Critic" : "1.123",
+ "Perl::Tidy" : "20140711",
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Changes" : "0.19",
+ "Test::Code::TidyAll" : "0.24",
"Test::EOL" : "0",
"Test::More" : "0.88",
"Test::NoTabs" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08",
"Test::Spelling" : "0.12",
- "Test::Synopsis" : "0"
+ "Test::Synopsis" : "0",
+ "Test::Version" : "1"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Exporter" : "0",
+ "Scalar::Util" : "0",
"XSLoader" : "0",
"base" : "0",
"perl" : "5.008",
@@ -50,11 +57,14 @@
"CPAN::Meta" : "2.120900"
},
"requires" : {
+ "Cwd" : "0",
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
+ "File::Temp" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
- "Test::More" : "0.88",
+ "Test::Fatal" : "0",
+ "Test::More" : "0.96",
"lib" : "0"
}
}
@@ -62,7 +72,7 @@
"provides" : {
"File::LibMagic" : {
"file" : "lib/File/LibMagic.pm",
- "version" : "1.09"
+ "version" : "1.12"
}
},
"release_status" : "stable",
@@ -78,10 +88,10 @@
"web" : "https://github.com/autarch/File-LibMagic"
}
},
- "version" : "1.09",
+ "version" : "1.12",
"x_Dist_Zilla" : {
"perl" : {
- "version" : "5.016003"
+ "version" : "5.020001"
},
"plugins" : [
{
@@ -92,22 +102,22 @@
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "@DROLSKY/AutoPrereqs",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::CopyFilesFromBuild",
"name" : "@DROLSKY/CopyFilesFromBuild",
- "version" : "0.103510"
+ "version" : "0.150250"
},
{
"class" : "Dist::Zilla::Plugin::Git::GatherDir",
"config" : {
"Dist::Zilla::Plugin::GatherDir" : {
"exclude_filename" : [
+ "LICENSE",
"README.md",
"cpanfile",
"Makefile.PL",
- "LICENSE",
"Build.PL"
],
"exclude_match" : [],
@@ -125,22 +135,22 @@
}
},
"name" : "@DROLSKY/Git::GatherDir",
- "version" : "2.028"
+ "version" : "2.030"
},
{
"class" : "Dist::Zilla::Plugin::GitHub::Meta",
"name" : "@DROLSKY/GitHub::Meta",
- "version" : "0.38"
+ "version" : "0.40"
},
{
"class" : "Dist::Zilla::Plugin::GitHub::Update",
"name" : "@DROLSKY/GitHub::Update",
- "version" : "0.38"
+ "version" : "0.40"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@DROLSKY/MetaResources",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::MetaProvides::Package",
@@ -150,7 +160,7 @@
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
- "version" : "5.029"
+ "version" : "5.032"
}
]
},
@@ -161,12 +171,12 @@
}
},
"name" : "@DROLSKY/MetaProvides::Package",
- "version" : "2.001002"
+ "version" : "2.003001"
},
{
"class" : "Dist::Zilla::Plugin::NextRelease",
"name" : "@DROLSKY/NextRelease",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
@@ -176,8 +186,19 @@
"type" : "requires"
}
},
- "name" : "@DROLSKY/TestMoreDoneTesting",
- "version" : "5.029"
+ "name" : "@DROLSKY/Test::More with subtest()",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "develop",
+ "type" : "requires"
+ }
+ },
+ "name" : "@DROLSKY/Modules for use with tidyall",
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::PromptIfStale",
@@ -189,27 +210,28 @@
"phase" : "release",
"skip" : [
"Dist::Zilla::Plugin::DROLSKY::Contributors",
- "Dist::Zilla::Plugin::DROLSKY::License"
+ "Dist::Zilla::Plugin::DROLSKY::License",
+ "Dist::Zilla::Plugin::DROLSKY::TidyAll"
]
}
},
- "name" : "@DROLSKY/stale modules, release",
- "version" : "0.032"
+ "name" : "@DROLSKY/PromptIfStale",
+ "version" : "0.039"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
- "name" : "@DROLSKY/ReadmeMarkdownInBuild",
- "version" : "0.142470"
+ "name" : "@DROLSKY/README.md in build",
+ "version" : "0.150250"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
- "name" : "@DROLSKY/ReadmeMarkdownInRoot",
- "version" : "0.142470"
+ "name" : "@DROLSKY/README.md in root",
+ "version" : "0.150250"
},
{
"class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable",
"name" : "@DROLSKY/Test::Pod::Coverage::Configurable",
- "version" : "0.02"
+ "version" : "0.04"
},
{
"class" : "Dist::Zilla::Plugin::Test::PodSpelling",
@@ -219,77 +241,92 @@
{
"class" : "Dist::Zilla::Plugin::Test::ReportPrereqs",
"name" : "@DROLSKY/Test::ReportPrereqs",
- "version" : "0.019"
+ "version" : "0.020"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Test::Version",
+ "name" : "@DROLSKY/Test::Version",
+ "version" : "0.003001"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@DROLSKY/ManifestSkip",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@DROLSKY/MetaYAML",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@DROLSKY/License",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@DROLSKY/ExtraTests",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@DROLSKY/ExecDir",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@DROLSKY/ShareDir",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@DROLSKY/Manifest",
- "version" : "5.029"
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::CheckVersionIncrement",
+ "name" : "@DROLSKY/CheckVersionIncrement",
+ "version" : "0.121750"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@DROLSKY/TestRelease",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@DROLSKY/ConfirmRelease",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@DROLSKY/UploadToCPAN",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed",
"name" : "@DROLSKY/CheckPrereqsIndexed",
- "version" : "0.013"
+ "version" : "0.015"
},
{
"class" : "Dist::Zilla::Plugin::CPANFile",
"name" : "@DROLSKY/CPANFile",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::DROLSKY::Contributors",
"name" : "@DROLSKY/DROLSKY::Contributors",
- "version" : "0.27"
+ "version" : "0.32"
},
{
"class" : "Dist::Zilla::Plugin::DROLSKY::License",
"name" : "@DROLSKY/DROLSKY::License",
- "version" : "0.27"
+ "version" : "0.32"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::DROLSKY::TidyAll",
+ "name" : "@DROLSKY/DROLSKY::TidyAll",
+ "version" : "0.32"
},
{
"class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch",
@@ -299,7 +336,7 @@
}
},
"name" : "@DROLSKY/Git::CheckFor::CorrectBranch",
- "version" : "0.011"
+ "version" : "0.012"
},
{
"class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts",
@@ -309,7 +346,7 @@
}
},
"name" : "@DROLSKY/Git::CheckFor::MergeConflicts",
- "version" : "0.011"
+ "version" : "0.012"
},
{
"class" : "Dist::Zilla::Plugin::Git::Contributors",
@@ -322,12 +359,7 @@
}
},
"name" : "@DROLSKY/Git::Contributors",
- "version" : "0.008"
- },
- {
- "class" : "Dist::Zilla::Plugin::Git::Describe",
- "name" : "@DROLSKY/Git::Describe",
- "version" : "0.003"
+ "version" : "0.010"
},
{
"class" : "Dist::Zilla::Plugin::Meta::Contributors",
@@ -337,12 +369,17 @@
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@DROLSKY/MetaConfig",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@DROLSKY/MetaJSON",
- "version" : "5.029"
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::RewriteVersion",
+ "name" : "@DROLSKY/RewriteVersion",
+ "version" : "0.009"
},
{
"class" : "Dist::Zilla::Plugin::SurgicalPodWeaver",
@@ -356,62 +393,62 @@
{
"class" : "Pod::Weaver::Plugin::EnsurePod5",
"name" : "@CorePrep/EnsurePod5",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Plugin::H1Nester",
"name" : "@CorePrep/H1Nester",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Name",
"name" : "Name",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Version",
"name" : "Version",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "prelude",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "SYNOPSIS",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "DESCRIPTION",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Leftovers",
"name" : "Leftovers",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "postlude",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Authors",
"name" : "Authors",
- "version" : "4.008"
+ "version" : "4.010"
},
{
"class" : "Pod::Weaver::Section::Contributors",
"name" : "Contributors",
- "version" : "0.008"
+ "version" : "0.009"
},
{
"class" : "Pod::Weaver::Section::Legal",
"name" : "Legal",
- "version" : "4.008"
+ "version" : "4.010"
}
]
}
@@ -422,12 +459,12 @@
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@DROLSKY/PodSyntaxTests",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::Test::CPAN::Changes",
"name" : "@DROLSKY/Test::CPAN::Changes",
- "version" : "0.008"
+ "version" : "0.009"
},
{
"class" : "Dist::Zilla::Plugin::Test::Compile",
@@ -455,11 +492,17 @@
"class" : "Dist::Zilla::Plugin::Test::EOL",
"config" : {
"Dist::Zilla::Plugin::Test::EOL" : {
- "filename" : "xt/author/eol.t"
+ "filename" : "xt/author/eol.t",
+ "finder" : [
+ ":InstallModules",
+ ":ExecFiles",
+ ":TestFiles"
+ ],
+ "trailing_whitespace" : "1"
}
},
"name" : "@DROLSKY/Test::EOL",
- "version" : "0.16"
+ "version" : "0.17"
},
{
"class" : "Dist::Zilla::Plugin::Test::NoTabs",
@@ -474,7 +517,7 @@
}
},
"name" : "@DROLSKY/Test::NoTabs",
- "version" : "0.09"
+ "version" : "0.13"
},
{
"class" : "Dist::Zilla::Plugin::Test::Pod::LinkCheck",
@@ -484,12 +527,17 @@
{
"class" : "Dist::Zilla::Plugin::Test::Portability",
"name" : "@DROLSKY/Test::Portability",
- "version" : "2.000005"
+ "version" : "2.000006"
},
{
"class" : "Dist::Zilla::Plugin::Test::Synopsis",
"name" : "@DROLSKY/Test::Synopsis",
- "version" : "2.000005"
+ "version" : "2.000006"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Test::TidyAll",
+ "name" : "@DROLSKY/Test::TidyAll",
+ "version" : "0.01"
},
{
"class" : "Dist::Zilla::Plugin::Git::Check",
@@ -499,10 +547,10 @@
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
"allow_dirty" : [
+ "LICENSE",
"README.md",
"cpanfile",
"Makefile.PL",
- "LICENSE",
"Build.PL",
"Changes",
"CONTRIBUTING.md"
@@ -515,7 +563,7 @@
}
},
"name" : "@DROLSKY/Git::Check",
- "version" : "2.028"
+ "version" : "2.030"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
@@ -527,10 +575,10 @@
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
"allow_dirty" : [
+ "LICENSE",
"README.md",
"cpanfile",
"Makefile.PL",
- "LICENSE",
"Build.PL",
"Changes",
"CONTRIBUTING.md"
@@ -542,8 +590,8 @@
"repo_root" : "."
}
},
- "name" : "@DROLSKY/Git::Commit",
- "version" : "2.028"
+ "name" : "@DROLSKY/commit generated files",
+ "version" : "2.030"
},
{
"class" : "Dist::Zilla::Plugin::Git::Tag",
@@ -551,7 +599,7 @@
"Dist::Zilla::Plugin::Git::Tag" : {
"branch" : null,
"signed" : 0,
- "tag" : "v1.09",
+ "tag" : "v1.12",
"tag_format" : "v%v",
"tag_message" : "v%v",
"time_zone" : "local"
@@ -561,7 +609,7 @@
}
},
"name" : "@DROLSKY/Git::Tag",
- "version" : "2.028"
+ "version" : "2.030"
},
{
"class" : "Dist::Zilla::Plugin::Git::Push",
@@ -577,49 +625,19 @@
}
},
"name" : "@DROLSKY/Git::Push",
- "version" : "2.028"
- },
- {
- "class" : "inc::MyMakeMaker",
- "config" : {
- "Dist::Zilla::Role::TestRunner" : {
- "default_jobs" : 1
- }
- },
- "name" : "=inc::MyMakeMaker",
- "version" : null
- },
- {
- "class" : "inc::MyInstallGuide",
- "name" : "=inc::MyInstallGuide",
- "version" : null
- },
- {
- "class" : "Dist::Zilla::Plugin::FileFinder::Filter",
- "name" : "VersionedModules",
- "version" : "5.029"
- },
- {
- "class" : "Dist::Zilla::Plugin::RewriteVersion",
- "name" : "RewriteVersion",
- "version" : "0.008"
- },
- {
- "class" : "Dist::Zilla::Plugin::CheckVersionIncrement",
- "name" : "CheckVersionIncrement",
- "version" : "0.121750"
+ "version" : "2.030"
},
{
"class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease",
- "name" : "BumpVersionAfterRelease",
- "version" : "0.008"
+ "name" : "@DROLSKY/BumpVersionAfterRelease",
+ "version" : "0.009"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"config" : {
"Dist::Zilla::Plugin::Git::Commit" : {
"add_files_in" : [],
- "commit_msg" : "increment version after release",
+ "commit_msg" : "Bump version after release",
"time_zone" : "local"
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
@@ -628,7 +646,7 @@
"Changes"
],
"allow_dirty_match" : [
- "(?^u:^lib/.*\\.pm$)"
+ "(?^:.+)"
],
"changelog" : "Changes"
},
@@ -636,53 +654,100 @@
"repo_root" : "."
}
},
- "name" : "increment version",
- "version" : "2.028"
+ "name" : "@DROLSKY/commit version bump",
+ "version" : "2.030"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Push",
+ "config" : {
+ "Dist::Zilla::Plugin::Git::Push" : {
+ "push_to" : [
+ "origin"
+ ],
+ "remotes_must_exist" : 1
+ },
+ "Dist::Zilla::Role::Git::Repo" : {
+ "repo_root" : "."
+ }
+ },
+ "name" : "@DROLSKY/push version bump",
+ "version" : "2.030"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "configure",
+ "type" : "requires"
+ }
+ },
+ "name" : "ConfigureRequires",
+ "version" : "5.032"
+ },
+ {
+ "class" : "inc::MyMakeMaker",
+ "config" : {
+ "Dist::Zilla::Role::TestRunner" : {
+ "default_jobs" : 1
+ }
+ },
+ "name" : "=inc::MyMakeMaker",
+ "version" : null
+ },
+ {
+ "class" : "inc::MyInstallGuide",
+ "name" : "=inc::MyInstallGuide",
+ "version" : null
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Encoding",
+ "name" : "Encoding",
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
- "version" : "5.029"
+ "version" : "5.032"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : "@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
- "version" : "5.029"
+ "version" : "5.032"
}
],
"zilla" : {
@@ -690,11 +755,12 @@
"config" : {
"is_trial" : "0"
},
- "version" : "5.029"
+ "version" : "5.032"
}
},
"x_authority" : "cpan:DROLSKY",
"x_contributors" : [
+ "Mithun Ayachit <mayachit@amfam.com>",
"Olaf Alders <olaf@wundersolutions.com>"
]
}
@@ -5,16 +5,20 @@ author:
- 'Michael Hendricks <michael@ndrix.org>'
- 'Dave Rolsky <autarch@urth.org>'
build_requires:
+ Cwd: '0'
ExtUtils::MakeMaker: '0'
File::Spec: '0'
+ File::Temp: '0'
IO::Handle: '0'
IPC::Open3: '0'
- Test::More: '0.88'
+ Test::Fatal: '0'
+ Test::More: '0.96'
lib: '0'
configure_requires:
+ ExtUtils::CBuilder: '0'
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.029, CPAN::Meta::Converter version 2.143240'
+generated_by: 'Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,10 +27,11 @@ name: File-LibMagic
provides:
File::LibMagic:
file: lib/File/LibMagic.pm
- version: '1.09'
+ version: '1.12'
requires:
Carp: '0'
Exporter: '0'
+ Scalar::Util: '0'
XSLoader: '0'
base: '0'
perl: '5.008'
@@ -36,10 +41,10 @@ resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=File::LibMagic
homepage: http://metacpan.org/release/File::LibMagic
repository: git://github.com/autarch/File-LibMagic.git
-version: '1.09'
+version: '1.12'
x_Dist_Zilla:
perl:
- version: '5.016003'
+ version: '5.020001'
plugins:
-
class: Dist::Zilla::Plugin::Authority
@@ -48,20 +53,20 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::AutoPrereqs
name: '@DROLSKY/AutoPrereqs'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::CopyFilesFromBuild
name: '@DROLSKY/CopyFilesFromBuild'
- version: '0.103510'
+ version: '0.150250'
-
class: Dist::Zilla::Plugin::Git::GatherDir
config:
Dist::Zilla::Plugin::GatherDir:
exclude_filename:
+ - LICENSE
- README.md
- cpanfile
- Makefile.PL
- - LICENSE
- Build.PL
exclude_match: []
follow_symlinks: '0'
@@ -74,19 +79,19 @@ x_Dist_Zilla:
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::GatherDir'
- version: '2.028'
+ version: '2.030'
-
class: Dist::Zilla::Plugin::GitHub::Meta
name: '@DROLSKY/GitHub::Meta'
- version: '0.38'
+ version: '0.40'
-
class: Dist::Zilla::Plugin::GitHub::Update
name: '@DROLSKY/GitHub::Update'
- version: '0.38'
+ version: '0.40'
-
class: Dist::Zilla::Plugin::MetaResources
name: '@DROLSKY/MetaResources'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::MetaProvides::Package
config:
@@ -95,25 +100,33 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::FinderCode
name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
- version: '5.029'
+ version: '5.032'
Dist::Zilla::Role::MetaProvider::Provider:
inherit_missing: '1'
inherit_version: '1'
meta_noindex: '1'
name: '@DROLSKY/MetaProvides::Package'
- version: '2.001002'
+ version: '2.003001'
-
class: Dist::Zilla::Plugin::NextRelease
name: '@DROLSKY/NextRelease'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
type: requires
- name: '@DROLSKY/TestMoreDoneTesting'
- version: '5.029'
+ name: '@DROLSKY/Test::More with subtest()'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: develop
+ type: requires
+ name: '@DROLSKY/Modules for use with tidyall'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::PromptIfStale
config:
@@ -125,20 +138,21 @@ x_Dist_Zilla:
skip:
- Dist::Zilla::Plugin::DROLSKY::Contributors
- Dist::Zilla::Plugin::DROLSKY::License
- name: '@DROLSKY/stale modules, release'
- version: '0.032'
+ - Dist::Zilla::Plugin::DROLSKY::TidyAll
+ name: '@DROLSKY/PromptIfStale'
+ version: '0.039'
-
class: Dist::Zilla::Plugin::ReadmeAnyFromPod
- name: '@DROLSKY/ReadmeMarkdownInBuild'
- version: '0.142470'
+ name: '@DROLSKY/README.md in build'
+ version: '0.150250'
-
class: Dist::Zilla::Plugin::ReadmeAnyFromPod
- name: '@DROLSKY/ReadmeMarkdownInRoot'
- version: '0.142470'
+ name: '@DROLSKY/README.md in root'
+ version: '0.150250'
-
class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable
name: '@DROLSKY/Test::Pod::Coverage::Configurable'
- version: '0.02'
+ version: '0.04'
-
class: Dist::Zilla::Plugin::Test::PodSpelling
name: '@DROLSKY/Test::PodSpelling'
@@ -146,77 +160,89 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Test::ReportPrereqs
name: '@DROLSKY/Test::ReportPrereqs'
- version: '0.019'
+ version: '0.020'
+ -
+ class: Dist::Zilla::Plugin::Test::Version
+ name: '@DROLSKY/Test::Version'
+ version: '0.003001'
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@DROLSKY/ManifestSkip'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@DROLSKY/MetaYAML'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::License
name: '@DROLSKY/License'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@DROLSKY/ExtraTests'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@DROLSKY/ExecDir'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@DROLSKY/ShareDir'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::Manifest
name: '@DROLSKY/Manifest'
- version: '5.029'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::CheckVersionIncrement
+ name: '@DROLSKY/CheckVersionIncrement'
+ version: '0.121750'
-
class: Dist::Zilla::Plugin::TestRelease
name: '@DROLSKY/TestRelease'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@DROLSKY/ConfirmRelease'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@DROLSKY/UploadToCPAN'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::CheckPrereqsIndexed
name: '@DROLSKY/CheckPrereqsIndexed'
- version: '0.013'
+ version: '0.015'
-
class: Dist::Zilla::Plugin::CPANFile
name: '@DROLSKY/CPANFile'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::DROLSKY::Contributors
name: '@DROLSKY/DROLSKY::Contributors'
- version: '0.27'
+ version: '0.32'
-
class: Dist::Zilla::Plugin::DROLSKY::License
name: '@DROLSKY/DROLSKY::License'
- version: '0.27'
+ version: '0.32'
+ -
+ class: Dist::Zilla::Plugin::DROLSKY::TidyAll
+ name: '@DROLSKY/DROLSKY::TidyAll'
+ version: '0.32'
-
class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch
config:
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::CheckFor::CorrectBranch'
- version: '0.011'
+ version: '0.012'
-
class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts
config:
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::CheckFor::MergeConflicts'
- version: '0.011'
+ version: '0.012'
-
class: Dist::Zilla::Plugin::Git::Contributors
config:
@@ -226,11 +252,7 @@ x_Dist_Zilla:
order_by: name
paths: []
name: '@DROLSKY/Git::Contributors'
- version: '0.008'
- -
- class: Dist::Zilla::Plugin::Git::Describe
- name: '@DROLSKY/Git::Describe'
- version: '0.003'
+ version: '0.010'
-
class: Dist::Zilla::Plugin::Meta::Contributors
name: '@DROLSKY/Meta::Contributors'
@@ -238,11 +260,15 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@DROLSKY/MetaConfig'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@DROLSKY/MetaJSON'
- version: '5.029'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::RewriteVersion
+ name: '@DROLSKY/RewriteVersion'
+ version: '0.009'
-
class: Dist::Zilla::Plugin::SurgicalPodWeaver
config:
@@ -254,61 +280,61 @@ x_Dist_Zilla:
-
class: Pod::Weaver::Plugin::EnsurePod5
name: '@CorePrep/EnsurePod5'
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Plugin::H1Nester
name: '@CorePrep/H1Nester'
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Name
name: Name
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Version
name: Version
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Region
name: prelude
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Generic
name: SYNOPSIS
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Generic
name: DESCRIPTION
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Leftovers
name: Leftovers
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Region
name: postlude
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Authors
name: Authors
- version: '4.008'
+ version: '4.010'
-
class: Pod::Weaver::Section::Contributors
name: Contributors
- version: '0.008'
+ version: '0.009'
-
class: Pod::Weaver::Section::Legal
name: Legal
- version: '4.008'
+ version: '4.010'
name: '@DROLSKY/SurgicalPodWeaver'
version: '0.0023'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@DROLSKY/PodSyntaxTests'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::Test::CPAN::Changes
name: '@DROLSKY/Test::CPAN::Changes'
- version: '0.008'
+ version: '0.009'
-
class: Dist::Zilla::Plugin::Test::Compile
config:
@@ -331,8 +357,13 @@ x_Dist_Zilla:
config:
Dist::Zilla::Plugin::Test::EOL:
filename: xt/author/eol.t
+ finder:
+ - ':InstallModules'
+ - ':ExecFiles'
+ - ':TestFiles'
+ trailing_whitespace: '1'
name: '@DROLSKY/Test::EOL'
- version: '0.16'
+ version: '0.17'
-
class: Dist::Zilla::Plugin::Test::NoTabs
config:
@@ -343,7 +374,7 @@ x_Dist_Zilla:
- ':ExecFiles'
- ':TestFiles'
name: '@DROLSKY/Test::NoTabs'
- version: '0.09'
+ version: '0.13'
-
class: Dist::Zilla::Plugin::Test::Pod::LinkCheck
name: '@DROLSKY/Test::Pod::LinkCheck'
@@ -351,11 +382,15 @@ x_Dist_Zilla:
-
class: Dist::Zilla::Plugin::Test::Portability
name: '@DROLSKY/Test::Portability'
- version: '2.000005'
+ version: '2.000006'
-
class: Dist::Zilla::Plugin::Test::Synopsis
name: '@DROLSKY/Test::Synopsis'
- version: '2.000005'
+ version: '2.000006'
+ -
+ class: Dist::Zilla::Plugin::Test::TidyAll
+ name: '@DROLSKY/Test::TidyAll'
+ version: '0.01'
-
class: Dist::Zilla::Plugin::Git::Check
config:
@@ -363,10 +398,10 @@ x_Dist_Zilla:
untracked_files: die
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
+ - LICENSE
- README.md
- cpanfile
- Makefile.PL
- - LICENSE
- Build.PL
- Changes
- CONTRIBUTING.md
@@ -375,7 +410,7 @@ x_Dist_Zilla:
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::Check'
- version: '2.028'
+ version: '2.030'
-
class: Dist::Zilla::Plugin::Git::Commit
config:
@@ -385,10 +420,10 @@ x_Dist_Zilla:
time_zone: local
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
+ - LICENSE
- README.md
- cpanfile
- Makefile.PL
- - LICENSE
- Build.PL
- Changes
- CONTRIBUTING.md
@@ -396,22 +431,22 @@ x_Dist_Zilla:
changelog: Changes
Dist::Zilla::Role::Git::Repo:
repo_root: .
- name: '@DROLSKY/Git::Commit'
- version: '2.028'
+ name: '@DROLSKY/commit generated files'
+ version: '2.030'
-
class: Dist::Zilla::Plugin::Git::Tag
config:
Dist::Zilla::Plugin::Git::Tag:
branch: ~
signed: 0
- tag: v1.09
+ tag: v1.12
tag_format: v%v
tag_message: v%v
time_zone: local
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::Tag'
- version: '2.028'
+ version: '2.030'
-
class: Dist::Zilla::Plugin::Git::Push
config:
@@ -422,93 +457,105 @@ x_Dist_Zilla:
Dist::Zilla::Role::Git::Repo:
repo_root: .
name: '@DROLSKY/Git::Push'
- version: '2.028'
- -
- class: inc::MyMakeMaker
- config:
- Dist::Zilla::Role::TestRunner:
- default_jobs: 1
- name: =inc::MyMakeMaker
- version: ~
- -
- class: inc::MyInstallGuide
- name: =inc::MyInstallGuide
- version: ~
- -
- class: Dist::Zilla::Plugin::FileFinder::Filter
- name: VersionedModules
- version: '5.029'
- -
- class: Dist::Zilla::Plugin::RewriteVersion
- name: RewriteVersion
- version: '0.008'
- -
- class: Dist::Zilla::Plugin::CheckVersionIncrement
- name: CheckVersionIncrement
- version: '0.121750'
+ version: '2.030'
-
class: Dist::Zilla::Plugin::BumpVersionAfterRelease
- name: BumpVersionAfterRelease
- version: '0.008'
+ name: '@DROLSKY/BumpVersionAfterRelease'
+ version: '0.009'
-
class: Dist::Zilla::Plugin::Git::Commit
config:
Dist::Zilla::Plugin::Git::Commit:
add_files_in: []
- commit_msg: 'increment version after release'
+ commit_msg: 'Bump version after release'
time_zone: local
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
- dist.ini
- Changes
allow_dirty_match:
- - (?^u:^lib/.*\.pm$)
+ - (?^:.+)
changelog: Changes
Dist::Zilla::Role::Git::Repo:
repo_root: .
- name: 'increment version'
- version: '2.028'
+ name: '@DROLSKY/commit version bump'
+ version: '2.030'
+ -
+ class: Dist::Zilla::Plugin::Git::Push
+ config:
+ Dist::Zilla::Plugin::Git::Push:
+ push_to:
+ - origin
+ remotes_must_exist: 1
+ Dist::Zilla::Role::Git::Repo:
+ repo_root: .
+ name: '@DROLSKY/push version bump'
+ version: '2.030'
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: configure
+ type: requires
+ name: ConfigureRequires
+ version: '5.032'
+ -
+ class: inc::MyMakeMaker
+ config:
+ Dist::Zilla::Role::TestRunner:
+ default_jobs: 1
+ name: =inc::MyMakeMaker
+ version: ~
+ -
+ class: inc::MyInstallGuide
+ name: =inc::MyInstallGuide
+ version: ~
+ -
+ class: Dist::Zilla::Plugin::Encoding
+ name: Encoding
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':AllFiles'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':NoFiles'
- version: '5.029'
+ version: '5.032'
-
class: Dist::Zilla::Plugin::FinderCode
name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
- version: '5.029'
+ version: '5.032'
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: '0'
- version: '5.029'
+ version: '5.032'
x_authority: cpan:DROLSKY
x_contributors:
+ - 'Mithun Ayachit <mayachit@amfam.com>'
- 'Olaf Alders <olaf@wundersolutions.com>'
@@ -1,6 +1,6 @@
# This Makefile.PL for File-LibMagic was generated by
# inc::MyMakeMaker <self>
-# and Dist::Zilla::Plugin::MakeMaker::Awesome 0.32.
+# and Dist::Zilla::Plugin::MakeMaker::Awesome 0.33.
# Don't edit it but the dist.ini and plugins used to construct it.
use strict;
@@ -16,15 +16,14 @@ my %WriteMakefileArgs = (
"lib/File/LibMagic.c"
],
"CONFIGURE_REQUIRES" => {
+ "ExtUtils::CBuilder" => 0,
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "File-LibMagic",
"EXE_FILES" => [],
"INC" => "-I. -Ic",
"LDFROM" => "LibMagic\$(OBJ_EXT)",
- "LIBS" => [
- "-lmagic"
- ],
+ "LIBS" => "-lmagic",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.008",
"NAME" => "File::LibMagic",
@@ -32,17 +31,21 @@ my %WriteMakefileArgs = (
"PREREQ_PM" => {
"Carp" => 0,
"Exporter" => 0,
+ "Scalar::Util" => 0,
"XSLoader" => 0,
"base" => 0,
"strict" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
+ "Cwd" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
+ "File::Temp" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
- "Test::More" => "0.88",
+ "Test::Fatal" => 0,
+ "Test::More" => "0.96",
"lib" => 0
},
"VERSION_FROM" => "lib/File/LibMagic.pm",
@@ -50,21 +53,26 @@ my %WriteMakefileArgs = (
"lib/File/LibMagic.xs" => "lib/File/LibMagic.c"
},
"test" => {
- "TESTS" => "t/*.t"
+ "TESTS" => "t/*.t t/old-apis/*.t"
}
);
$WriteMakefileArgs{DEFINE} = _defines();
-unshift @{ $WriteMakefileArgs{LIBS} }, _libs();
-$WriteMakefileArgs{INC} = join q{ }, _includes(), $WriteMakefileArgs{INC};
+$WriteMakefileArgs{INC} = join q{ }, _includes(), $WriteMakefileArgs{INC};
+$WriteMakefileArgs{LIBS} = join q{ }, _libs(), $WriteMakefileArgs{LIBS};
my %FallbackPrereqs = (
"Carp" => 0,
+ "Cwd" => 0,
"Exporter" => 0,
+ "ExtUtils::CBuilder" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
+ "File::Temp" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
- "Test::More" => "0.88",
+ "Scalar::Util" => 0,
+ "Test::Fatal" => 0,
+ "Test::More" => "0.96",
"XSLoader" => 0,
"base" => 0,
"lib" => 0,
@@ -90,8 +98,8 @@ use Getopt::Long;
my @libs;
my @includes;
-sub _libs { return @libs }
-sub _includes { return @includes }
+sub _libs { return map { '-L' . $_ } @libs }
+sub _includes { return map { '-I' . $_ } @includes }
sub _defines {
GetOptions(
@@ -100,8 +108,8 @@ sub _defines {
);
my $ac = Config::AutoConf->new(
- extra_link_flags => [ map { '-L' . $_ } @libs ],
- extra_include_flags => [ map { '-I' . $_ } @includes ],
+ extra_link_flags => [ _libs() ],
+ extra_include_dirs => [ _includes() ],
);
_check_libmagic($ac);
@@ -1,266 +1,298 @@
-# NAME
+NAME
-File::LibMagic - Determine MIME types of data or files using libmagic
+ File::LibMagic - Determine MIME types of data or files using libmagic
-# VERSION
+VERSION
-version 1.09
+ version 1.12
-# SYNOPSIS
+SYNOPSIS
- use File::LibMagic;
+ use File::LibMagic;
+
+ my $magic = File::LibMagic->new();
+
+ my $info = $magic->info_from_filename('path/to/file');
+ # Prints a description like "ASCII text"
+ print $info->{description};
+ # Prints a MIME type like "text/plain"
+ print $info->{mime_type};
+ # Prints a character encoding like "us-ascii"
+ print $info->{encoding};
+ # Prints a MIME type with encoding like "text/plain; charset=us-ascii"
+ print $info->{mime_with_encoding};
+
+ my $file_content = read_file('path/to/file');
+ $info = $magic->info_from_string($file_content);
+
+ open my $fh, '<', 'path/to/file' or die $!;
+ $info = $magic->info_from_handle($fh);
- my $magic = File::LibMagic->new();
+DESCRIPTION
- my $info = $magic->info_from_filename('path/to/file');
- # Prints a description like "ASCII text"
- print $info->{description};
- # Prints a MIME type like "text/plain"
- print $info->{mime_type};
- # Prints a character encoding like "us-ascii"
- print $info->{encoding};
- # Prints a MIME type with encoding like "text/plain; charset=us-ascii"
- print $info->{mime_with_encoding};
+ The File::LibMagic is a simple perl interface to libmagic from the file
+ package (version 4.x or 5.x). You will need both the library
+ (libmagic.so) and the header file (magic.h) to build this Perl module.
- my $file_content = read_file('path/to/file');
- $info = $magic->info_from_string($file_content);
+ Installing libmagic
- open my $fh, '<', 'path/to/file' or die $!;
- $info = $magic->info_from_handle($fh);
+ On Debian/Ubuntu run:
-# DESCRIPTION
+ sudo apt-get install libmagic-dev
-The `File::LibMagic` is a simple perl interface to libmagic from the file
-package (version 4.x or 5.x). You will need both the library (`libmagic.so`)
-and the header file (`magic.h`) to build this Perl module.
+ On Mac you can use homebrew (http://brew.sh/):
-## Installing libmagic
+ brew install libmagic
-On Debian/Ubuntu run:
+ Specifying lib and/or include directories
- sudo apt-get install libmagic-dev
+ On some systems, you may need to pass additional lib and include
+ directories to the Makefile.PL. You can do this with the `--lib` and
+ `--include` parameters:
-On Mac you can use homebrew (http://brew.sh/):
+ perl Makefile.PL --lib /usr/local/lib --include /usr/local/include
- brew install libmagic
+ You can pass these parameters multiple times to specify more than one
+ location.
-## Specifying lib and/or include directories
+API
-On some systems, you may need to pass additional lib and include directories
-to the Makefile.PL. You can do this with the \`--lib\` and \`--include\`
-parameters:
+ This module provides an object-oriented API with the following methods:
- perl Makefile.PL --lib /usr/local/include --include /usr/local/include
+ File::LibMagic->new()
-You can pass these parameters multiple times to specify more than one
-location.
+ Creates a new File::LibMagic object.
-# API
+ Using the object oriented interface only opens the magic database once,
+ which is probably most efficient for repeated uses.
-This module provides an object-oriented API with the following methods:
+ Each File::LibMagic object loads the magic database independently of
+ other File::LibMagic objects, so you may want to share a single object
+ across many modules.
-## File::LibMagic->new()
+ This method takes the following named parameters:
-Creates a new File::LibMagic object.
+ * magic_file
-Using the object oriented interface only opens the magic database once, which
-is probably most efficient for repeated uses.
+ This should be a string or an arrayref containing one or more magic
+ files.
-Each `File::LibMagic` object loads the magic database independently of other
-`File::LibMagic` objects, so you may want to share a single object across
-many modules.
+ If a file you provide doesn't exist the constructor will throw an
+ exception, but only with libmagic 4.17+.
-This method takes an optional argument containing a path to the magic file. If
-the file doesn't exist this will throw an exception (but only with libmagic
-4.17+).
+ If you don't set this parameter, the constructor will throw an
+ exception if it can't find any magic files at all.
-If you don't pass an argument, it will throw an exception if it can't find any
-magic files at all.
+ Note that even if you're using a custom file, you probably also want
+ to use the standard file (/usr/share/misc/magic on my system, yours
+ may vary).
-## $magic->info\_from\_filename('path/to/file')
+ * follow_symlinks
-This method returns info about the given file. The return value is a hash
-reference with four keys:
+ If this is true, then calls to $magic->info_from_filename will follow
+ symlinks to the real file.
-- description
+ * uncompress
- A textual description of the file content like "ASCII C program text".
+ If this is true, then compressed files (such as gzip files) will be
+ uncompressed, and the various info_from_* methods will return info
+ about the uncompressed file.
-- mime\_type
+ $magic->info_from_filename('path/to/file')
- The MIME type without a character encoding, like "text/x-c".
+ This method returns info about the given file. The return value is a
+ hash reference with four keys:
-- encoding
+ * description
- Just the character encoding, like "us-ascii".
+ A textual description of the file content like "ASCII C program
+ text".
-- mime\_with\_encoding
+ * mime_type
- The MIME type with a character encoding, like "text/x-c;
- charset=us-ascii". Note that if no encoding was found, this will be the same
- as the `mime_type` key.
+ The MIME type without a character encoding, like "text/x-c".
-## $magic->info\_from\_string($string)
+ * encoding
-This method returns info about the given string. The string can be passed as a
-reference to save memory.
+ Just the character encoding, like "us-ascii".
-The return value is the same as that of `$mime->info_from_filename()`.
+ * mime_with_encoding
-## $magic->info\_from\_handle($fh)
+ The MIME type with a character encoding, like "text/x-c;
+ charset=us-ascii". Note that if no encoding was found, this will be
+ the same as the mime_type key.
-This method returns info about the given filehandle. It will read data
-starting from the handle's current position, and leave the handle at that same
-position after reading.
+ $magic->info_from_string($string)
-# DEPRECATED APIS
+ This method returns info about the given string. The string can be
+ passed as a reference to save memory.
-This module offers two different procedural APIs based on optional exports,
-the "easy" and "complete" interfaces. There is also an older OO API still
-available. All of these APIs are deprecated, but will not be removed in the
-near future, nor will using them cause any warnings.
+ The return value is the same as that of $mime->info_from_filename().
-I strongly recommend you use the new OO API. It's simpler than the complete
-interface, more efficient than the easy interface, and more featureful than
-the old OO API.
+ $magic->info_from_handle($fh)
-## The Old OO API
+ This method returns info about the given filehandle. It will read data
+ starting from the handle's current position, and leave the handle at
+ that same position after reading.
-This API uses the same constructor as the current API.
+DISCOURAGED APIS
-- $magic->checktype\_contents($data)
+ This module offers two different procedural APIs based on optional
+ exports, the "easy" and "complete" interfaces. There is also an older
+ OO API still available. All of these APIs are discouraged, but will not
+ be removed in the near future, nor will using them cause any warnings.
- Returns the MIME type of the data given as the first argument. The data can be
- passed as a plain scalar or as a reference to a scalar.
+ I strongly recommend you use the new OO API. It's simpler than the
+ complete interface, more efficient than the easy interface, and more
+ featureful than the old OO API.
- This is the same value as would be returned by the `file` command with the
- `-i` switch.
+ The Old OO API
-- $magic->checktype\_filename($filename)
+ This API uses the same constructor as the current API.
- Returns the MIME type of the given file.
+ * $magic->checktype_contents($data)
- This is the same value as would be returned by the `file` command with the
- `-i` switch.
+ Returns the MIME type of the data given as the first argument. The
+ data can be passed as a plain scalar or as a reference to a scalar.
-- $magic->describe\_contents($data)
+ This is the same value as would be returned by the file command with
+ the -i switch.
- Returns a description (as a string) of the data given as the first argument.
- The data can be passed as a plain scalar or as a reference to a scalar.
+ * $magic->checktype_filename($filename)
- This is the same value as would be returned by the `file` command with no
- switches.
+ Returns the MIME type of the given file.
-- $magic->describe\_filename($filename)
+ This is the same value as would be returned by the file command with
+ the -i switch.
- Returns a description (as a string) of the given file.
+ * $magic->describe_contents($data)
- This is the same value as would be returned by the `file` command with no
- switches.
+ Returns a description (as a string) of the data given as the first
+ argument. The data can be passed as a plain scalar or as a reference
+ to a scalar.
-## The "easy" interface
+ This is the same value as would be returned by the file command with
+ no switches.
-This interface is exported by:
+ * $magic->describe_filename($filename)
- use File::LibMagic ':easy';
+ Returns a description (as a string) of the given file.
-This interface exports two subroutines:
+ This is the same value as would be returned by the file command with
+ no switches.
-- MagicBuffer($data)
+ The "easy" interface
- Returns the description of a chunk of data, just like the `describe_contents`
- method.
+ This interface is exported by:
-- MagicFile($filename)
+ use File::LibMagic ':easy';
- Returns the description of a file, just like the `describe_filename` method.
+ This interface exports two subroutines:
-## The "complete" interface
+ * MagicBuffer($data)
-This interface is exported by:
+ Returns the description of a chunk of data, just like the
+ describe_contents method.
- use File::LibMagic ':complete';
+ * MagicFile($filename)
-This interface exports several subroutines:
+ Returns the description of a file, just like the describe_filename
+ method.
-- magic\_open($flags)
+ The "complete" interface
- This subroutine opens creates a magic handle. See the libmagic man page for a
- description of all the flags. These are exported by the `:complete` import.
+ This interface is exported by:
+
+ use File::LibMagic ':complete';
+
+ This interface exports several subroutines:
+
+ * magic_open($flags)
+
+ This subroutine opens creates a magic handle. See the libmagic man
+ page for a description of all the flags. These are exported by the
+ :complete import.
my $handle = magic_open(MAGIC_MIME);
-- magic\_load($handle, $filename)
+ * magic_load($handle, $filename)
+
+ This subroutine actually loads the magic file. The $filename argument
+ is optional. There should be a sane default compiled into your
+ libmagic library.
+
+ * magic_buffer($handle, $data)
+
+ This returns information about a chunk of data as a string. What it
+ returns depends on the flags you passed to magic_open, a description,
+ a MIME type, etc.
+
+ * magic_file($handle, $filename)
- This subroutine actually loads the magic file. The `$filename` argument is
- optional. There should be a sane default compiled into your `libmagic`
- library.
+ This returns information about a file as a string. What it returns
+ depends on the flags you passed to magic_open, a description, a MIME
+ type, etc.
-- magic\_buffer($handle, $data)
+ * magic_close($handle)
- This returns information about a chunk of data as a string. What it returns
- depends on the flags you passed to `magic_open`, a description, a MIME type,
- etc.
+ Closes the magic handle.
-- magic\_file($handle, $filename)
+EXCEPTIONS
- This returns information about a file as a string. What it returns depends on
- the flags you passed to `magic_open`, a description, a MIME type, etc.
+ This module can throw an exception if your system runs out of memory
+ when trying to call magic_open internally.
-- magic\_close($handle)
+SUPPORT
- Closes the magic handle.
+ Please submit bugs to the CPAN RT system at
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-LibMagic or via email at
+ bug-file-libmagic@rt.cpan.org.
-# EXCEPTIONS
+BUGS
-This module can throw an exception if your system runs out of memory when
-trying to call `magic_open` internally.
+ This module is totally dependent on the version of file on your system.
+ It's possible that the tests will fail because of this. Please report
+ these failures so I can make the tests smarter. Please make sure to
+ report the version of file on your system as well!
-# SUPPORT
+DEPENDENCIES/PREREQUISITES
-Please submit bugs to the CPAN RT system at
-http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-LibMagic or via email at
-bug-file-libmagic@rt.cpan.org.
+ This module requires file 4.x or file 5x and the associated libmagic
+ library and headers (http://darwinsys.com/file/).
-# BUGS
+RELATED MODULES
-This module is totally dependent on the version of file on your system. It's
-possible that the tests will fail because of this. Please report these
-failures so I can make the tests smarter. Please make sure to report the
-version of file on your system as well!
+ Andreas created File::LibMagic because he wanted to use libmagic (from
+ file 4.x) File::MMagic only worked with file 3.x.
-# DEPENDENCIES/PREREQUISITES
+ File::MimeInfo::Magic uses the magic file from freedesktop.org which is
+ encoded in XML, and is thus not the fastest approach. See
+ http://mail.gnome.org/archives/nautilus-list/2003-December/msg00260.htm
+ l for a discussion of this issue.
-This module requires file 4.x or file 5x and the associated libmagic library
-and headers (http://darwinsys.com/file/).
+ File::Type uses a relatively small magic file, which is directly hacked
+ into the module code. It is quite fast but the database is quite small
+ relative to the file package.
-# RELATED MODULES
+AUTHORS
-Andreas created File::LibMagic because he wanted to use libmagic (from
-file 4.x) [File::MMagic](https://metacpan.org/pod/File::MMagic) only worked with file 3.x.
+ * Andreas Fitzner
-[File::MimeInfo::Magic](https://metacpan.org/pod/File::MimeInfo::Magic) uses the magic file from freedesktop.org which is
-encoded in XML, and is thus not the fastest approach. See
-[http://mail.gnome.org/archives/nautilus-list/2003-December/msg00260.html](http://mail.gnome.org/archives/nautilus-list/2003-December/msg00260.html)
-for a discussion of this issue.
+ * Michael Hendricks <michael@ndrix.org>
-File::Type uses a relatively small magic file, which is directly hacked into
-the module code. It is quite fast but the database is quite small relative to
-the file package.
+ * Dave Rolsky <autarch@urth.org>
-# AUTHORS
+CONTRIBUTORS
-- Andreas Fitzner
-- Michael Hendricks <michael@ndrix.org>
-- Dave Rolsky <autarch@urth.org>
+ * Mithun Ayachit <mayachit@amfam.com>
-# CONTRIBUTOR
+ * Olaf Alders <olaf@wundersolutions.com>
-Olaf Alders <olaf@wundersolutions.com>
+COPYRIGHT AND LICENSE
-# COPYRIGHT AND LICENSE
+ This software is copyright (c) 2015 by Andreas Fitzner, Michael
+ Hendricks, and Dave Rolsky.
-This software is copyright (c) 2014 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
+ This is free software; you can redistribute it and/or modify it under
+ the same terms as the Perl 5 programming language system itself.
-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,5 +1,6 @@
requires "Carp" => "0";
requires "Exporter" => "0";
+requires "Scalar::Util" => "0";
requires "XSLoader" => "0";
requires "base" => "0";
requires "perl" => "5.008";
@@ -7,11 +8,14 @@ requires "strict" => "0";
requires "warnings" => "0";
on 'test' => sub {
+ requires "Cwd" => "0";
requires "ExtUtils::MakeMaker" => "0";
requires "File::Spec" => "0";
+ requires "File::Temp" => "0";
requires "IO::Handle" => "0";
requires "IPC::Open3" => "0";
- requires "Test::More" => "0.88";
+ requires "Test::Fatal" => "0";
+ requires "Test::More" => "0.96";
requires "lib" => "0";
};
@@ -20,12 +24,17 @@ on 'test' => sub {
};
on 'configure' => sub {
+ requires "ExtUtils::CBuilder" => "0";
requires "ExtUtils::MakeMaker" => "0";
};
on 'develop' => sub {
+ requires "Code::TidyAll" => "0.24";
+ requires "Perl::Critic" => "1.123";
+ requires "Perl::Tidy" => "20140711";
requires "Pod::Coverage::TrustPod" => "0";
requires "Test::CPAN::Changes" => "0.19";
+ requires "Test::Code::TidyAll" => "0.24";
requires "Test::EOL" => "0";
requires "Test::More" => "0.88";
requires "Test::NoTabs" => "0";
@@ -33,4 +42,5 @@ on 'develop' => sub {
requires "Test::Pod::Coverage" => "1.08";
requires "Test::Spelling" => "0.12";
requires "Test::Synopsis" => "0";
+ requires "Test::Version" => "1";
};
@@ -20,26 +20,21 @@ stopwords = featureful
stopwords = freedesktop
stopwords = homebrew
stopwords = libmagic
+stopwords = uncompress
-remove = InstallGuide
-remove = MakeMaker
--remove = PkgVersion
-remove = Test::Pod::No404s
+[Prereqs / ConfigureRequires]
+; Needed by Config::AutoConf - it's not core in 5.8.x
+ExtUtils::CBuilder = 0
+
;authordep Dist::Zilla::Plugin::MakeMaker::Awesome
[=inc::MyMakeMaker]
[=inc::MyInstallGuide]
-[FileFinder::Filter / VersionedModules]
-finder = :InstallModules
-
-[RewriteVersion]
-finder = VersionedModules
-
-[CheckVersionIncrement]
-
-[BumpVersionAfterRelease]
-finder = VersionedModules
+[Encoding]
+encoding = bytes
+filename = t/samples/tiny.pdf
+filename = t/samples/tiny-pdf.gz
-[Git::Commit / increment version]
-allow_dirty_match = ^lib/.*\.pm$
-commit_msg = increment version after release
@@ -6,8 +6,7 @@ use Moose::Autobox;
use namespace::autoclean;
-with 'Dist::Zilla::Role::FileGatherer';
-with 'Dist::Zilla::Role::TextTemplate';
+with 'Dist::Zilla::Role::FileGatherer', 'Dist::Zilla::Role::TextTemplate';
my $content = <<'EOF';
# Installing File-LibMagic
@@ -84,7 +83,7 @@ sub gather_files {
$self->add_file(
Dist::Zilla::File::FromCode->new(
name => 'INSTALL.md',
- code => sub { $content },
+ code => sub {$content},
)
);
@@ -13,7 +13,7 @@ override _build_WriteMakefile_args => sub {
my $args = super();
- $args->{LIBS} = ['-lmagic'];
+ $args->{LIBS} = '-lmagic';
$args->{INC} = '-I. -Ic';
$args->{XS} = { 'lib/File/LibMagic.xs' => 'lib/File/LibMagic.c' };
$args->{C} = ['lib/File/LibMagic.c'];
@@ -32,8 +32,8 @@ override _build_WriteMakefile_dump => sub {
my $dump = super();
$dump .= <<'EOF';
$WriteMakefileArgs{DEFINE} = _defines();
-unshift @{ $WriteMakefileArgs{LIBS} }, _libs();
-$WriteMakefileArgs{INC} = join q{ }, _includes(), $WriteMakefileArgs{INC};
+$WriteMakefileArgs{INC} = join q{ }, _includes(), $WriteMakefileArgs{INC};
+$WriteMakefileArgs{LIBS} = join q{ }, _libs(), $WriteMakefileArgs{LIBS};
EOF
@@ -41,7 +41,7 @@ EOF
};
override _build_MakeFile_PL_template => sub {
- return super() . do { local $/; <DATA> };
+ return super() . do { local $/ = undef; <DATA> };
};
__PACKAGE__->meta->make_immutable;
@@ -57,8 +57,8 @@ use Getopt::Long;
my @libs;
my @includes;
-sub _libs { return @libs }
-sub _includes { return @includes }
+sub _libs { return map { '-L' . $_ } @libs }
+sub _includes { return map { '-I' . $_ } @includes }
sub _defines {
GetOptions(
@@ -67,8 +67,8 @@ sub _defines {
);
my $ac = Config::AutoConf->new(
- extra_link_flags => [ map { '-L' . $_ } @libs ],
- extra_include_flags => [ map { '-I' . $_ } @includes ],
+ extra_link_flags => [ _libs() ],
+ extra_include_dirs => [ _includes() ],
);
_check_libmagic($ac);
@@ -7,9 +7,10 @@ use warnings;
use Carp;
use Exporter;
+use Scalar::Util qw( reftype );
use XSLoader;
-our $VERSION = '1.09';
+our $VERSION = '1.12';
XSLoader::load( __PACKAGE__, $VERSION );
@@ -35,10 +36,12 @@ for my $name (@Constants) {
croak "WTF defining $name - $error"
if defined $error;
- my $sub = sub { $value };
+ my $sub = sub {$value};
+ ## no critic (TestingAndDebugging::ProhibitNoStrict)
no strict 'refs';
*{$name} = $sub;
+ ## use critic
}
our %EXPORT_TAGS = (
@@ -56,20 +59,41 @@ our %EXPORT_TAGS = (
]
);
-$EXPORT_TAGS{"all"}
- = [ @{ $EXPORT_TAGS{"easy"} }, @{ $EXPORT_TAGS{"complete"} } ];
+$EXPORT_TAGS{all} = [ @{ $EXPORT_TAGS{easy} }, @{ $EXPORT_TAGS{complete} } ];
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
sub new {
- my ( $class, $magic_file ) = @_;
-
- my $m = magic_open( MAGIC_NONE() );
- magic_load( $m, $magic_file );
+ my $class = shift;
+
+ my $flags = MAGIC_NONE();
+ my $magic_file;
+ if ( @_ == 1 ) {
+ $magic_file = shift;
+ }
+ else {
+ my %p = @_;
+ $magic_file = $p{magic_file};
+ $flags |= MAGIC_SYMLINK()
+ if $p{follow_symlinks};
+ $flags |= MAGIC_COMPRESS()
+ if $p{uncompress};
+ }
+
+ my $m = magic_open($flags);
+
+ my $magic_paths
+ = ref $magic_file && reftype($magic_file) eq 'ARRAY'
+ ? join ':', @{$magic_file}
+ : $magic_file;
+
+ # We need to call this even if $magic_paths is undef
+ magic_load( $m, $magic_paths );
return bless {
magic => $m,
magic_file => $magic_file,
+ flags => $flags,
}, $class;
}
@@ -155,7 +179,7 @@ File::LibMagic - Determine MIME types of data or files using libmagic
=head1 VERSION
-version 1.09
+version 1.12
=head1 SYNOPSIS
@@ -201,7 +225,7 @@ On some systems, you may need to pass additional lib and include directories
to the Makefile.PL. You can do this with the `--lib` and `--include`
parameters:
- perl Makefile.PL --lib /usr/local/include --include /usr/local/include
+ perl Makefile.PL --lib /usr/local/lib --include /usr/local/include
You can pass these parameters multiple times to specify more than one
location.
@@ -221,12 +245,35 @@ Each C<File::LibMagic> object loads the magic database independently of other
C<File::LibMagic> objects, so you may want to share a single object across
many modules.
-This method takes an optional argument containing a path to the magic file. If
-the file doesn't exist this will throw an exception (but only with libmagic
-4.17+).
+This method takes the following named parameters:
+
+=over 4
+
+=item * magic_file
+
+This should be a string or an arrayref containing one or more magic files.
+
+If a file you provide doesn't exist the constructor will throw an exception,
+but only with libmagic 4.17+.
+
+If you don't set this parameter, the constructor will throw an exception if it
+can't find any magic files at all.
+
+Note that even if you're using a custom file, you probably I<also> want to use
+the standard file (F</usr/share/misc/magic> on my system, yours may vary).
+
+=item * follow_symlinks
+
+If this is true, then calls to C<< $magic->info_from_filename >> will follow
+symlinks to the real file.
+
+=item * uncompress
-If you don't pass an argument, it will throw an exception if it can't find any
-magic files at all.
+If this is true, then compressed files (such as gzip files) will be
+uncompressed, and the various C<< info_from_* >> methods will return info
+about the uncompressed file.
+
+=back
=head2 $magic->info_from_filename('path/to/file')
@@ -268,11 +315,11 @@ This method returns info about the given filehandle. It will read data
starting from the handle's current position, and leave the handle at that same
position after reading.
-=head1 DEPRECATED APIS
+=head1 DISCOURAGED APIS
This module offers two different procedural APIs based on optional exports,
the "easy" and "complete" interfaces. There is also an older OO API still
-available. All of these APIs are deprecated, but will not be removed in the
+available. All of these APIs are discouraged, but will not be removed in the
near future, nor will using them cause any warnings.
I strongly recommend you use the new OO API. It's simpler than the complete
@@ -433,15 +480,25 @@ Dave Rolsky <autarch@urth.org>
=back
-=head1 CONTRIBUTOR
+=head1 CONTRIBUTORS
+
+=for stopwords Mithun Ayachit Olaf Alders
-=for stopwords Olaf Alders
+=over 4
+
+=item *
+
+Mithun Ayachit <mayachit@amfam.com>
+
+=item *
Olaf Alders <olaf@wundersolutions.com>
+=back
+
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2014 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
+This software is copyright (c) 2015 by Andreas Fitzner, Michael Hendricks, and Dave Rolsky.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -221,27 +221,28 @@ IV magic_version()
#define RETURN_INFO(self, magic_func, ...) \
magic = (magic_t)SvIV(*( hv_fetchs((HV *)SvRV(self), "magic", 0))); \
- magic_setflags(magic, MAGIC_NONE); \
- description = magic_func(magic, __VA_ARGS__); \
- if ( NULL == description ) { \
+ flags = (int)SvIV(*( hv_fetchs((HV *)SvRV(self), "flags", 0))); \
+ magic_setflags(magic, flags); \
+ description = magic_func(magic, __VA_ARGS__); \
+ if ( NULL == description ) { \
croak("error calling %s: %s", #magic_func, magic_error(magic)); \
- } \
+ } \
d = newSVpvn(description, strlen(description)); \
- magic_setflags(magic, MAGIC_MIME); \
- mime = magic_func(magic, __VA_ARGS__); \
- if ( NULL == mime ) { \
+ magic_setflags(magic, flags|MAGIC_MIME_TYPE); \
+ mime = magic_func(magic, __VA_ARGS__); \
+ if ( NULL == mime ) { \
croak("error calling %s: %s", #magic_func, magic_error(magic)); \
- } \
- m = newSVpvn(mime, strlen(mime)); \
- magic_setflags(magic, MAGIC_MIME_ENCODING); \
- encoding = magic_func(magic, __VA_ARGS__); \
- if ( NULL == encoding ) { \
+ } \
+ m = newSVpvn(mime, strlen(mime)); \
+ magic_setflags(magic, flags|MAGIC_MIME_ENCODING); \
+ encoding = magic_func(magic, __VA_ARGS__); \
+ if ( NULL == encoding ) { \
croak("error calling %s: %s", #magic_func, magic_error(magic)); \
- } \
- e = newSVpvn(encoding, strlen(encoding)); \
- EXTEND(SP, 3); \
- mPUSHs(d); \
- mPUSHs(m); \
+ } \
+ e = newSVpvn(encoding, strlen(encoding)); \
+ EXTEND(SP, 3); \
+ mPUSHs(d); \
+ mPUSHs(m); \
mPUSHs(e);
SV *_info_from_string(self, buffer)
@@ -249,6 +250,7 @@ SV *_info_from_string(self, buffer)
SV *buffer
PREINIT:
magic_t magic;
+ int flags;
SV *content;
STRLEN len;
char *string;
@@ -279,6 +281,7 @@ SV *_info_from_filename(self, filename)
SV *filename
PREINIT:
magic_t magic;
+ int flags;
char *file;
char *string;
const char *description;
@@ -301,6 +304,7 @@ SV *_info_from_handle(self, handle)
SV *handle
PREINIT:
magic_t magic;
+ int flags;
PerlIO *io;
char buf[BUFSIZE];
Off_t pos;
@@ -336,4 +340,4 @@ SV *_info_from_handle(self, handle)
PerlIO_seek(io, pos, SEEK_SET);
- RETURN_INFO(self, magic_buffer, buf, strlen(buf));
+ RETURN_INFO(self, magic_buffer, buf, read);
@@ -0,0 +1,58 @@
+severity = 3
+verbose = 11
+theme = core + pbp + bugs + maintenance + cosmetic + complexity + security + tests + moose
+
+exclude = Subroutines::ProhibitCallsToUndeclaredSubs
+
+[BuiltinFunctions::ProhibitStringySplit]
+severity = 3
+
+[CodeLayout::RequireTrailingCommas]
+severity = 3
+
+[ControlStructures::ProhibitCStyleForLoops]
+severity = 3
+
+[InputOutput::RequireCheckedSyscalls]
+functions = :builtins
+exclude_functions = sleep
+severity = 3
+
+[RegularExpressions::ProhibitComplexRegexes]
+max_characters = 200
+
+[RegularExpressions::ProhibitUnusualDelimiters]
+severity = 3
+
+[Subroutines::ProhibitUnusedPrivateSubroutines]
+private_name_regex = _(?!build)\w+
+
+[TestingAndDebugging::ProhibitNoWarnings]
+allow = redefine
+
+[ValuesAndExpressions::ProhibitEmptyQuotes]
+severity = 3
+
+[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
+severity = 3
+
+[ValuesAndExpressions::RequireUpperCaseHeredocTerminator]
+severity = 3
+
+[Variables::ProhibitPackageVars]
+add_packages = Carp Test::Builder
+
+[-Subroutines::RequireFinalReturn]
+
+[-ErrorHandling::RequireCarping]
+
+# No need for /xsm everywhere
+[-RegularExpressions::RequireDotMatchAnything]
+[-RegularExpressions::RequireExtendedFormatting]
+[-RegularExpressions::RequireLineBoundaryMatching]
+
+# http://stackoverflow.com/questions/2275317/why-does-perlcritic-dislike-using-shift-to-populate-subroutine-variables
+[-Subroutines::RequireArgUnpacking]
+
+# "use v5.14" is more readable than "use 5.014"
+[-ValuesAndExpressions::ProhibitVersionStrings]
@@ -0,0 +1,20 @@
+-l=78
+-i=4
+-ci=4
+-se
+-b
+-bar
+-boc
+-vt=0
+-vtc=0
+-cti=0
+-pt=1
+-bt=1
+-sbt=1
+-bbt=1
+-nolq
+-npro
+-nsfs
+--opening-hash-brace-right
+--no-outdent-long-comments
+-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
@@ -1,26 +1,33 @@
do { my $x = {
'configure' => {
'requires' => {
+ 'ExtUtils::CBuilder' => '0',
'ExtUtils::MakeMaker' => '0'
}
},
'develop' => {
'requires' => {
+ 'Code::TidyAll' => '0.24',
+ 'Perl::Critic' => '1.123',
+ 'Perl::Tidy' => '20140711',
'Pod::Coverage::TrustPod' => '0',
'Test::CPAN::Changes' => '0.19',
+ 'Test::Code::TidyAll' => '0.24',
'Test::EOL' => '0',
'Test::More' => '0.88',
'Test::NoTabs' => '0',
'Test::Pod' => '1.41',
'Test::Pod::Coverage' => '1.08',
'Test::Spelling' => '0.12',
- 'Test::Synopsis' => '0'
+ 'Test::Synopsis' => '0',
+ 'Test::Version' => '1'
}
},
'runtime' => {
'requires' => {
'Carp' => '0',
'Exporter' => '0',
+ 'Scalar::Util' => '0',
'XSLoader' => '0',
'base' => '0',
'perl' => '5.008',
@@ -33,11 +40,14 @@ do { my $x = {
'CPAN::Meta' => '2.120900'
},
'requires' => {
+ 'Cwd' => '0',
'ExtUtils::MakeMaker' => '0',
'File::Spec' => '0',
+ 'File::Temp' => '0',
'IO::Handle' => '0',
'IPC::Open3' => '0',
- 'Test::More' => '0.88',
+ 'Test::Fatal' => '0',
+ 'Test::More' => '0.96',
'lib' => '0'
}
}
@@ -3,7 +3,7 @@
use strict;
use warnings;
-# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.019
+# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.020
use Test::More tests => 1;
@@ -150,9 +150,16 @@ for my $phase ( qw(configure build test runtime develop other) ) {
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
- splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
- push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
+ if ($type eq 'modules') {
+ splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
+ push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
+ }
+ else {
+ splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
+ push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
+ }
+
push @full_reports, "\n";
}
}
@@ -1,34 +0,0 @@
-use strict;
-use warnings;
-
-use lib 't/lib';
-
-use Test::AnyOf;
-use Test::More 0.88;
-
-use File::LibMagic qw( :all );
-
-# subs from :easy
-is( MagicBuffer("Hello World\n"), 'ASCII text' );
-
-is( MagicFile('t/samples/foo.txt'), 'ASCII text' );
-is_any_of(
- MagicFile('t/samples/foo.c'),
- [ 'ASCII C program text', 'C source, ASCII text' ]
-);
-
-# subs from :complete
-my $handle = magic_open(MAGIC_NONE);
-magic_load( $handle, q{} );
-is( magic_buffer( $handle, "Hello World\n" ), 'ASCII text' );
-
-is( magic_file( $handle, 't/samples/foo.txt' ), 'ASCII text' );
-
-is_any_of(
- magic_file( $handle, 't/samples/foo.c' ),
- [ 'ASCII C program text', 'C source, ASCII text' ]
-);
-
-magic_close($handle);
-
-done_testing();
@@ -8,9 +8,43 @@ BEGIN {
use strict;
use warnings;
-use Test::More;
-# generated by Dist::Zilla::Plugin::Test::EOL 0.16
+# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.17
+
+use Test::More 0.88;
use Test::EOL;
-all_perl_files_ok({ trailing_whitespace => 1 });
+my @files = (
+ 'lib/File/LibMagic.pm',
+ 't/00-compile.t',
+ 't/00-report-prereqs.dd',
+ 't/00-report-prereqs.t',
+ 't/author-eol.t',
+ 't/author-no-tabs.t',
+ 't/author-pod-spell.t',
+ 't/constructor-params.t',
+ 't/lib/Test/AnyOf.pm',
+ 't/lib/Test/Exports.pm',
+ 't/old-apis/all-exports.t',
+ 't/old-apis/complete-interface-errors.t',
+ 't/old-apis/complete-interface.t',
+ 't/old-apis/easy-interface.t',
+ 't/oo-api.t',
+ 't/release-cpan-changes.t',
+ 't/release-pod-coverage.t',
+ 't/release-pod-linkcheck.t',
+ 't/release-pod-syntax.t',
+ 't/release-portability.t',
+ 't/release-synopsis.t',
+ 't/release-test-version.t',
+ 't/release-tidyall.t',
+ 't/samples/foo.c',
+ 't/samples/foo.foo',
+ 't/samples/foo.txt',
+ 't/samples/magic',
+ 't/samples/magic.mime',
+ 't/version.t'
+);
+
+eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
+done_testing;
@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings;
-# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.09
+# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.13
use Test::More 0.88;
use Test::NoTabs;
@@ -19,15 +19,16 @@ my @files = (
't/00-compile.t',
't/00-report-prereqs.dd',
't/00-report-prereqs.t',
- 't/all-exports.t',
't/author-eol.t',
't/author-no-tabs.t',
't/author-pod-spell.t',
- 't/basic.t',
- 't/complete-interface-errors.t',
- 't/complete-interface.t',
- 't/easy-interface.t',
+ 't/constructor-params.t',
't/lib/Test/AnyOf.pm',
+ 't/lib/Test/Exports.pm',
+ 't/old-apis/all-exports.t',
+ 't/old-apis/complete-interface-errors.t',
+ 't/old-apis/complete-interface.t',
+ 't/old-apis/easy-interface.t',
't/oo-api.t',
't/release-cpan-changes.t',
't/release-pod-coverage.t',
@@ -35,6 +36,8 @@ my @files = (
't/release-pod-syntax.t',
't/release-portability.t',
't/release-synopsis.t',
+ 't/release-test-version.t',
+ 't/release-tidyall.t',
't/samples/foo.c',
't/samples/foo.foo',
't/samples/foo.txt',
@@ -31,6 +31,7 @@ featureful
freedesktop
homebrew
libmagic
+uncompress
Andreas
Fitzner
Michael
@@ -39,6 +40,9 @@ michael
Dave
autarch
and
+Mithun
+Ayachit
+mayachit
Olaf
Alders
olaf
@@ -1,10 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More 0.88;
-
-use File::LibMagic;
-
-ok( File::LibMagic::MagicBuffer("Hello World\n") eq "ASCII text" );
-
-done_testing();
@@ -1,77 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More 0.88;
-
-use File::LibMagic qw( :complete );
-
-# TODO can we simulate an out-of-memory error?
-
-# try to use a missing magic file
-{
- my $h = magic_open(MAGIC_NONE);
-
- {
- no warnings 'uninitialized';
- eval { magic_load( undef, 't/samples/magic' ) };
- like(
- $@, qr{magic_load requires a defined handle},
- 'magic_load(undef)'
- );
- }
- eval { magic_load( $h, 't/samples/missing' ) };
-
- # like( $@, qr{libmagic could not find any magic files}, 'missing magic file' );
- magic_close($h);
-}
-
-{
- my $h = magic_open(MAGIC_NONE);
- magic_load( $h, 't/samples/magic' );
-
- # try to get information about an undef buffer
- {
- no warnings 'uninitialized';
- eval { magic_buffer( undef, "Foo" ) };
- like(
- $@, qr{magic_buffer requires a defined handle},
- 'magic_buffer(undef)'
- );
- }
-
- eval { magic_buffer( $h, undef ) };
- like(
- $@, qr{magic_buffer requires defined content},
- 'magic_buffer no content'
- );
-
- # try to get information about a missing file
- {
- no warnings 'uninitialized';
- eval { magic_file( undef, 't/samples/foo.foo' ) };
- like(
- $@, qr{magic_file requires a defined handle},
- 'magic_file(undef)'
- );
- }
-
- eval { magic_file( $h, undef ) };
- like( $@, qr{magic_file requires a filename}, 'magic_file no file' );
-
-TODO: {
- local $TODO = 'check libmagic version';
- eval { magic_file( $h, 't/samples/missing' ) };
- like( $@, qr{libmagic cannot open .+ at }, 'missing file' );
- magic_close($h);
- }
-}
-
-# try calling magic_close with undef handle
-{
- no warnings 'uninitialized';
- my $h = magic_open(MAGIC_NONE);
- eval { magic_close(undef) };
- like( $@, qr{magic_close requires a defined handle} );
-}
-
-done_testing();
@@ -1,80 +0,0 @@
-use strict;
-use warnings;
-
-use lib 't/lib';
-
-use Test::AnyOf;
-use Test::More 0.88;
-
-use File::LibMagic qw( :complete );
-
-# check for constants
-my $fail = 0;
-my @names = qw(
- MAGIC_CHECK MAGIC_COMPRESS MAGIC_CONTINUE MAGIC_DEBUG MAGIC_DEVICES
- MAGIC_ERROR MAGIC_MIME MAGIC_NONE MAGIC_PRESERVE_ATIME MAGIC_RAW
- MAGIC_SYMLINK
-);
-foreach my $constname (@names) {
- next if ( eval "my \$a = $constname; 1" );
- if ( $@ =~ /^Your vendor has not defined constants macro $constname/ ) {
- diag "pass: $@";
- }
- else {
- diag "fail: $@";
- $fail = 1;
- }
-
-}
-ok( $fail == 0, 'Constants' );
-
-# try loading a non-standard magic file
-{
- my $handle = magic_open(MAGIC_NONE);
- magic_load( $handle, 't/samples/magic' );
- is( magic_buffer( $handle, "Hello World\n" ), 'ASCII text' );
- is( magic_buffer( $handle, "Footastic\n" ), 'A foo file' );
-
- is( magic_file( $handle, 't/samples/foo.txt' ), 'ASCII text' );
- is_any_of(
- magic_file( $handle, 't/samples/foo.c' ),
- [ 'ASCII text', 'ASCII C program text', 'C source, ASCII text' ]
- );
- is( magic_file( $handle, 't/samples/foo.foo' ), 'A foo file' );
-
- magic_close($handle);
-}
-
-# test the traditional empty string for magic_load
-{
- my $handle = magic_open(MAGIC_NONE);
- magic_load( $handle, q{} );
- is( magic_buffer( $handle, "Hello World\n" ), 'ASCII text' );
-
- is( magic_file( $handle, 't/samples/foo.txt' ), 'ASCII text' );
- is_any_of(
- magic_file( $handle, 't/samples/foo.c' ),
- [ 'ASCII C program text', 'C source, ASCII text' ]
- );
- is( magic_file( $handle, 't/samples/foo.foo' ), 'ASCII text' );
-
- magic_close($handle);
-}
-
-# test undef as the filename for magic_load
-{
- my $handle = magic_open(MAGIC_NONE);
- magic_load( $handle, undef );
- is( magic_buffer( $handle, "Hello World\n" ), 'ASCII text' );
-
- is( magic_file( $handle, 't/samples/foo.txt' ), 'ASCII text' );
- is_any_of(
- magic_file( $handle, 't/samples/foo.c' ),
- [ 'ASCII C program text', 'C source, ASCII text' ]
- );
- is( magic_file( $handle, 't/samples/foo.foo' ), 'ASCII text' );
-
- magic_close($handle);
-}
-
-done_testing();
@@ -0,0 +1,59 @@
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Cwd qw( abs_path );
+use File::Temp qw( tempdir );
+use Test::AnyOf;
+use Test::More 0.96;
+
+use File::LibMagic;
+
+{
+ ## no critic (InputOutput::RequireCheckedSyscalls)
+ skip 'This platform does not support symlinks', 1
+ unless eval { symlink( q{}, q{} ); 1 };
+ ## use critic
+
+ my $dir = tempdir( CLEANUP => 1 );
+ my $link_file = "$dir/link-to-tiny.pdf";
+ symlink abs_path() . '/t/samples/tiny.pdf' => $link_file
+ or die "Cannot create symlink to t/samples/tiny.pdf: $!";
+
+ my $info = File::LibMagic->new( follow_symlinks => 1 )
+ ->info_from_filename($link_file);
+
+ is_deeply(
+ $info, {
+ description => 'PDF document, version 1.4',
+ mime_type => 'application/pdf',
+ encoding => 'binary',
+ mime_with_encoding => 'application/pdf; charset=binary',
+ },
+ 'got expected info for symlink to PDF'
+ );
+}
+
+{
+ my $info
+ = File::LibMagic->new()->info_from_filename('t/samples/tiny-pdf.gz');
+
+ is_any_of(
+ $info->{mime_type},
+ [ 'application/gzip', 'application/x-gzip' ],
+ 'gzip file is application/gzip or application/x-gzip by default'
+ );
+
+ $info
+ = File::LibMagic->new( uncompress => 1 )
+ ->info_from_filename('t/samples/tiny-pdf.gz');
+
+ is(
+ $info->{mime_type},
+ 'application/pdf',
+ 'gzip file is application/pdf when uncompressed'
+ );
+}
+
+done_testing();
@@ -1,31 +0,0 @@
-use strict;
-use warnings;
-
-use lib 't/lib';
-
-use Test::AnyOf;
-use Test::More 0.88;
-
-use File::LibMagic qw( :easy );
-
-is( MagicBuffer("Hello World\n"), 'ASCII text' );
-is( MagicFile('t/samples/foo.txt'), 'ASCII text' );
-is_any_of(
- MagicFile('t/samples/foo.c'),
- [ 'ASCII C program text', 'C source, ASCII text' ]
-);
-
-# check the error handling
-eval { MagicBuffer(undef) };
-like( $@, qr{MagicBuffer requires defined content}, 'MagicBuffer(undef)' );
-
-eval { MagicFile(undef) };
-like( $@, qr{MagicFile requires a filename}, 'MagicFile(undef)' );
-
-TODO: {
- local $TODO = 'check libmagic version';
- eval { MagicFile('t/samples/missing') };
- like( $@, qr{libmagic cannot open .+ at .+}, 'MagicFile: missing file' );
-}
-
-done_testing();
@@ -7,10 +7,13 @@ use Exporter;
use base 'Exporter';
+## no critic (Modules::ProhibitAutomaticExportation)
our @EXPORT = qw( is_any_of );
+## use critic
use Test::More;
+## no critic (Subroutines::ProhibitSubroutinePrototypes)
sub is_any_of ($$;$) {
my $got = shift;
my $expect = shift;
@@ -25,17 +28,17 @@ sub is_any_of ($$;$) {
$tb->ok( $match, $name );
unless ($match) {
- my $diag = <<'EOF';
+ my $diag = <<"EOF";
got: $got
expected: any one of ...
EOF
- $diag .= join "\n", map { " $_"} @{$expect};
+ $diag .= join "\n", map {" $_"} @{$expect};
$tb->diag($diag);
}
return $match;
}
+## use critic
1;
-
@@ -0,0 +1,175 @@
+package Test::Exports;
+
+use strict;
+use warnings;
+
+use Test::AnyOf;
+use Test::Fatal;
+use Test::More 0.96;
+
+use Exporter qw( import );
+
+our @EXPORT_OK = qw( test_complete test_easy );
+
+sub test_complete {
+ my $package = shift;
+
+ subtest(
+ 'constants',
+ sub { _test_constants($package) }
+ );
+
+ subtest(
+ 'custom magic file',
+ sub { _test_complete_with_handle( $package, 't/samples/magic' ) }
+ );
+ subtest(
+ 'empty string for magic file name',
+ sub { _test_complete_with_handle( $package, q{} ) }
+ );
+ subtest(
+ 'undef for magic file name',
+ sub { _test_complete_with_handle( $package, undef ) }
+ );
+}
+
+sub _test_constants {
+ my $package = shift;
+
+ my @constants = qw(
+ MAGIC_CHECK
+ MAGIC_COMPRESS
+ MAGIC_CONTINUE
+ MAGIC_DEBUG
+ MAGIC_DEVICES
+ MAGIC_ERROR
+ MAGIC_MIME
+ MAGIC_NONE
+ MAGIC_PRESERVE_ATIME
+ MAGIC_RAW
+ MAGIC_SYMLINK
+ );
+
+ foreach my $const (@constants) {
+ ## no critic (Variables::RequireInitializationForLocalVars)
+ local $@;
+ ## no critic (BuiltinFunctions::ProhibitStringyEval)
+ my $ok = eval "${package}::$const() || 1";
+ ## use critic
+
+ if ($ok) {
+ pass("$const is exported by :complete");
+ next;
+ }
+
+ if ( $@ =~ /^Your vendor has not defined constants macro \Q$const/ ) {
+ pass("$const is not defined for this version of libmagic");
+ }
+ else {
+ fail("unexpected error for $const");
+ diag($@);
+ }
+ }
+}
+
+sub _test_complete_with_handle {
+ my $package = shift;
+ my $custom_file = shift;
+
+ my $handle
+ = $package->can('magic_open')->( $package->can('MAGIC_NONE')->() );
+ $package->can('magic_load')->( $handle, $custom_file );
+
+ my $magic_buffer = $package->can('magic_buffer');
+ my $magic_file = $package->can('magic_file');
+
+ is(
+ $magic_buffer->( $handle, "Hello World\n" ),
+ 'ASCII text',
+ 'magic_buffer on ASCII text'
+ );
+
+ if ($custom_file) {
+ is(
+ $magic_buffer->( $handle, "Footastic\n" ),
+ 'A foo file',
+ 'magic_file on foo text (with custom magic)'
+ );
+ is(
+ $magic_file->( $handle, 't/samples/foo.foo' ),
+ 'A foo file',
+ 'magic_file on foo file (with custom magic)'
+ );
+ }
+ else {
+ is(
+ $magic_file->( $handle, 't/samples/foo.txt' ),
+ 'ASCII text',
+ 'magic_file on foo file (no custom magic)'
+ );
+ is(
+ $magic_file->( $handle, 't/samples/foo.foo' ),
+ 'ASCII text',
+ 'magic_file on foo file (no custom magic)'
+ );
+ }
+
+ is(
+ $magic_file->( $handle, 't/samples/foo.txt' ),
+ 'ASCII text',
+ 'magic_file on ASCII text'
+ );
+ is_any_of(
+ $magic_file->( $handle, 't/samples/foo.c' ),
+ [ 'ASCII text', 'ASCII C program text', 'C source, ASCII text' ],
+ 'magic_file on C code'
+ );
+
+ $package->can('magic_close')->($handle);
+}
+
+sub test_easy {
+ my $package = shift;
+
+ my $MagicBuffer = $package->can('MagicBuffer');
+ my $MagicFile = $package->can('MagicFile');
+
+ is(
+ $MagicBuffer->("Hello World\n"),
+ 'ASCII text',
+ 'MagicBuffer on text'
+ );
+ is(
+ $MagicFile->('t/samples/foo.txt'),
+ 'ASCII text',
+ 'MagicFile on ASCII text'
+ );
+ is_any_of(
+ $MagicFile->('t/samples/foo.c'),
+ [ 'ASCII C program text', 'C source, ASCII text' ],
+ 'MagicFile on C code'
+ );
+
+ like(
+ exception { $MagicBuffer->(undef) },
+ qr{MagicBuffer requires defined content},
+ 'MagicBuffer(undef)'
+ );
+
+ like(
+ exception { $MagicFile->(undef) },
+ qr{MagicFile requires a filename},
+ 'MagicFile(undef)'
+ );
+
+TODO: {
+ local $TODO = 'May not fail sanely with all versions of libmagic';
+ like(
+ exception { $MagicFile->('t/samples/missing') },
+ qr{libmagic cannot open .+ at .+},
+ 'MagicFile: missing file'
+ );
+ }
+}
+
+1;
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::Exports qw( test_complete test_easy );
+use Test::More 0.88;
+
+{
+
+ package Test::AllExports;
+
+ use File::LibMagic qw( :all );
+}
+
+subtest(
+ 'complete API exported by :all',
+ sub { test_complete('Test::AllExports') }
+);
+
+subtest(
+ 'easy API exported by :all',
+ sub { test_easy('Test::AllExports') }
+);
+
+done_testing();
@@ -0,0 +1,85 @@
+use strict;
+use warnings;
+
+use Test::Fatal;
+use Test::More 0.88;
+
+use File::LibMagic qw( :complete );
+
+# TODO can we simulate an out-of-memory error?
+
+## no critic (TestingAndDebugging::ProhibitNoWarnings)
+
+{
+ my $h = magic_open(MAGIC_NONE);
+
+ {
+ no warnings 'uninitialized';
+ like(
+ exception { magic_load( undef, 't/samples/magic' ) },
+ qr{magic_load requires a defined handle},
+ 'magic_load error when not given a handle'
+ );
+ }
+
+ magic_close($h);
+}
+
+{
+ my $h = magic_open(MAGIC_NONE);
+ magic_load( $h, 't/samples/magic' );
+
+ {
+ no warnings 'uninitialized';
+ like(
+ exception { magic_buffer( undef, 'foo' ) },
+ qr{magic_buffer requires a defined handle},
+ 'magic_buffer error when not given a handle'
+ );
+ }
+
+ like(
+ exception { magic_buffer( $h, undef ) },
+ qr{magic_buffer requires defined content},
+ 'magic_buffer error with undef as content'
+ );
+
+ {
+ no warnings 'uninitialized';
+ like(
+ exception { magic_file( undef, 't/samples/foo.foo' ) },
+ qr{magic_file requires a defined handle},
+ 'magic_file error when not given a handle'
+ );
+ }
+
+ like(
+ exception { magic_file( $h, undef ) },
+ qr{magic_file requires a filename},
+ 'magic_file error when given undef as a file'
+ );
+
+TODO: {
+ local $TODO = 'check libmagic version';
+ like(
+ exception { magic_file( $h, 't/samples/missing' ) },
+ qr{libmagic cannot open .+ at },
+ 'magic_file error when given a non-existent file (depends on libmagic version)'
+ );
+ }
+
+ magic_close($h);
+}
+
+{
+ no warnings 'uninitialized';
+ my $h = magic_open(MAGIC_NONE);
+
+ like(
+ exception { magic_close(undef) },
+ qr{magic_close requires a defined handle},
+ 'magic_close error when not given a handle'
+ );
+}
+
+done_testing();
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::Exports qw( test_complete );
+use Test::More 0.96;
+
+{
+
+ package Test::Complete;
+
+ use File::LibMagic qw( :complete );
+}
+
+test_complete('Test::Complete');
+
+done_testing();
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use Test::Exports qw( test_easy );
+use Test::More 0.96;
+
+{
+
+ package Test::Easy;
+
+ use File::LibMagic qw( :easy );
+}
+
+test_easy('Test::Easy');
+
+done_testing();
@@ -4,7 +4,7 @@ use warnings;
use lib 't/lib';
use Test::AnyOf;
-use Test::More 0.88;
+use Test::More 0.96;
use File::LibMagic;
@@ -12,13 +12,18 @@ use File::LibMagic;
my %standard = (
'foo.foo' => [
'ASCII text',
- qr{text/plain},
- qr{us-ascii},
+ 'text/plain',
+ 'us-ascii',
],
'foo.c' => [
[ 'ASCII C program text', 'C source, ASCII text' ],
- qr{text/x-c},
- qr{us-ascii},
+ 'text/x-c',
+ 'us-ascii',
+ ],
+ 'tiny.pdf' => [
+ 'PDF document, version 1.4',
+ 'application/pdf',
+ 'binary',
],
);
@@ -27,32 +32,44 @@ use File::LibMagic;
subtest(
'standard magic file',
sub {
- isa_ok( $flm, 'File::LibMagic' );
_test_flm( $flm, \%standard );
}
);
}
+SKIP:
{
+ my $standard_file = '/usr/share/file/magic.mgc';
+ skip "The standard magic file must exist at $standard_file", 1
+ unless -l $standard_file || -f _;
+
+ my $info = File::LibMagic->new()->info_from_filename($standard_file);
+ skip "The file at $standard_file is not a magic file", 1
+ unless $info && $info->{description} =~ /magic binary file/;
+
my %custom = (
'foo.foo' => [
'A foo file',
- qr{text/plain},
- qr{us-ascii},
+ 'text/plain',
+ 'us-ascii',
],
'foo.c' => [
- [ 'ASCII text', 'ASCII C program text', 'C source, ASCII text' ],
- qr{text/(?:plain|(?:x-)?c)},
- qr{us-ascii},
+ [ 'ASCII C program text', 'C source, ASCII text' ],
+ 'text/x-c',
+ 'us-ascii',
],
);
- my $flm = File::LibMagic->new('t/samples/magic');
+ my $flm = File::LibMagic->new(
+ [
+ 't/samples/magic',
+ $standard_file,
+ ],
+ );
subtest(
'custom magic file',
sub {
- isa_ok( $flm, 'File::LibMagic' );
_test_flm( $flm, \%custom );
}
);
@@ -66,12 +83,12 @@ sub _test_flm {
my $path = "t/samples/$file";
subtest(
- 'old API',
+ "old API with $path",
sub { _test_old_oo_api( $flm, $path, @{ $tests->{$file} } ); },
);
subtest(
- 'new API',
+ "new API with $path",
sub { _test_new_oo_api( $flm, $path, @{ $tests->{$file} } ); },
);
}
@@ -96,11 +113,9 @@ sub _test_old_oo_api {
"describe_filename $file",
);
- my $data = do {
- local $/;
- open my $fh, '<', $file or die $!;
- <$fh>;
- };
+ open my $fh, '<', $file or die $!;
+ my $data = do { local $/ = undef; <$fh>; };
+ close $fh or die $!;
like(
$flm->checktype_contents($data),
@@ -132,39 +147,42 @@ sub _test_new_oo_api {
my $file = shift;
my @args = @_;
+ my @s;
subtest(
- "info_from_filename $file",
+ 'info_from_filename',
sub {
_test_info( $flm->info_from_filename($file), @args );
},
);
subtest(
- "info_from_string $file",
+ 'info_from_string',
sub {
- open my $fh, '<', $file or die $!;
- my $string = do { local $/; <$fh> };
- close $fh;
+ open my $fh, '<:raw', $file or die $!;
+ my $string = do { local $/ = undef; <$fh> };
+ close $fh or die $!;
_test_info( $flm->info_from_string($string), @args );
},
);
subtest(
- "info_from_string $file as ref",
+ 'info_from_string as ref',
sub {
- open my $fh, '<', $file or die $!;
- my $string = do { local $/; <$fh> };
- close $fh;
+ open my $fh, '<:raw', $file or die $!;
+ my $string = do { local $/ = undef; <$fh> };
+ push @s, $string;
+ close $fh or die $!;
_test_info( $flm->info_from_string( \$string ), @args );
},
);
subtest(
- "info_from_handle $file",
+ 'info_from_handle',
sub {
- open my $fh, '<', $file or die $!;
+ open my $fh, '<:raw', $file or die $!;
_test_info( $flm->info_from_handle($fh), @args );
- my $content = do { local $/; <$fh> };
+ my $content = do { local $/ = undef; <$fh> };
+ close $fh or die $!;
ok(
length $content,
'info_from_handle resets pos after reading'
@@ -173,14 +191,17 @@ sub _test_new_oo_api {
);
subtest(
- "info_from_handle $file - handle from scalar ref",
+ 'info_from_handle - handle from scalar ref',
sub {
- open my $fh, '<', $file or die $!;
- my $string = do { local $/; <$fh> };
- close $fh;
-
- open $fh, '<', \$string;
- _test_info( $flm->info_from_handle($fh), @args );
+ open my $file_fh, '<:raw', $file or die $!;
+ my $string = do { local $/ = undef; <$file_fh> };
+ close $file_fh or die $!;
+
+ ## no critic (InputOutput::RequireCheckedOpen, InputOutput::RequireCheckedSyscalls)
+ open my $string_fh, '<', \$string;
+ _test_info( $flm->info_from_handle($string_fh), @args );
+ close $string_fh;
+ ## use critic
},
);
}
@@ -197,32 +218,33 @@ sub _test_info {
'description'
);
- like(
+ is(
$info->{mime_type},
- qr/$mime/,
+ $mime,
'mime_type',
);
- like(
+ is(
$info->{encoding},
$encoding,
'encoding'
);
- like(
+ is(
$info->{mime_with_encoding},
- qr/$mime; charset=$encoding/,
+ "$mime; charset=$encoding",
'mime_with_encoding'
);
}
{
{
+
package My::Magic::Subclass;
use base qw( File::LibMagic );
- sub checktype_filename { 'text/x-test-passes' }
+ sub checktype_filename {'text/x-test-passes'}
}
subtest(
@@ -16,4 +16,5 @@ use Test::More;
eval 'use Test::Portability::Files';
plan skip_all => 'Test::Portability::Files required for testing portability'
if $@;
+
run_tests();
@@ -0,0 +1,30 @@
+
+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;
+
+# generated by Dist::Zilla::Plugin::Test::Version 0.003001
+use Test::Version;
+
+my @imports = ( 'version_all_ok' );
+
+my $params = {
+ is_strict => 1,
+ has_version => 1,
+};
+
+push @imports, $params
+ if version->parse( $Test::Version::VERSION ) >= version->parse('1.002');
+
+
+Test::Version->import(@imports);
+
+version_all_ok;
+done_testing;
@@ -0,0 +1,17 @@
+#!perl
+
+BEGIN {
+ unless ($ENV{RELEASE_TESTING}) {
+ require Test::More;
+ Test::More::plan(skip_all => 'these tests are for release candidate testing');
+ }
+}
+
+# This file was automatically generated by Dist::Zilla::Plugin::Test::TidyAll
+
+use Test::Code::TidyAll 0.24;
+use Test::More 0.88;
+
+tidyall_ok();
+
+done_testing();
diff --git a/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny-pdf.gz b/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny-pdf.gz
new file mode 100644
index 00000000..8b9366b6
Binary files /dev/null and b/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny-pdf.gz differ
diff --git a/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny.pdf b/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny.pdf
new file mode 100644
index 00000000..8ed20bf8
Binary files /dev/null and b/var/tmp/source/DROLSKY/File-LibMagic-1.12/File-LibMagic-1.12/t/samples/tiny.pdf differ
@@ -0,0 +1,23 @@
+[PerlTidy]
+select = **/*.{pl,pm,t,psgi}
+ignore = .build/**/*
+ignore = File-LibMagic-*/**/*
+ignore = blib/**/*
+ignore = inc/Capture/*
+ignore = inc/Config/*
+ignore = t/00-*
+ignore = t/author-*
+ignore = t/release-*
+argv = --profile=$ROOT/perltidyrc
+
+[PerlCritic]
+select = **/*.{pl,pm,t,psgi}
+ignore = .build/**/*
+ignore = File-LibMagic-*/**/*
+ignore = blib/**/*
+ignore = inc/Capture/*
+ignore = inc/Config/*
+ignore = t/00-*
+ignore = t/author-*
+ignore = t/release-*
+argv = --profile $ROOT/perlcriticrc --program-extensions .pl --program-extensions .t --program-extensions .psgi
@@ -0,0 +1,17 @@
+[@CorePrep]
+
+[Name]
+[Version]
+
+[Region / prelude]
+
+[Generic / SYNOPSIS]
+[Generic / DESCRIPTION]
+
+[Leftovers]
+
+[Region / postlude]
+
+[Authors]
+[Contributors]
+[Legal]