diff options
52 files changed, 425 insertions, 1319 deletions
@@ -1,5 +1,10 @@ Revision history for Perl extension XML::LibXML +2.0200 2019-03-23 + - Convert to use Alien::Libxml2 . + - https://github.com/shlomif/perl-XML-LibXML/pull/30 + - Thanks to @genio and @plicease . + 2.0134 2019-02-10 - Fix overzealous POD escaping in the docs' synposes - https://github.com/shlomif/perl-XML-LibXML/issues/26 @@ -29,7 +29,7 @@ use XML::LibXML::XPathContext; use IO::Handle; # for FH reads called as methods BEGIN { -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE $ABI_VERSION = 2; require Exporter; require DynaLoader; @@ -505,7 +505,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT @@ -62,7 +62,6 @@ example/xmlns/badguy.xml example/xmlns/goodguy.xml example/xpath.pl example/yahoo-finance-html-with-errors.html -inc/Devel/CheckLib.pm lib/XML/LibXML/Attr.pod lib/XML/LibXML/AttributeHash.pm lib/XML/LibXML/Boolean.pm @@ -116,6 +115,7 @@ scripts/prints-to-comments.pl scripts/tag-release.pl scripts/total-build-and-test.bash scripts/update-HACKING-file.bash +t/00-report-prereqs.t t/01basic.t t/02parse.t t/03doc.t @@ -1,9 +1,9 @@ { "abstract" : "Interface to Gnome libxml2 xml parsing and DOM library", "author" : [ - "Petr Pajas" + "Petr Pajas <PAJAS@cpan.org>" ], - "dynamic_config" : 1, + "dynamic_config" : 0, "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "keywords" : [ "dom", @@ -33,43 +33,70 @@ "no_index" : { "directory" : [ "t", - "inc" + "inc", + "xt" ] }, "prereqs" : { "build" : { "requires" : { + "Alien::Libxml2" : "0", + "Config" : "0", "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { + "Alien::Libxml2" : "0", + "Config" : "0", "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { - "Test::More" : "0", + "Alien::Libxml2" : "0", + "Carp" : "0", + "DynaLoader" : "0", + "Encode" : "0", + "Exporter" : "5.57", + "IO::Handle" : "0", + "Scalar::Util" : "0", + "Tie::Hash" : "0", "XML::NamespaceSupport" : "1.07", "XML::SAX" : "0.11", "XML::SAX::Base" : "0", + "XML::SAX::DocumentLocator" : "0", "XML::SAX::Exception" : "0", "base" : "0", + "constant" : "0", + "overload" : "0", "parent" : "0", - "perl" : "5.008", "strict" : "0", "vars" : "0", "warnings" : "0" } + }, + "test" : { + "requires" : { + "Errno" : "0", + "IO::File" : "0", + "IO::Handle" : "0", + "POSIX" : "0", + "Scalar::Util" : "0", + "Test::More" : "0", + "locale" : "0", + "utf8" : "0" + } } }, "release_status" : "stable", "resources" : { - "homepage" : "https://github.com/shlomif/perl-XML-LibXML", "repository" : { - "url" : "https://github.com/shlomif/perl-XML-LibXML" + "type" : "git", + "url" : "https://github.com/shlomif/perl-XML-LibXML.git", + "web" : "https://github.com/shlomif/perl-XML-LibXML" } }, - "version" : "2.0134", + "version" : "2.0200", "x_serialization_backend" : "JSON::PP version 2.97001" } @@ -1,12 +1,24 @@ --- abstract: 'Interface to Gnome libxml2 xml parsing and DOM library' author: - - 'Petr Pajas' + - 'Petr Pajas <PAJAS@cpan.org>' build_requires: + Alien::Libxml2: '0' + Config: '0' + Errno: '0' ExtUtils::MakeMaker: '0' + IO::File: '0' + IO::Handle: '0' + POSIX: '0' + Scalar::Util: '0' + Test::More: '0' + locale: '0' + utf8: '0' configure_requires: + Alien::Libxml2: '0' + Config: '0' ExtUtils::MakeMaker: '0' -dynamic_config: 1 +dynamic_config: 0 generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' keywords: - dom @@ -33,20 +45,29 @@ no_index: directory: - t - inc + - xt requires: - Test::More: '0' + Alien::Libxml2: '0' + Carp: '0' + DynaLoader: '0' + Encode: '0' + Exporter: '5.57' + IO::Handle: '0' + Scalar::Util: '0' + Tie::Hash: '0' XML::NamespaceSupport: '1.07' XML::SAX: '0.11' XML::SAX::Base: '0' + XML::SAX::DocumentLocator: '0' XML::SAX::Exception: '0' base: '0' + constant: '0' + overload: '0' parent: '0' - perl: '5.008' strict: '0' vars: '0' warnings: '0' resources: - homepage: https://github.com/shlomif/perl-XML-LibXML - repository: https://github.com/shlomif/perl-XML-LibXML -version: '2.0134' + repository: https://github.com/shlomif/perl-XML-LibXML.git +version: '2.0200' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/Makefile.PL b/Makefile.PL index 5e49473..3055a0c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -17,795 +17,149 @@ use warnings; require 5.008; -use vars qw/$DEVNULL $is_Win32 $extralibdir $skipsaxinstall/; - +use Alien::Libxml2; use ExtUtils::MakeMaker; use Config; -use Symbol; -use File::Spec; - -$|=0; -my %config; -# -------------------------------------------------------------------------- # -# -------------------------------------------------------------------------- # -# common information go to the top, so they are easier to find -# -------------------------------------------------------------------------- # -my %INFOS = ( - 'NAME' => 'XML::LibXML', - 'VERSION_FROM' => 'LibXML.pm', # finds $VERSION - 'AUTHOR' => 'Petr Pajas', - 'ABSTRACT' => 'Interface to Gnome libxml2 xml parsing and DOM library', - 'LICENSE' => 'perl', - (($ExtUtils::MakeMaker::VERSION >= 6.48) - ? (MIN_PERL_VERSION => '5.008',) - : () - ), - 'PREREQ_PM' => { - 'base' => 0, - #'Hash::FieldHash' => '0.09', - 'parent' => 0, - 'strict' => 0, - 'Test::More' => 0, - 'vars' => 0, - 'warnings' => 0, - 'XML::NamespaceSupport' => '1.07', - 'XML::SAX' => '0.11', - 'XML::SAX::Base' => '0', - 'XML::SAX::Exception' => '0', - }, - 'OBJECT' => '$(O_FILES)', # add the DOM extensions to libxml2 - ($ExtUtils::MakeMaker::VERSION >= 6.54) - ? - ( - META_MERGE => - { - resources => - { - repository => 'https://github.com/shlomif/perl-XML-LibXML', - homepage => 'https://github.com/shlomif/perl-XML-LibXML', - }, - keywords => - [ - "dom", - "html", - "libxml", - "object oriented", - "oop", - "parse", - "parser", - "parsing", - "pullparser", - "sax", - "sgml", - "xml", - "xpath", - "XPath", - "xs", - ], - }, - ) - : (), +my %BuildReqs = ( + "Alien::Libxml2" => 0, + "Config" => 0, + "ExtUtils::MakeMaker" => 0, +); +my %ConfigReqs = ( + "Alien::Libxml2" => 0, + "Config" => 0, + "ExtUtils::MakeMaker" => 0, +); +my %DevReqs = ( + 'Test::CPAN::Changes' => 0, + 'Test::Kwalitee' => 0, + 'Test::Pod' => 0, + 'Test::TrailingSpace' => 0, +); +my %TestReqs = ( + "Errno" => 0, + "IO::File" => 0, + "IO::Handle" => 0, + "POSIX" => 0, + "Scalar::Util" => 0, + "Test::More" => 0, + "locale" => 0, + "utf8" => 0, +); +my %prereqs = ( + "Alien::Libxml2" => 0, + "Carp" => 0, + "DynaLoader" => 0, + "Encode" => 0, # actually used in one module. requires Perl 5.8+ + "Exporter" => "5.57", + 'IO::Handle' => 0, + 'Scalar::Util' => 0, + 'Tie::Hash' => 0, + 'XML::NamespaceSupport' => '1.07', + 'XML::SAX' => '0.11', + 'XML::SAX::Base' => '0', + 'XML::SAX::DocumentLocator' => '0', + 'XML::SAX::Exception' => '0', + "base" => 0, + "constant" => 0, + "overload" => 0, + "parent" => 0, + "strict" => 0, + "vars" => 0, + "warnings" => 0, ); -# -------------------------------------------------------------------------- # -# -------------------------------------------------------------------------- # - -use lib qw(inc); -use Devel::CheckLib; - -# Prompt the user here for any paths and other configuration - - -# -------------------------------------------------------------------------- # -# libxml2 valid versions - -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# read extra configurations from the commandline -my %params; -@params{qw(FORCE DEBUG DEFINE EXTRALIBDIR GDOME INC LIBS SKIP_SAX_INSTALL XMLPREFIX NO_THREADS LDFLAGS)}=(); - -@ARGV = grep { - my ($key, $val) = split(/=/, $_, 2); - if (exists $params{$key}) { - $config{$key} = $val; 0 - } else { 1 } -} @ARGV; - -$extralibdir = $config{EXTRALIBDIR}; -delete $config{EXTRALIBDIR}; - -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# force unsupported version -my $FORCE = delete $config{FORCE}; - -# switch Debugging messages on -my $DEBUG = delete $config{DEBUG}; - -if ( $config{DEBUG} and $is_Win32 ) { - warn "win32 compile\n"; -} -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# enable perls UTF8 support if available -if ( $] >= 5.006 ) { - warn "enable native perl UTF8\n"; - $config{DEFINE} .= " -DHAVE_UTF8"; -} -if ( $] < 5.008 or $config{NO_THREADS} ) { - warn "disabling XML::LibXML support for Perl threads\n"; - $config{DEFINE} .= " -DNO_XML_LIBXML_THREADS"; -} -delete $config{NO_THREADS}; -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# get the libxml2 configuration -# -# For each release we already know which libxml2 versions work with the given -# module. All we need is to keep track of bad versions. -# If a user wants to build XML::LibXML with a newer version, there will be -# a warning, that errors are possible. -# -# We keep track of the valid versions by keeping a blacklist of intervals -# of working and not working versions where Ma.Mi.Pt <= X.Y.Z is of the same -# state. -# -# NOTE: All versions, the tests pass will be marked as working. -# - -$skipsaxinstall = $ENV{SKIP_SAX_INSTALL} || $config{SKIP_SAX_INSTALL}; -delete $config{SKIP_SAX_INSTALL}; - -unless ( $is_Win32 ) { # cannot get config in W32 - my @blacklist = ( - # format X,Y,Z,is_ok, X,Y,Z is version, - # is_ok applies also to *preceding* versions - [2,4,22,0], - [2,4,25,0], # broken XPath - [2,4,28,0], # unsupported, may work fine with earlier XML::LibXML versions - [2,4,29,0], # broken - [2,4,30,0], # broken - [2,5,0,0], # unsupported - [2,5,1,0], # all pre 2.5.4 version have broken attr output - [2,5,5,0], # tests pass, but known as broken - [2,5,11,0], # will partially work - [2,6,0,0], # unsupported - [2,6,4,0], # schema error - [2,6,5,0], # broken xincludes - [2,6,15,0], - # [2,6,16,1], # first version to pass all tests - [2,6,18,1], # up to 2.6.18 all ok - [2,6,19,0], # broken c14n - [2,6,20,0], # broken schemas - [2,6,24,1], # all tests pass - [2,6,25,0], # broken XPath - [2,6,32,1], # tested, works ok - [2,7,1,0], # broken release, broken utf-16 - [2,7,6,1], # tested, ok - [2,7,8,1], # tested, ok - [2,9,3,1], # schema regression - [2,9,4,0], # schema regression - [2,9,9,1], - ); - my $xml2cfg = "xml2-config"; - my $libprefix = $ENV{XMLPREFIX} || $config{XMLPREFIX}; - - delete $config{XMLPREFIX}; # delete if exists, otherwise MakeMaker gets confused - - if ( defined $libprefix ) { - $xml2cfg = $libprefix . '/bin/' . $xml2cfg; - } - - # if a user defined INC and LIBS on the command line we must not - # override them - if ( not defined $config{LIBS} and not defined $config{INC} ) { - print "running xml2-config..."; - eval { - try_libconfig( $xml2cfg, \%config, \@blacklist ); - }; - - if ( $@ ) { - if ( $@ =~ /^VERSION|^FORCED/ ) { - my $libxml2_version; - print STDERR "The installed version of libxml2 $@ is not compatible with XML::LibXML (and probably buggy)!\n\n". - "You may continue at your own risk using 'perl Makefile.PL FORCE=1', but:\n\n". - " - don't expect XML::LibXML to build or work correctly!\n". - " - don't report errors!\n". - " - don't send patches!\n\n". - "Check the README file for more information on versions\n". - "that are tested with XML::LibXML\n\n"; - if ($@ =~ /^VERSION (\S+)/) { - $libxml2_version = $1; - } - # 0 recommended by http://cpantest.grango.org (Notes for CPAN Authors) - exit 0 if !$FORCE and $libxml2_version ne "2.9.4"; - } - if ( $@ =~ /^UNTESTED (\S*)/ ) { - warn "Note: libxml2 $1 was not tested with this XML::LibXML version.\n" -# warn <<"UNTESTED"; -# WARNING! -# The installed version of libxml2 was not tested with this version of XML::LibXML. - -# XML::LibXML may fail building or some tests may not pass. -# Expect strange errors and unstable scripts. - -# Check the README file for more informations -# END OF WARNING -# UNTESTED - } - - if ( not defined $config{LIBS} and not defined $config{INC} ) { - warn "didn't manage to get libxml2 config, guessing\n"; - $config{LIBS} = '-L/usr/local/lib -L/usr/lib -lxml2 -lm'; - $config{INC} = '-I/usr/local/include -I/usr/include'; - print <<"OPT"; -options: - LIBS='$config{LIBS}' - INC='$config{INC}' -If this is wrong, Re-run as: - \$ $^X Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include' - -OPT - } - } - } -} - -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# GDOME Support -# -# GDOME Support has to get explicitly activated by setting GDOME=1 as a config param. -# -unless ( $is_Win32 ) { # cannot get config in W32 - if ( $config{GDOME} ) { - my $ver; - my $state = undef; # there are three possible states: - # 1 : works - # 0 : works not - # undef : not yet tested - my @blacklist = ( - [0,7,2,0], - [0,7,3,1], - ); - print <<"GDOME"; - -GDOME Support (experimental): - XML::LibXML can parse into XML::GDOME DOMs if libgdome is installed. - This feature is optional and is not required for using XML::LibXML. - -GDOME - - print "running gdome-config..."; - - eval { - test_libconfig( "gdome-config", \%config, @blacklist ); - print "NOTE: You will need to install XML::GDOME to use this feature\n"; - }; - - if ( $@ ) { - if ( $@ =~ /^VERSION/ ) { - warn "The installed libgdome version is not supported\n"; - } - elsif ( $@ =~ /^UNTESTED/ ) { - warn "The installed libgdome version was not yet tested with XML::LibXML.\n"; - print "NOTE: You will need to install XML::GDOME to use this feature\n"; - } - } - } -} -# -------------------------------------------------------------------------- # - - -my $config_LIBS_alternatives; -# -------------------------------------------------------------------------- # -# fix the ld flags -# -------------------------------------------------------------------------- # -if (!defined $config{LIBS} || $config{LIBS} !~ /\-l(?:lib)?xml2\b/) { - # in this case we are not able to run xml2-config. therefore we need to - # expand the libz as well. - if ($is_Win32) { - if( $ENV{ACTIVEPERL_MINGW} ) { - $config{LIBS} .= ' -llibxml2.lib -lzlib.lib'; - } - else { - my $l = $config{LIBS}; - if (!defined($l)) { - $l = ''; - } +my %xsbuild = ( + DEFINE => '-DHAVE_UTF8', + OBJECT => '$(O_FILES)', + CCFLAGS => Alien::Libxml2->cflags . " $Config{ccflags}", + LIBS => [ Alien::Libxml2->libs ], +); - # Put several options. - $config_LIBS_alternatives = [ - map { "$l $_" } - q/ -llibxml2/, - q/ -lxml2 -lzlib/, - q/ -llibxml2 -lzlib -llibgettextlib.dll/ - ]; - $config{LIBS} = $config_LIBS_alternatives->[-1]; - $config{INC} .= " -I$Config{incpath}"; - } - } - else { - $config{LIBS} .= ' -lxml2 -lz -lm'; - } -} -elsif ($config{LIBS} !~ /\-lz\b/ and !($is_Win32 && $config{LIBS} !~ /\-lzlib\b/)) { - # note if libxml2 has not -lz within its cflags, we should not use - # it! We should trust libxml2 and assume libz is not available on the - # current system (this is ofcourse not true with win32 systems. - # $config{LIBS} .= $is_Win32 ? ' -lzlib' :' -lz'; - if ( $config{DEBUG} ) { - warn "zlib was not configured\n"; - warn "set zlib\n" if $is_Win32; - } - if ($is_Win32) { - if( $ENV{ACTIVEPERL_MINGW} ) { - $config{LIBS} .= ' -lzlib.lib'; - } else { - $config{LIBS} .= ' -lzlib'; - } - } else { - $config{LIBS} .= ' -lz'; +my %WriteMakefileArgs = ( + "NAME" => "XML::LibXML", + "DISTNAME" => "XML-LibXML", + "LICENSE" => "perl_5", + "ABSTRACT" => "Interface to Gnome libxml2 xml parsing and DOM library", + "AUTHOR" => "Petr Pajas <PAJAS\@cpan.org>", + "VERSION_FROM" => "LibXML.pm", + 'META_MERGE' => { + 'dynamic_config' => 0, + 'meta-spec' => {version => 2}, + 'no_index' => {directory => ['xt']}, + 'resources' => { + repository => { + type => 'git', + url => 'https://github.com/shlomif/perl-XML-LibXML.git', + web => 'https://github.com/shlomif/perl-XML-LibXML', + }, + }, + 'keywords' => [ + "dom", + "html", + "libxml", + "object oriented", + "oop", + "parse", + "parser", + "parsing", + "pullparser", + "sax", + "sgml", + "xml", + "xpath", + "XPath", + "xs", + ], + }, + "BUILD_REQUIRES" => \%BuildReqs, + "CONFIGURE_REQUIRES" => \%ConfigReqs, + "TEST_REQUIRES" => \%TestReqs, + "PREREQ_PM" => \%prereqs, + "test" => { + "TESTS" => "t/*.t" } -} - -# -------------------------------------------------------------------------- # -# MacOS X Compiler switches have to go here -# -# if we run on MacOSX, we should check if 10.2 is running and if so, -# if the Build Target is set correctly. Otherwise we have to set it by -# hand - -my $ldflags = delete $config{LDFLAGS}; -if ($ldflags) { - $config{dynamic_lib} = { OTHERLDFLAGS => " $ldflags " }; -} - -my $incpath = $config{INC} || ""; -$incpath =~ s#(\A|\s)\s*-I#$1#g; - -sub _libxml_check_lib_with_config_LIBs -{ - my ($lib_name, $conf_LIBS) = @_; - - return - check_lib( - debug => $DEBUG, - LIBS => $conf_LIBS, - # fill in what you prompted the user for here - lib => [$lib_name], - incpath => [split(/\s/,$incpath)], - header => - [ - 'libxml/c14n.h', - 'libxml/catalog.h', - 'libxml/entities.h', - 'libxml/globals.h', - 'libxml/HTMLparser.h', - 'libxml/HTMLtree.h', - 'libxml/parser.h', - 'libxml/parserInternals.h', - 'libxml/pattern.h', - 'libxml/relaxng.h', - 'libxml/tree.h', - 'libxml/uri.h', - 'libxml/valid.h', - 'libxml/xinclude.h', - 'libxml/xmlerror.h', - 'libxml/xmlIO.h', - 'libxml/xmlmemory.h', - 'libxml/xmlreader.h', - 'libxml/xmlregexp.h', - 'libxml/xmlschemas.h', - 'libxml/xmlversion.h', - 'libxml/xpath.h', - 'libxml/xpathInternals.h', - ], - ); -} - -sub _libxml_check_lib { - my ($libname) = @_; - - if (defined($config_LIBS_alternatives)) { - foreach my $conf_LIBS (@$config_LIBS_alternatives) { - if (_libxml_check_lib_with_config_LIBs($libname, $conf_LIBS)) { - $config{LIBS} = $conf_LIBS; - return 1; - } - } - } - else { - return _libxml_check_lib_with_config_LIBs($libname, $config{LIBS}); - } -} +); -print "Checking for ability to link against xml2..."; -if ( _libxml_check_lib('xml2') ) { - print "yes\n"; +%WriteMakefileArgs = ( + %WriteMakefileArgs, + %xsbuild, +); +unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) { + my %fallback = (%prereqs, %TestReqs, %BuildReqs); + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%fallback; } -else { - print "no\n"; - print "Checking for ability to link against libxml2..."; - if ( _libxml_check_lib('libxml2')) { - print "yes\n"; - } - else { - print STDERR <<"DEATH"; -libxml2, zlib, and/or the Math library (-lm) have not been found. -Try setting LIBS and INC values on the command line -Or get libxml2 from - http://xmlsoft.org/ -If you install via RPMs, make sure you also install the -devel -RPMs, as this is where the headers (.h files) are. -Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter -to see the exact reason why the detection of libxml2 installation -failed or why Makefile.PL was not able to compile a test program. -DEATH - exit 0; # 0 recommended by http://cpantest.grango.org (Notes for CPAN Authors) - } -} +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION('6.52') }; -# -------------------------------------------------------------------------- # -# _NOW_ write the Makefile +delete $WriteMakefileArgs{META_MERGE} + unless eval { ExtUtils::MakeMaker->VERSION('6.46') }; -WriteMakefile( - %INFOS, - %config, -); -# -------------------------------------------------------------------------- # +delete $WriteMakefileArgs{LICENSE} + unless eval { ExtUtils::MakeMaker->VERSION('6.31') }; +WriteMakefile(%WriteMakefileArgs); -# -------------------------------------------------------------------------- # # helper functions to build the Makefile sub MY::manifypods { - package MY; - my $str = shift->SUPER::manifypods(@_); -# warn $str; -# $str =~ s/^manifypods : pure_all (.*)$/manifypods : pure_all docs $1/m; - $str .= <<"EOF"; - + package MY; + my $str = shift->SUPER::manifypods(@_); +# warn $str; +# $str =~ s/^manifypods : pure_all (.*)$/manifypods : pure_all docs $1/m; + $str .= <<"EOF"; docs-fast : \t\@$^X -pi~ -e 's{<edition>[0-9.]*</edition>}{<edition>'"\$(VERSION)"'</edition>}' docs/libxml.dbk \t\@$^X -Iblib/arch -Iblib/lib example/xmllibxmldocs.pl docs/libxml.dbk lib/XML/LibXML/ - docs : pure_all \t\@$^X -pi~ -e 's{<edition>[0-9.]*</edition>}{<edition>'"\$(VERSION)"'</edition>}' docs/libxml.dbk \t\@$^X -Iblib/arch -Iblib/lib example/xmllibxmldocs.pl docs/libxml.dbk lib/XML/LibXML/ \t\@$^X -pi.old -e 's/a/a/' Makefile.PL \t\@echo "==> YOU MUST NOW RE-RUN $^X Makefile.PL <==" \t\@false - EOF - return $str; -} - -sub MY::install { - package MY; - my $script = shift->SUPER::install(@_); - unless ( $::skipsaxinstall ) { - $script =~ s/install :: (.*)$/install :: $1 install_sax_driver/m; - $script .= <<"INSTALL"; - -install_sax_driver : -\t-\@\$(PERL) -I\$(INSTALLSITELIB) -I\$(INSTALLSITEARCH) -MXML::SAX -e "XML::SAX->add_parser(q(XML::LibXML::SAX::Parser))->save_parsers()" -\t-\@\$(PERL) -I\$(INSTALLSITELIB) -I\$(INSTALLSITEARCH) -MXML::SAX -e "XML::SAX->add_parser(q(XML::LibXML::SAX))->save_parsers()" - -INSTALL - } else { - warn "Note: 'make install' will skip XML::LibXML::SAX registration with XML::SAX!\n"; - } - return $script; -} - -sub MY::test { - package MY; - my $script = shift->SUPER::test(@_); - if ( $::extralibdir ) { - $script =~ s/(\$\(TEST_VERBOSE\),)/$1 \'$::extralibdir\',/m; - } - return $script; -} - -# echo perl -pi~ -e '$$_=q($(version))."\n" if /#\ VERSION TEMPLATE/ ' $(TO_INST_PM) -sub MY::postamble { - my $mpl_args = join " ", map qq["$_"], @ARGV; - - my $CC = - ( - exists($ENV{CC}) - ? "CC = $ENV{CC}" - : '' - ); - - my $ret = "$CC\n" . <<'MAKE_FRAG'; - -# emacs flymake-mode -check-syntax : - test -n "$(CHK_SOURCES)" && \ - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) -o /dev/null -S $(CHK_SOURCES) - -# used to update version numbers in all modules -version: - @version=`grep '\# VERSION TEMPLATE' $(VERSION_FROM)`; \ - echo "New version line: $$version"; \ - perl -pi~ -e '$$_=q('"$$version"')."\n" if /#\ VERSION TEMPLATE/ ' $(TO_INST_PM); - -runtest: pure_all - $(ABSPERLRUN) -MFile::Spec -MTest::Run::CmdLine::Iface -e \ - "local @INC = @INC; unshift @INC, map { File::Spec->rel2abs(\$$_) } ('$(INST_LIB)', '$(INST_ARCHLIB)'); Test::Run::CmdLine::Iface->new({test_files => [glob(q{t/*.t})]})->run();" - -distruntest: distdir - cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL {#mpl_args#} - cd $(DISTVNAME) && $(MAKE) $(PASTHRU) - cd $(DISTVNAME) && $(MAKE) runtest $(PASTHRU) - -MAKE_FRAG - - $ret =~ s/{#mpl_args#}/$mpl_args/; - - return $ret; -} - - -# -------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------- # -# Functions -# - these should really be in MakeMaker... But &shrug; -# -------------------------------------------------------------------------- # - -use Config; -use Cwd; -use Symbol; -use File::Spec; - - -BEGIN { - $is_Win32 = ($^O =~ /Win32/); - if ($is_Win32) { - $DEVNULL = 'DEVNULL'; - } - else { - $DEVNULL = eval { File::Spec->devnull }; - if ($@) { $DEVNULL = '/dev/null' } - } -} - -sub rm_f { - my @files = @_; - my @realfiles; - foreach (@files) { - push @realfiles, glob($_); - } - if (@realfiles) { - chmod(0777, @realfiles); - unlink(@realfiles); - } -} - -sub rm_fr { - my @files = @_; - my @realfiles; - foreach (@files) { - push @realfiles, glob($_); - } - foreach my $file (@realfiles) { - if (-d $file) { - # warn("$file is a directory\n"); - rm_fr("$file/*"); - rm_fr("$file/.exists"); - rmdir($file) || die "Couldn't remove $file: $!"; - } - else { - # warn("removing $file\n"); - chmod(0777, $file); - unlink($file); - } - } -} - -sub xsystem { - my $command_aref = shift; - if ($DEBUG) { - print "@$command_aref\n"; - if ((system { $command_aref->[0] } @$command_aref) != 0) { - die "system call to '@$command_aref' failed"; - } - return 1; - } - open(OLDOUT, ">&STDOUT"); - open(OLDERR, ">&STDERR"); - open(STDOUT, ">$DEVNULL"); - open(STDERR, ">$DEVNULL"); - my $retval = (system { $command_aref->[0] } @$command_aref); - open(STDOUT, ">&OLDOUT"); - open(STDERR, ">&OLDERR"); - if ($retval != 0) { - die "system call to '@$command_aref' failed"; - } - return 1; -} - -sub backtick { - my $command = shift; - if ($DEBUG) { - print $command, "\n"; - my $results = `$command`; - chomp $results; - if ($? != 0) { - die "backticks call to '$command' failed"; - } - return $results; - } - open(OLDOUT, ">&STDOUT"); - open(OLDERR, ">&STDERR"); - open(STDOUT, ">$DEVNULL"); - open(STDERR, ">$DEVNULL"); - my $results = `$command`; - my $retval = $?; - open(STDOUT, ">&OLDOUT"); - open(STDERR, ">&OLDERR"); - if ($retval != 0) { - die "backticks call to '$command' failed"; - } - chomp $results; - return $results; -} - -sub try_link0 { - my ($src, $opt) = @_; - # local $config{LIBS}; - # $config{LIBS} .= $opt; - unless (mkdir(".testlink", 0777)) { - rm_fr(".testlink"); - mkdir(".testlink", 0777) || die "Cannot create .testlink dir: $!"; - } - chdir(".testlink"); - { - open(my $cfile, '>', 'Conftest.xs') - or die "Cannot write to file Conftest.xs: $!"; - print {$cfile} <<"EOT"; -#ifdef __cplusplus -extern "C" { -#endif -#include <EXTERN.h> -#include <perl.h> -#include <XSUB.h> -#ifdef __cplusplus + return $str; } -#endif - -EOT - print {$cfile} $src; - print {$cfile} <<"EOT"; - -MODULE = Conftest PACKAGE = Conftest - -PROTOTYPES: DISABLE - -EOT - close($cfile); - } - { - open(my $cfile, '>', 'Conftest.pm') - or die "Cannot write to file Conftest.pm: $!"; - print {$cfile} <<'EOT'; -package Conftest; -$VERSION = 1.0; -require DynaLoader; -@ISA = ('DynaLoader'); -bootstrap Conftest $VERSION; -1; -EOT - close($cfile); - } - { - open (my $cfile, '>', 'Makefile.PL') - or die "Cannot write to file Makefile.PL: $!"; - print {$cfile} <<'EOT'; -use ExtUtils::MakeMaker; -my %config; -while($_ = shift @ARGV) { - my ($k, $v) = split /=/, $_, 2; - warn("$k = $v\n"); - $config{$k} = $v; -} -WriteMakefile(NAME => "Conftest", VERSION_FROM => "Conftest.pm", %config); -EOT - close($cfile); - } - { - open(my $cfile, ">test.pl") - or die "Cannot write to file test.pl: $!"; - print {$cfile} <<"EOT"; -use Test; BEGIN { plan tests => 1; } END { ok(\$loaded) } -use Conftest; \$loaded++; -EOT - close($cfile); - } - my $quote = $is_Win32 ? '"' : "'"; - xsystem([$^X, 'Makefile.PL', - (map { "$_=$config{$_}" } keys %config), - ] - ); - - my $def_opt = defined($opt) ? $opt : ''; - # I am not sure if OTHERLDFLAGS is really required - at least the - # libraries to include do not belong here! - # I would assume a user to set OTHERLDFLAGS in the %config if they are - # really required. if done so, we don't have to pass them here ... - xsystem([$Config{make}, 'test', "OTHERLDFLAGS=${def_opt}"]); -} # end try_link0 - -sub try_link { - my $start_dir = cwd(); - my $result = eval { - try_link0(@_); - }; - warn $@ if $@; - chdir($start_dir); - rm_fr(".testlink"); - return $result; -} - -# -------------------------------------------------------------------------- # -# try_libconfig class a generic config file and requests --version, --libs and -# --cflags -sub try_libconfig { - my $cfgscript = shift; - my $config = shift; - my $bl = shift; - - my $state = undef; # there are three possible states: - # 1 : works - # 0 : works not - # undef : not yet tested - - my $ver = backtick("$cfgscript --version"); - if ( defined $ver ) { - my ( $major, $minor, $point) = $ver =~ /([0-9]+).([0-9]+)\.([0-9]+)/g; - foreach my $i ( @$bl ) { - $state = $i->[3]; - last if $major < $i->[0]; - next if $major > $i->[0]; - last if $minor < $i->[1]; - next if $minor > $i->[1]; - last if $point <= $i->[2]; - $state = undef; - } - - $config->{LIBS} = backtick("$cfgscript --libs"); - $config->{INC} = backtick("$cfgscript --cflags"); - - if ( defined $state and $state == 0 ) { - print "failed\n"; - if ($FORCE) { - die "FORCED $ver\n"; - } - else { - die "VERSION $ver\n"; - } - } - - unless ( defined $state ) { - print "untested\n"; - die "UNTESTED $ver\n"; - } - - print "ok ($ver)\n"; - } - else { - print "failed\n"; - die "FAILED\n"; # strange error - } -} -# -------------------------------------------------------------------------- # diff --git a/docs/libxml.dbk b/docs/libxml.dbk index efc5d16..3a4d371 100644 --- a/docs/libxml.dbk +++ b/docs/libxml.dbk @@ -22,7 +22,7 @@ </authorgroup> - <edition>2.0134</edition> + <edition>2.0200</edition> <copyright> <year>2001-2007</year> <holder>AxKit.com Ltd</holder> diff --git a/inc/Devel/CheckLib.pm b/inc/Devel/CheckLib.pm deleted file mode 100644 index 77ecb6a..0000000 --- a/inc/Devel/CheckLib.pm +++ /dev/null @@ -1,493 +0,0 @@ -# $Id: CheckLib.pm,v 1.25 2008/10/27 12:16:23 drhyde Exp $ - -package # -Devel::CheckLib; - -use 5.00405; #postfix foreach -use strict; -use warnings; - -use vars qw($VERSION @ISA @EXPORT); -$VERSION = '1.01'; -use Config qw(%Config); -use Text::ParseWords 'quotewords'; - -use File::Spec; -use File::Temp; - -require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(assert_lib check_lib_or_exit check_lib); - -# localising prevents the warningness leaking out of this module -local $^W = 1; # use warnings is a 5.6-ism - -_findcc(); # bomb out early if there's no compiler - -=head1 NAME - -Devel::CheckLib - check that a library is available - -=head1 DESCRIPTION - -Devel::CheckLib is a perl module that checks whether a particular C -library and its headers are available. - -=head1 SYNOPSIS - - use Devel::CheckLib; - - check_lib_or_exit( lib => 'jpeg', header => 'jpeglib.h' ); - check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] ); - - # or prompt for path to library and then do this: - check_lib_or_exit( lib => 'jpeg', libpath => $additional_path ); - -=head1 USING IT IN Makefile.PL or Build.PL - -If you want to use this from Makefile.PL or Build.PL, do -not simply copy the module into your distribution as this may cause -problems when PAUSE and search.cpan.org index the distro. Instead, use -the use-devel-checklib script. - -=head1 HOW IT WORKS - -You pass named parameters to a function, describing to it how to build -and link to the libraries. - -It works by trying to compile some code - which defaults to this: - - int main(void) { return 0; } - -and linking it to the specified libraries. If something pops out the end -which looks executable, it gets executed, and if main() returns 0 we know -that it worked. That tiny program is -built once for each library that you specify, and (without linking) once -for each header file. - -If you want to check for the presence of particular functions in a -library, or even that those functions return particular results, then -you can pass your own function body for main() thus: - - check_lib_or_exit( - function => 'foo();if(libversion() > 5) return 0; else return 1;' - incpath => ... - libpath => ... - lib => ... - header => ... - ); - -In that case, it will fail to build if either foo() or libversion() don't -exist, and main() will return the wrong value if libversion()'s return -value isn't what you want. - -=head1 FUNCTIONS - -All of these take the same named parameters and are exported by default. -To avoid exporting them, C<use Devel::CheckLib ()>. - -=head2 assert_lib - -This takes several named parameters, all of which are optional, and dies -with an error message if any of the libraries listed can -not be found. B<Note>: dying in a Makefile.PL or Build.PL may provoke -a 'FAIL' report from CPAN Testers' automated smoke testers. Use -C<check_lib_or_exit> instead. - -The named parameters are: - -=over - -=item lib - -Must be either a string with the name of a single -library or a reference to an array of strings of library names. Depending -on the compiler found, library names will be fed to the compiler either as -C<-l> arguments or as C<.lib> file names. (E.g. C<-ljpeg> or C<jpeg.lib>) - -=item libpath - -a string or an array of strings -representing additional paths to search for libraries. - -=item LIBS - -a C<ExtUtils::MakeMaker>-style space-seperated list of -libraries (each preceded by '-l') and directories (preceded by '-L'). - -This can also be supplied on the command-line. - -=item debug - -If true - emit information during processing that can be used for -debugging. - -=back - -And libraries are no use without header files, so ... - -=over - -=item header - -Must be either a string with the name of a single -header file or a reference to an array of strings of header file names. - -=item incpath - -a string or an array of strings -representing additional paths to search for headers. - -=item INC - -a C<ExtUtils::MakeMaker>-style space-seperated list of -incpaths, each preceded by '-I'. - -This can also be supplied on the command-line. - -=back - -=head2 check_lib_or_exit - -This behaves exactly the same as C<assert_lib()> except that instead of -dieing, it warns (with exactly the same error message) and exits. -This is intended for use in Makefile.PL / Build.PL -when you might want to prompt the user for various paths and -things before checking that what they've told you is sane. - -If any library or header is missing, it exits with an exit value of 0 to avoid -causing a CPAN Testers 'FAIL' report. CPAN Testers should ignore this -result -- which is what you want if an external library dependency is not -available. - -=head2 check_lib - -This behaves exactly the same as C<assert_lib()> except that it is silent, -returning false instead of dieing, or true otherwise. - -=cut - -sub check_lib_or_exit { - eval 'assert_lib(@_)'; - if($@) { - warn $@; - exit; - } -} - -sub check_lib { - eval 'assert_lib(@_)'; - return $@ ? 0 : 1; -} - -sub assert_lib { - my %args = @_; - my (@libs, @libpaths, @headers, @incpaths); - - # FIXME: these four just SCREAM "refactor" at me - @libs = (ref($args{lib}) ? @{$args{lib}} : $args{lib}) - if $args{lib}; - @libpaths = (ref($args{libpath}) ? @{$args{libpath}} : $args{libpath}) - if $args{libpath}; - @headers = (ref($args{header}) ? @{$args{header}} : $args{header}) - if $args{header}; - @incpaths = (ref($args{incpath}) ? @{$args{incpath}} : $args{incpath}) - if $args{incpath}; - - # work-a-like for Makefile.PL's LIBS and INC arguments - # if given as command-line argument, append to %args - for my $arg (@ARGV) { - for my $mm_attr_key (qw(LIBS INC)) { - if (my ($mm_attr_value) = $arg =~ /\A $mm_attr_key = (.*)/x) { - # it is tempting to put some \s* into the expression, but the - # MM command-line parser only accepts LIBS etc. followed by =, - # so we should not be any more lenient with whitespace than that - $args{$mm_attr_key} .= " $mm_attr_value"; - } - } - } - - # using special form of split to trim whitespace - if(defined($args{LIBS})) { - foreach my $arg (split(' ', $args{LIBS})) { - die("LIBS argument badly-formed: $arg\n") unless($arg =~ /^-[lLR]/); - push @{$arg =~ /^-l/ ? \@libs : \@libpaths}, substr($arg, 2); - } - } - if(defined($args{INC})) { - foreach my $arg (split(' ', $args{INC})) { - die("INC argument badly-formed: $arg\n") unless($arg =~ /^-I/); - push @incpaths, substr($arg, 2); - } - } - - my ($cc, $ld) = _findcc(); - my @missing; - my @wrongresult; - my @use_headers; - - # first figure out which headers we can't find ... - for my $header (@headers) { - push @use_headers, $header; - my($ch, $cfile) = File::Temp::tempfile( - 'assertlibXXXXXXXX', SUFFIX => '.c' - ); - my $ofile = $cfile; - $ofile =~ s/\.c$/$Config{_o}/; - print $ch qq{#include <$_>\n} for @use_headers; - print $ch qq{int main(void) { return 0; }\n}; - close($ch); - my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . $Config{_exe}; - my @sys_cmd; - # FIXME: re-factor - almost identical code later when linking - if ( $Config{cc} eq 'cl' ) { # Microsoft compiler - require Win32; - @sys_cmd = ( - @$cc, - $cfile, - "/Fe$exefile", - (map { '/I'.Win32::GetShortPathName($_) } @incpaths), - "/link", - @$ld - ); - } elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland - @sys_cmd = ( - @$cc, - @$ld, - (map { "-I$_" } @incpaths), - "-o$exefile", - $cfile - ); - } else { # Unix-ish: gcc, Sun, AIX (gcc, cc), ... - @sys_cmd = ( - @$cc, - @$ld, - $cfile, - (map { "-I$_" } @incpaths), - "-o", "$exefile" - ); - } - warn "# @sys_cmd\n" if $args{debug}; - my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd); - push @missing, $header if $rv != 0 || ! -x $exefile; - _cleanup_exe($exefile); - unlink $ofile if -e $ofile; - unlink $cfile; - } - - # now do each library in turn with headers - my($ch, $cfile) = File::Temp::tempfile( - 'assertlibXXXXXXXX', SUFFIX => '.c' - ); - my $ofile = $cfile; - $ofile =~ s/\.c$/$Config{_o}/; - print $ch qq{#include <$_>\n} foreach (@headers); - print $ch "int main(void) { ".($args{function} || 'return 0;')." }\n"; - close($ch); - for my $lib ( @libs ) { - my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . $Config{_exe}; - my @sys_cmd; - if ( $Config{cc} eq 'cl' ) { # Microsoft compiler - require Win32; - my @libpath = map { - q{/libpath:} . Win32::GetShortPathName($_) - } @libpaths; - # this is horribly sensitive to the order of arguments - @sys_cmd = ( - @$cc, - $cfile, - "${lib}.lib", - "/Fe$exefile", - (map { '/I'.Win32::GetShortPathName($_) } @incpaths), - "/link", - @$ld, - (map {'/libpath:'.Win32::GetShortPathName($_)} @libpaths), - ); - } elsif($Config{cc} eq 'CC/DECC') { # VMS - } elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland - @sys_cmd = ( - @$cc, - @$ld, - "-o$exefile", - (map { "-I$_" } @incpaths), - (map { "-L$_" } @libpaths), - "-l$lib", - $cfile); - } else { # Unix-ish - # gcc, Sun, AIX (gcc, cc) - @sys_cmd = ( - @$cc, - @$ld, - $cfile, - "-o", "$exefile", - (map { "-I$_" } @incpaths), - (map { "-L$_" } @libpaths), - "-l$lib", - ); - } - warn "# @sys_cmd\n" if $args{debug}; - my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd); - push @missing, $lib if $rv != 0 || ! -x $exefile; - my $absexefile = File::Spec->rel2abs($exefile); - $absexefile = '"'.$absexefile.'"' if $absexefile =~ m/\s/; - push @wrongresult, $lib if $rv == 0 && -x $exefile && system($absexefile) != 0; - unlink $ofile if -e $ofile; - _cleanup_exe($exefile); - } - unlink $cfile; - - my $miss_string = join( q{, }, map { qq{'$_'} } @missing ); - die("Can't link/include C library $miss_string, aborting.\n") if @missing; - my $wrong_string = join( q{, }, map { qq{'$_'} } @wrongresult); - die("wrong result: $wrong_string\n") if @wrongresult; -} - -sub _cleanup_exe { - my ($exefile) = @_; - my $ofile = $exefile; - $ofile =~ s/$Config{_exe}$/$Config{_o}/; - unlink $exefile if -f $exefile; - unlink $ofile if -f $ofile; - unlink "$exefile\.manifest" if -f "$exefile\.manifest"; - if ( $Config{cc} eq 'cl' ) { - # MSVC also creates foo.ilk and foo.pdb - my $ilkfile = $exefile; - $ilkfile =~ s/$Config{_exe}$/.ilk/; - my $pdbfile = $exefile; - $pdbfile =~ s/$Config{_exe}$/.pdb/; - unlink $ilkfile if -f $ilkfile; - unlink $pdbfile if -f $pdbfile; - } - return -} - -# return ($cc, $ld) -# where $cc is an array ref of compiler name, compiler flags -# where $ld is an array ref of linker flags -sub _findcc { - # Need to use $keep=1 to work with MSWin32 backslashes and quotes - my $Config_ccflags = $Config{ccflags}; # use copy so ASPerl will compile - my @Config_ldflags = (); - for my $config_val ( @Config{qw(ldflags perllibs)} ){ - push @Config_ldflags, $config_val if ( $config_val =~ /\S/ ); - } - my @ccflags = grep { length } quotewords('\s+', 1, $Config_ccflags||''); - my @ldflags = grep { length } quotewords('\s+', 1, @Config_ldflags); - my @paths = split(/$Config{path_sep}/, $ENV{PATH}); - my @cc = split(/\s+/, $Config{cc}); - return ( [ @cc, @ccflags ], \@ldflags ) if -x $cc[0]; - foreach my $path (@paths) { - my $compiler = File::Spec->catfile($path, $cc[0]) . $Config{_exe}; - return ([ $compiler, @cc[1 .. $#cc], @ccflags ], \@ldflags) - if -x $compiler; - } - die("Couldn't find your C compiler\n"); -} - -# code substantially borrowed from IPC::Run3 -sub _quiet_system { - my (@cmd) = @_; - - # save handles - local *STDOUT_SAVE; - local *STDERR_SAVE; - open STDOUT_SAVE, ">&STDOUT" or die "CheckLib: $! saving STDOUT"; - open STDERR_SAVE, ">&STDERR" or die "CheckLib: $! saving STDERR"; - - # redirect to nowhere - local *DEV_NULL; - open DEV_NULL, ">" . File::Spec->devnull - or die "CheckLib: $! opening handle to null device"; - open STDOUT, ">&" . fileno DEV_NULL - or die "CheckLib: $! redirecting STDOUT to null handle"; - open STDERR, ">&" . fileno DEV_NULL - or die "CheckLib: $! redirecting STDERR to null handle"; - - # run system command - my $rv = system(@cmd); - - # restore handles - open STDOUT, ">&" . fileno STDOUT_SAVE - or die "CheckLib: $! restoring STDOUT handle"; - open STDERR, ">&" . fileno STDERR_SAVE - or die "CheckLib: $! restoring STDERR handle"; - - return $rv; -} - -=head1 PLATFORMS SUPPORTED - -You must have a C compiler installed. We check for C<$Config{cc}>, -both literally as it is in Config.pm and also in the $PATH. - -It has been tested with varying degrees on rigourousness on: - -=over - -=item gcc (on Linux, *BSD, Mac OS X, Solaris, Cygwin) - -=item Sun's compiler tools on Solaris - -=item IBM's tools on AIX - -=item SGI's tools on Irix 6.5 - -=item Microsoft's tools on Windows - -=item MinGW on Windows (with Strawberry Perl) - -=item Borland's tools on Windows - -=item QNX - -=back - -=head1 WARNINGS, BUGS and FEEDBACK - -This is a very early release intended primarily for feedback from -people who have discussed it. The interface may change and it has -not been adequately tested. - -Feedback is most welcome, including constructive criticism. -Bug reports should be made using L<http://rt.cpan.org/> or by email. - -When submitting a bug report, please include the output from running: - - perl -V - perl -MDevel::CheckLib -e0 - -=head1 SEE ALSO - -L<Devel::CheckOS> - -L<Probe::Perl> - -=head1 AUTHORS - -David Cantrell E<lt>david@cantrell.org.ukE<gt> - -David Golden E<lt>dagolden@cpan.orgE<gt> - -Yasuhiro Matsumoto E<lt>mattn@cpan.orgE<gt> - -Thanks to the cpan-testers-discuss mailing list for prompting us to write it -in the first place; - -to Chris Williams for help with Borland support; - -to Tony Cook for help with Microsoft compiler command-line options - -=head1 COPYRIGHT and LICENCE - -Copyright 2007 David Cantrell. Portions copyright 2007 David Golden. - -This module is free-as-in-speech software, and may be used, distributed, -and modified under the same conditions as perl itself. - -=head1 CONSPIRACY - -This module is also free-as-in-mason software. - -=cut - -1; diff --git a/lib/XML/LibXML/Attr.pod b/lib/XML/LibXML/Attr.pod index de5b0a4..72c6863 100644 --- a/lib/XML/LibXML/Attr.pod +++ b/lib/XML/LibXML/Attr.pod @@ -121,7 +121,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/AttributeHash.pm b/lib/XML/LibXML/AttributeHash.pm index b880fcb..bcf7370 100644 --- a/lib/XML/LibXML/AttributeHash.pm +++ b/lib/XML/LibXML/AttributeHash.pm @@ -7,7 +7,7 @@ use Tie::Hash; our @ISA = qw/Tie::Hash/; use vars qw($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE BEGIN { diff --git a/lib/XML/LibXML/Boolean.pm b/lib/XML/LibXML/Boolean.pm index 420a407..a2755e8 100644 --- a/lib/XML/LibXML/Boolean.pm +++ b/lib/XML/LibXML/Boolean.pm @@ -16,7 +16,7 @@ use warnings; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/CDATASection.pod b/lib/XML/LibXML/CDATASection.pod index 710936e..899f18d 100644 --- a/lib/XML/LibXML/CDATASection.pod +++ b/lib/XML/LibXML/CDATASection.pod @@ -45,7 +45,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Comment.pod b/lib/XML/LibXML/Comment.pod index f6c933c..e4af0b4 100644 --- a/lib/XML/LibXML/Comment.pod +++ b/lib/XML/LibXML/Comment.pod @@ -46,7 +46,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Common.pm b/lib/XML/LibXML/Common.pm index e8d7e4f..ec984ec 100644 --- a/lib/XML/LibXML/Common.pm +++ b/lib/XML/LibXML/Common.pm @@ -24,7 +24,7 @@ use vars qw( @ISA $VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use XML::LibXML qw(:libxml); diff --git a/lib/XML/LibXML/Common.pod b/lib/XML/LibXML/Common.pod index 5519cfd..04053da 100644 --- a/lib/XML/LibXML/Common.pod +++ b/lib/XML/LibXML/Common.pod @@ -116,7 +116,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/DOM.pod b/lib/XML/LibXML/DOM.pod index bb0afae..12a5817 100644 --- a/lib/XML/LibXML/DOM.pod +++ b/lib/XML/LibXML/DOM.pod @@ -129,7 +129,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Devel.pm b/lib/XML/LibXML/Devel.pm index d4dfe61..c53a1fd 100644 --- a/lib/XML/LibXML/Devel.pm +++ b/lib/XML/LibXML/Devel.pm @@ -12,7 +12,7 @@ use warnings; use XML::LibXML; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use 5.008_000; diff --git a/lib/XML/LibXML/Document.pod b/lib/XML/LibXML/Document.pod index 2a33360..3661a9b 100644 --- a/lib/XML/LibXML/Document.pod +++ b/lib/XML/LibXML/Document.pod @@ -683,7 +683,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/DocumentFragment.pod b/lib/XML/LibXML/DocumentFragment.pod index b86d754..107b80b 100644 --- a/lib/XML/LibXML/DocumentFragment.pod +++ b/lib/XML/LibXML/DocumentFragment.pod @@ -27,7 +27,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Dtd.pod b/lib/XML/LibXML/Dtd.pod index 8cbf46a..ecfb4fa 100644 --- a/lib/XML/LibXML/Dtd.pod +++ b/lib/XML/LibXML/Dtd.pod @@ -89,7 +89,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Element.pod b/lib/XML/LibXML/Element.pod index b8912b7..7104f04 100644 --- a/lib/XML/LibXML/Element.pod +++ b/lib/XML/LibXML/Element.pod @@ -382,7 +382,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/ErrNo.pm b/lib/XML/LibXML/ErrNo.pm index 12563b6..6f33f76 100644 --- a/lib/XML/LibXML/ErrNo.pm +++ b/lib/XML/LibXML/ErrNo.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use constant ERR_OK => 0; use constant ERR_INTERNAL_ERROR => 1; diff --git a/lib/XML/LibXML/ErrNo.pod b/lib/XML/LibXML/ErrNo.pod index d0a3263..05cf717 100644 --- a/lib/XML/LibXML/ErrNo.pod +++ b/lib/XML/LibXML/ErrNo.pod @@ -17,7 +17,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Error.pm b/lib/XML/LibXML/Error.pm index 18704fd..69b9e1f 100644 --- a/lib/XML/LibXML/Error.pm +++ b/lib/XML/LibXML/Error.pm @@ -29,7 +29,7 @@ use overload fallback => 1; $WARNINGS = 0; # 0: suppress, 1: report via warn, 2: report via die -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use constant XML_ERR_NONE => 0; use constant XML_ERR_WARNING => 1; # A simple warning diff --git a/lib/XML/LibXML/Error.pod b/lib/XML/LibXML/Error.pod index 132910e..db6e1ee 100644 --- a/lib/XML/LibXML/Error.pod +++ b/lib/XML/LibXML/Error.pod @@ -244,7 +244,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/InputCallback.pod b/lib/XML/LibXML/InputCallback.pod index 6e2d937..751faae 100644 --- a/lib/XML/LibXML/InputCallback.pod +++ b/lib/XML/LibXML/InputCallback.pod @@ -280,7 +280,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Literal.pm b/lib/XML/LibXML/Literal.pm index 6550354..8097b7f 100644 --- a/lib/XML/LibXML/Literal.pm +++ b/lib/XML/LibXML/Literal.pm @@ -16,7 +16,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/Namespace.pod b/lib/XML/LibXML/Namespace.pod index f89518a..68cc2a1 100644 --- a/lib/XML/LibXML/Namespace.pod +++ b/lib/XML/LibXML/Namespace.pod @@ -141,7 +141,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Node.pod b/lib/XML/LibXML/Node.pod index cb03988..7d68a6d 100644 --- a/lib/XML/LibXML/Node.pod +++ b/lib/XML/LibXML/Node.pod @@ -763,7 +763,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/NodeList.pm b/lib/XML/LibXML/NodeList.pm index 6d0845b..dc9b9ec 100644 --- a/lib/XML/LibXML/NodeList.pm +++ b/lib/XML/LibXML/NodeList.pm @@ -17,7 +17,7 @@ use XML::LibXML::Literal; use XML::LibXML::Number; use vars qw($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&to_literal, diff --git a/lib/XML/LibXML/Number.pm b/lib/XML/LibXML/Number.pm index 1a27821..478b977 100644 --- a/lib/XML/LibXML/Number.pm +++ b/lib/XML/LibXML/Number.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, diff --git a/lib/XML/LibXML/PI.pod b/lib/XML/LibXML/PI.pod index 644d2dc..40c5620 100644 --- a/lib/XML/LibXML/PI.pod +++ b/lib/XML/LibXML/PI.pod @@ -74,7 +74,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Parser.pod b/lib/XML/LibXML/Parser.pod index 9f9478f..94181d1 100644 --- a/lib/XML/LibXML/Parser.pod +++ b/lib/XML/LibXML/Parser.pod @@ -984,7 +984,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Pattern.pod b/lib/XML/LibXML/Pattern.pod index 95309ab..d338d58 100644 --- a/lib/XML/LibXML/Pattern.pod +++ b/lib/XML/LibXML/Pattern.pod @@ -94,7 +94,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Reader.pm b/lib/XML/LibXML/Reader.pm index fa0ad06..f698535 100644 --- a/lib/XML/LibXML/Reader.pm +++ b/lib/XML/LibXML/Reader.pm @@ -14,7 +14,7 @@ use strict; use warnings; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use 5.008_000; diff --git a/lib/XML/LibXML/Reader.pod b/lib/XML/LibXML/Reader.pod index 268396a..bfcba53 100644 --- a/lib/XML/LibXML/Reader.pod +++ b/lib/XML/LibXML/Reader.pod @@ -657,7 +657,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/RegExp.pod b/lib/XML/LibXML/RegExp.pod index 41eec28..56f0a6c 100644 --- a/lib/XML/LibXML/RegExp.pod +++ b/lib/XML/LibXML/RegExp.pod @@ -58,7 +58,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/RelaxNG.pod b/lib/XML/LibXML/RelaxNG.pod index c7165b5..6afc826 100644 --- a/lib/XML/LibXML/RelaxNG.pod +++ b/lib/XML/LibXML/RelaxNG.pod @@ -70,7 +70,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX.pm b/lib/XML/LibXML/SAX.pm index bd4f26f..19a0bb2 100644 --- a/lib/XML/LibXML/SAX.pm +++ b/lib/XML/LibXML/SAX.pm @@ -14,7 +14,7 @@ use warnings; use vars qw($VERSION @ISA); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE use XML::LibXML; use XML::SAX::Base; diff --git a/lib/XML/LibXML/SAX.pod b/lib/XML/LibXML/SAX.pod index f990347..5f7d2a8 100644 --- a/lib/XML/LibXML/SAX.pod +++ b/lib/XML/LibXML/SAX.pod @@ -47,7 +47,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX/Builder.pm b/lib/XML/LibXML/SAX/Builder.pm index 0c168f6..2ca4a99 100644 --- a/lib/XML/LibXML/SAX/Builder.pm +++ b/lib/XML/LibXML/SAX/Builder.pm @@ -21,7 +21,7 @@ sub CLONE_SKIP { return $XML::LibXML::__threads_shared ? 0 : 1; } -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE sub new { my $class = shift; diff --git a/lib/XML/LibXML/SAX/Builder.pod b/lib/XML/LibXML/SAX/Builder.pod index 6972671..3192334 100644 --- a/lib/XML/LibXML/SAX/Builder.pod +++ b/lib/XML/LibXML/SAX/Builder.pod @@ -38,7 +38,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/SAX/Generator.pm b/lib/XML/LibXML/SAX/Generator.pm index c8ee22b..cb91b20 100644 --- a/lib/XML/LibXML/SAX/Generator.pm +++ b/lib/XML/LibXML/SAX/Generator.pm @@ -15,7 +15,7 @@ use warnings; use XML::LibXML; use vars qw ($VERSION); -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE sub CLONE_SKIP { return $XML::LibXML::__threads_shared ? 0 : 1; diff --git a/lib/XML/LibXML/SAX/Parser.pm b/lib/XML/LibXML/SAX/Parser.pm index 1f9ed49..6597348 100644 --- a/lib/XML/LibXML/SAX/Parser.pm +++ b/lib/XML/LibXML/SAX/Parser.pm @@ -18,7 +18,7 @@ use XML::LibXML::Common qw(:libxml); use XML::SAX::Base; use XML::SAX::DocumentLocator; -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE @ISA = ('XML::SAX::Base'); sub CLONE_SKIP { diff --git a/lib/XML/LibXML/Schema.pod b/lib/XML/LibXML/Schema.pod index dca03c2..3c34531 100644 --- a/lib/XML/LibXML/Schema.pod +++ b/lib/XML/LibXML/Schema.pod @@ -66,7 +66,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/Text.pod b/lib/XML/LibXML/Text.pod index a70a4ed..a5ff615 100644 --- a/lib/XML/LibXML/Text.pod +++ b/lib/XML/LibXML/Text.pod @@ -170,7 +170,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/XPathContext.pm b/lib/XML/LibXML/XPathContext.pm index 48a960e..8be1460 100644 --- a/lib/XML/LibXML/XPathContext.pm +++ b/lib/XML/LibXML/XPathContext.pm @@ -17,7 +17,7 @@ use Carp; use XML::LibXML; use XML::LibXML::NodeList; -$VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE +$VERSION = "2.0200"; # VERSION TEMPLATE: DO NOT CHANGE # should LibXML XPath data types be used for simple objects # when passing parameters to extension functions (default: no) diff --git a/lib/XML/LibXML/XPathContext.pod b/lib/XML/LibXML/XPathContext.pod index deb5107..4110543 100644 --- a/lib/XML/LibXML/XPathContext.pod +++ b/lib/XML/LibXML/XPathContext.pod @@ -362,7 +362,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/lib/XML/LibXML/XPathExpression.pod b/lib/XML/LibXML/XPathExpression.pod index 2291d4e..9ba8bd1 100644 --- a/lib/XML/LibXML/XPathExpression.pod +++ b/lib/XML/LibXML/XPathExpression.pod @@ -52,7 +52,7 @@ Petr Pajas =head1 VERSION -2.0134 +2.0200 =head1 COPYRIGHT diff --git a/t/00-report-prereqs.t b/t/00-report-prereqs.t new file mode 100644 index 0000000..c72183a --- /dev/null +++ b/t/00-report-prereqs.t @@ -0,0 +1,193 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 + +use Test::More tests => 1; + +use ExtUtils::MakeMaker; +use File::Spec; + +# from $version::LAX +my $lax_version_re = + qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? + | + (?:\.[0-9]+) (?:_[0-9]+)? + ) | (?: + v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? + | + (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? + ) + )/x; + +# hide optional CPAN::Meta modules from prereq scanner +# and check if they are available +my $cpan_meta = "CPAN::Meta"; +my $cpan_meta_pre = "CPAN::Meta::Prereqs"; +my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic + +# Verify requirements? +my $DO_VERIFY_PREREQS = 1; + +sub _max { + my $max = shift; + $max = ( $_ > $max ) ? $_ : $max for @_; + return $max; +} + +sub _merge_prereqs { + my ($collector, $prereqs) = @_; + + # CPAN::Meta::Prereqs object + if (ref $collector eq $cpan_meta_pre) { + return $collector->with_merged_prereqs( + CPAN::Meta::Prereqs->new( $prereqs ) + ); + } + + # Raw hashrefs + for my $phase ( keys %$prereqs ) { + for my $type ( keys %{ $prereqs->{$phase} } ) { + for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { + $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; + } + } + } + + return $collector; +} + +my @include = qw( + +); + +my @exclude = qw( + +); + +# Add static prereqs to the included modules list +my $static_prereqs = do './t/00-report-prereqs.dd'; + +# Merge all prereqs (either with ::Prereqs or a hashref) +my $full_prereqs = _merge_prereqs( + ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), + $static_prereqs +); + +# Add dynamic prereqs to the included modules list (if we can) +my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; +my $cpan_meta_error; +if ( $source && $HAS_CPAN_META + && (my $meta = eval { CPAN::Meta->load_file($source) } ) +) { + $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); +} +else { + $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) + $source = 'static metadata'; +} + +my @full_reports; +my @dep_errors; +my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; + +# Add static includes into a fake section +for my $mod (@include) { + $req_hash->{other}{modules}{$mod} = 0; +} + +for my $phase ( qw(configure build test runtime develop other) ) { + next unless $req_hash->{$phase}; + next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); + + for my $type ( qw(requires recommends suggests conflicts modules) ) { + next unless $req_hash->{$phase}{$type}; + + my $title = ucfirst($phase).' '.ucfirst($type); + my @reports = [qw/Module Want Have/]; + + for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { + next if $mod eq 'perl'; + next if grep { $_ eq $mod } @exclude; + + my $file = $mod; + $file =~ s{::}{/}g; + $file .= ".pm"; + my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; + + my $want = $req_hash->{$phase}{$type}{$mod}; + $want = "undef" unless defined $want; + $want = "any" if !$want && $want == 0; + + my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; + + if ($prefix) { + my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); + $have = "undef" unless defined $have; + push @reports, [$mod, $want, $have]; + + if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { + if ( $have !~ /\A$lax_version_re\z/ ) { + push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; + } + elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { + push @dep_errors, "$mod version '$have' is not in required range '$want'"; + } + } + } + else { + push @reports, [$mod, $want, "missing"]; + + if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { + push @dep_errors, "$mod is not installed ($req_string)"; + } + } + } + + if ( @reports ) { + push @full_reports, "=== $title ===\n\n"; + + my $ml = _max( map { length $_->[0] } @reports ); + my $wl = _max( map { length $_->[1] } @reports ); + my $hl = _max( map { length $_->[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"; + } + } +} + +if ( @full_reports ) { + diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; +} + +if ( $cpan_meta_error || @dep_errors ) { + diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; +} + +if ( $cpan_meta_error ) { + my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; + diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; +} + +if ( @dep_errors ) { + diag join("\n", + "\nThe following REQUIRED prerequisites were not satisfied:\n", + @dep_errors, + "\n" + ); +} + +pass; + +# vim: ts=4 sts=4 sw=4 et: diff --git a/t/pod-files-presence.t b/t/pod-files-presence.t index e2d63b6..e77d24a 100644 --- a/t/pod-files-presence.t +++ b/t/pod-files-presence.t @@ -29,4 +29,3 @@ sub _is_present } } } - |