Revision history for XML-Simple
+2.21 2015-12-04 16:33:49+13:00 Pacific/Auckland
+ - Improved diagnostics - xml_in() will now catch parse exceptions and add
+ caller information via Carp::croak
+ - Switch to use lexical warnings (suppress with either 'no warnings;' or
+ 'no warnings "XML::Simple";', rather than $^W = 0)
+ - POD fixes (from David Steinbrunner)
+ - Regex escaping fixes for Perl 5.22+ (from Kent Fredric)
+ - Add workaround for test failures on RHEL/CentOS 6.5 (RT#102115 from
+ Chris Drake, workaround from Tim Bunce)
+ - Remove some 'eval' calls from test suite which could mask root cause of
+ test failures
+ - Make each test script use unique filenames to allow tests to be run in
+ parallel (RT#101362 from Karen Etheridge & Kent Fredric)
+ - POD update: mention XML::Twig in 'STATUS' section (RT#79228 from Matt Trout)
+
2.20 2012-06-20 22:00:13 Pacific/Auckland
- Suppress warning from empty CDATA section (RT#58359 from Juan Antonio
Navarro Pérez)
The GNU General Public License, Version 1, February 1989
- GNU GENERAL PUBLIC LICENSE
- Version 1, February 1989
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
- Appendix: How to Apply These Terms to Your New Programs
+ Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+
Also add information on how to contact you by electronic and paper mail.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.022.
Changes
LICENSE
MANIFEST
{
- "abstract" : "Easily read/write XML (esp config files)",
+ "abstract" : "An API for simple XML files",
"author" : [
"Grant McLean <grantm@cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.200004, CPAN::Meta::Converter version 2.101670",
+ "generated_by" : "Dist::Zilla version 5.022, CPAN::Meta::Converter version 2.142690",
"license" : [
"perl_5"
],
"prereqs" : {
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : "6.31"
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Test::Pod" : "1.41"
}
},
"runtime" : {
"requires" : {
"XML::NamespaceSupport" : "1.04",
"XML::SAX" : "0.15",
- "XML::SAX::Expat" : 0,
+ "XML::SAX::Expat" : "0",
"perl" : "5.008"
}
},
"repository" : {
"type" : "git",
"url" : "git://github.com/grantm/xml-simple.git",
- "web" : "http://github.com/grantm/xml-simple"
+ "web" : "https://github.com/grantm/xml-simple"
}
},
- "version" : "2.20"
+ "version" : "2.21"
}
---
-abstract: 'Easily read/write XML (esp config files)'
+abstract: 'An API for simple XML files'
author:
- 'Grant McLean <grantm@cpan.org>'
build_requires:
Test::More: 0.88
configure_requires:
- ExtUtils::MakeMaker: 6.31
+ ExtUtils::MakeMaker: 0
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200004, CPAN::Meta::Converter version 2.101670'
+generated_by: 'Dist::Zilla version 5.022, CPAN::Meta::Converter version 2.142690'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
perl: 5.008
resources:
repository: git://github.com/grantm/xml-simple.git
-version: 2.20
+version: 2.21
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.022.
use strict;
use warnings;
-BEGIN { require 5.008; }
+use 5.008;
-use ExtUtils::MakeMaker 6.31;
+use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
- 'ABSTRACT' => 'Easily read/write XML (esp config files)',
- 'AUTHOR' => 'Grant McLean <grantm@cpan.org>',
- 'BUILD_REQUIRES' => {
- 'Test::More' => '0.88'
+ "ABSTRACT" => "An API for simple XML files",
+ "AUTHOR" => "Grant McLean <grantm\@cpan.org>",
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => 0
},
- 'CONFIGURE_REQUIRES' => {
- 'ExtUtils::MakeMaker' => '6.31'
+ "DISTNAME" => "XML-Simple",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "MIN_PERL_VERSION" => "5.008",
+ "NAME" => "XML::Simple",
+ "PREREQ_PM" => {
+ "XML::NamespaceSupport" => "1.04",
+ "XML::SAX" => "0.15",
+ "XML::SAX::Expat" => 0
},
- 'DISTNAME' => 'XML-Simple',
- 'EXE_FILES' => [],
- 'LICENSE' => 'perl',
- 'NAME' => 'XML::Simple',
- 'PREREQ_PM' => {
- 'XML::NamespaceSupport' => '1.04',
- 'XML::SAX' => '0.15',
- 'XML::SAX::Expat' => '0'
+ "TEST_REQUIRES" => {
+ "Test::More" => "0.88"
},
- 'VERSION' => '2.20',
- 'test' => {
- 'TESTS' => 't/*.t'
+ "VERSION" => "2.21",
+ "test" => {
+ "TESTS" => "t/*.t"
}
);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
- my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
- my $pp = $WriteMakefileArgs{PREREQ_PM};
- for my $mod ( keys %$br ) {
- if ( exists $pp->{$mod} ) {
- $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
- }
- else {
- $pp->{$mod} = $br->{$mod};
- }
- }
+my %FallbackPrereqs = (
+ "ExtUtils::MakeMaker" => 0,
+ "Test::More" => "0.88",
+ "XML::NamespaceSupport" => "1.04",
+ "XML::SAX" => "0.15",
+ "XML::SAX::Expat" => 0
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
This archive contains the distribution XML-Simple,
-version 2.20:
+version 2.21:
- Easily read/write XML (esp config files)
+ An API for simple XML files
This software is copyright (c) 2012 by Grant McLean.
the same terms as the Perl 5 programming language system itself.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.022.
+
name = XML-Simple
author = Grant McLean <grantm@cpan.org>
-version = 2.20
+version = 2.21
license = Perl_5
copyright_holder = Grant McLean
copyright_year = 2012
package XML::Simple;
-BEGIN {
- $XML::Simple::VERSION = '2.20';
-}
-
+$XML::Simple::VERSION = '2.21';
=head1 NAME
-XML::Simple - Easily read/write XML (esp config files)
+XML::Simple - An API for simple XML files
=head1 SYNOPSIS
+You really don't want to use this module in new code. If you ignore this
+warning and use it anyway, the C<qw(:strict)> mode will save you a little pain.
+
use XML::Simple qw(:strict);
my $ref = XMLin([<xml file or string>] [, <options>]);
# Load essentials here, other modules loaded on demand later
use strict;
+use warnings;
+use warnings::register;
use Carp;
require Exporter;
sub build_simple_tree {
my $self = shift;
- my $tree = $self->build_tree(@_);
+ my $tree = eval {
+ $self->build_tree(@_);
+ };
+ Carp::croak("$@XML::Simple called") if $@;
return $self->{opt}->{keeproot}
? $self->collapse({}, @$tree)
}
if(exists($opt->{parseropts})) {
- if($^W) {
+ if(warnings::enabled()) {
carp "Warning: " .
"'ParserOpts' is deprecated, contact the author if you need it";
}
if(my $var = $self->{_var_values}) {
while(my($key, $val) = each(%$attr)) {
- $val =~ s{\$\{([\w.]+)\}}{ $self->get_var($1) }ge;
+ $val =~ s^\$\{([\w.]+)\}^ $self->get_var($1) ^ge;
$attr->{$key} = $val;
}
}
# do variable substitutions
if(my $var = $self->{_var_values}) {
- $val =~ s{\$\{(\w+)\}}{ $self->get_var($1) }ge;
+ $val =~ s^\$\{(\w+)\}^ $self->get_var($1) ^ge;
}
# 3. ignores message and returns silently if neither strict mode nor warnings
# are enabled
#
-# Option 2 looks at the global warnings variable $^W - which is not really
-# appropriate in the modern world of lexical warnings - TODO: Fix
sub die_or_warn {
my $self = shift;
my $msg = shift;
croak $msg if($self->{opt}->{strictmode});
- carp "Warning: $msg" if($^W);
+ if(warnings::enabled()) {
+ carp "Warning: $msg";
+ }
}
#
# Arguments expected are:
# - an XML::Simple object
-# - a hasref
+# - a hashref
# the hashref is a former array, turned into a hash by array_to_hash because
# of the presence of key attributes
# at this point collapse_content avoids over-complicated structures like
unless(exists($self->{opt}->{suppressempty})
and !defined($self->{opt}->{suppressempty})
) {
- carp 'Use of uninitialized value' if($^W);
+ carp 'Use of uninitialized value' if warnings::enabled();
}
if($key eq $self->{opt}->{contentkey}) {
$text_content = '';
The use of this module in new code is discouraged. Other modules are available
which provide more straightforward and consistent interfaces. In particular,
-L<XML::LibXML> is highly recommended.
+L<XML::LibXML> is highly recommended and L<XML::Twig> is an excellent
+alternative.
-The major problems with this module are the large number of options and the
-arbitrary ways in which these options interact - often with unexpected results.
+The major problems with this module are the large number of options (some of
+which have unfortunate defaults) and the arbitrary ways in which these options
+interact - often producing unexpected results.
Patches with bug fixes and documentation fixes are welcome, but new features
are unlikely to be added.
The XML::Simple module provides a simple API layer on top of an underlying XML
parsing module (either XML::Parser or one of the SAX2 parser modules). Two
-functions are exported: C<XMLin()> and C<XMLout()>. Note: you can explicity
+functions are exported: C<XMLin()> and C<XMLout()>. Note: you can explicitly
request the lower case versions of the function names: C<xml_in()> and
C<xml_out()>.
=head2 KeyAttr => { list } I<# in+out - important>
-This alternative (and preferred) method of specifiying the key attributes
+This alternative (and preferred) method of specifying the key attributes
allows more fine grained control over which elements are folded and on which
attributes. For example the option 'KeyAttr => { package => 'id' } will cause
any package elements to be folded on the 'id' attribute. No other elements
Note: C<XMLin()> will generate a warning (or a fatal error in L<"STRICT MODE">)
if this syntax is used and an element which does not have the specified key
attribute is encountered (eg: a 'package' element without an 'id' attribute, to
-use the example above). Warnings will only be generated if B<-w> is in force.
+use the example above). Warnings can be suppressed with the lexical
+C<no warnings;> pragma or C<no warnings 'XML::Simple';>.
Two further variations are made possible by prefixing a '+' or a '-' character
to the attribute name:
Data error - KeyAttr is set to say { part => 'partnum' } but the XML contains
one or more E<lt>partE<gt> elements without a 'partnum' attribute (or nested
-element). Note: if strict mode is not set but -w is, this condition triggers a
-warning.
+element). Note: if strict mode is not set but C<use warnings;> is in force,
+this condition triggers a warning.
=item *
]
}
-Anonymous arrays can be nested to arbirtrary levels and as a special case, if
+Anonymous arrays can be nested to arbitrary levels and as a special case, if
the surrounding tags for an XML document contain only an anonymous array the
arrayref will be returned directly rather than the usual hashref:
=back
In a serious XML project, you'll probably outgrow these assumptions fairly
-quickly. This section of the document used to offer some advice on chosing a
+quickly. This section of the document used to offer some advice on choosing a
more powerful option. That advice has now grown into the 'Perl-XML FAQ'
document which you can find at: L<http://perl-xml.sourceforge.net/faq/>
event based parsers and then recommends:
For event based parsing, use SAX (do not set out to write any new code for
-XML::Parser's handler API - it is obselete).
+XML::Parser's handler API - it is obsolete).
For tree-based parsing, you could choose between the 'Perlish' approach of
L<XML::Twig> and more standards based DOM implementations - preferably one with
package XML::Simple::FAQ;
+$XML::Simple::FAQ::VERSION = '2.21';
1;
__END__
Is the directory where you've unpacked XML::Simple mounted from a file server
using NFS, SMB or some other network file sharing? If so, that may cause
-errors in the the following test scripts:
+errors in the following test scripts:
3_Storable.t
4_MemShare.t
Is one of the three test scripts (above) failing but you're not running on
a network filesystem? Are you running Win32? If so, you may be seeing a bug
-in Win32 where writes to a file do not affect its modfication timestamp.
+in Win32 where writes to a file do not affect its modification timestamp.
If none of these scenarios match your situation, please confirm you're
running the latest version of XML::Simple and then email the output of
use IO::File;
use File::Spec;
-
-# The suppress-able warnings still check the global flag
-
-$^W = 1;
+use XML::Simple;
# Initialise filenames and check they're there
plan skip_all => 'Test data missing';
}
-plan tests => 131;
+plan tests => 132;
my $last_warning = '';
-$@ = '';
-eval "use XML::Simple;";
is($@, '', 'Module compiled OK');
my $version = 'unknown';
if(open my $chg, '<Changes') {
);
$last_warning = '';
- local($^W) = 0;
- $opt = XMLin($xml, keyattr => { item => 'name' }, @cont_key);
- is_deeply($opt, $target, "did not fold on specific key with non-scalar value");
- is($last_warning, '', 'no warning issued (as expected)');
+ {
+ no warnings 'XML::Simple';
+ $opt = XMLin($xml, keyattr => { item => 'name' }, @cont_key);
+ is_deeply($opt, $target, "did not fold on specific key with non-scalar value");
+ is($last_warning, '', 'no warning issued (as expected)');
+ }
$last_warning = '';
- $^W = 1;
my $xitems = q(<opt>
<item name="color">red</item>
<item name="mass">heavy</item>
'expected warning issued');
$last_warning = '';
- $^W = 0;
- $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
- is_deeply($opt, $items, "same again");
- is($last_warning, '', 'but with no warning this time');
+ {
+ no warnings;
+ $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
+ is_deeply($opt, $items, "same again");
+ is($last_warning, '', 'but with no warning this time');
+ }
$last_warning = '';
- $^W = 1;
$xitems = q(<opt>
<item name="color">red</item>
<item name="mass">heavy</item>
'expected warning issued');
$last_warning = '';
- $^W = 0;
- $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
- is_deeply($opt, $items, "same again");
- is($last_warning, '', 'but with no warning this time');
+ {
+ no warnings;
+ $opt = XMLin($xitems, keyattr => { item => 'name' }, @cont_key);
+ is_deeply($opt, $items, "same again");
+ is($last_warning, '', 'but with no warning this time');
+ }
}
# Try parsing a named external file
-$@ = '';
$opt = eval{ XMLin($XMLFile); };
is($@, '', "XMLin didn't choke on named external file");
is_deeply($opt, {
# Try parsing default external file (scriptname.xml in script directory)
-$@ = '';
$opt = eval { XMLin(); };
is($@, '', "XMLin didn't choke on un-named (default) external file");
is_deeply($opt, {
# Try parsing named file in a directory in the searchpath
-$@ = '';
$opt = eval {
XMLin('test2.xml', searchpath => [
'dir1', 'dir2', File::Spec->catdir('t', 'subdir'), @cont_key
# Ensure we get expected result if file does not exist
-$@ = '';
$opt = undef;
$opt = eval {
XMLin('bogusfile.xml', searchpath => 't' ); # should 'die'
# same again, but with no searchpath
-$@ = '';
$opt = undef;
$opt = eval { XMLin('bogusfile.xml'); };
is($opt, undef, 'nonexistant file not found in current directory');
# Confirm searchpath is ignored if filename includes directory component
-$@ = '';
$opt = undef;
$opt = eval {
XMLin(File::Spec->catfile('subdir', 'test2.xml'), searchpath => 't' );
};
is($opt, undef, 'search path ignored when pathname supplied');
+like($@, qr/Could not find/, 'failed with expected message');
# Try parsing from an IO::Handle
-$@ = '';
my $fh = new IO::File;
$XMLFile = File::Spec->catfile('t', '1_XMLin.xml'); # t/1_XMLin.xml
eval {
# Try parsing from STDIN
close(STDIN);
-$@ = '';
eval {
open(STDIN, $XMLFile) || die "$!";
$opt = XMLin('-');
# Confirm only a hash is acceptable to grouptags and variables
-$@ = '';
$_ = eval { $opt = XMLin($xml, grouptags => [ 'dir' ]); };
ok(!defined($_), 'grouptags requires a hash');
like($@, qr/Illegal value for 'GroupTags' option - expected a hashref/,
'with correct error message');
-$@ = '';
$_ = eval { $opt = XMLin($xml, variables => [ 'dir' ]); };
ok(!defined($_), 'variables requires a hash');
like($@, qr/Illegal value for 'Variables' option - expected a hashref/,
# Test option error handling
-$@='';
$_ = eval { XMLin('<x y="z" />', rootname => 'fred') }; # not valid for XMLin()
is($_, undef, 'invalid options are trapped');
like($@, qr/Unrecognised option:/, 'with correct error message');
-$@='';
$_ = eval { XMLin('<x y="z" />', 'searchpath') };
is($_, undef, 'invalid number of options are trapped');
like($@, qr/Options must be name=>value pairs \(odd number supplied\)/,
use warnings;
use Test::More;
+use FileHandle; # Workaround for test failures on RHEL
+
plan tests => 201;
ok(!-e $TestFile, 'output file does not exist');
$xml = XMLout($hashref1);
-eval { XMLout($hashref1, outputfile => $TestFile); };
+XMLout($hashref1, outputfile => $TestFile);
ok(-e $TestFile, 'created xml output file');
is(ReadFile($TestFile), $xml, 'Contents match expectations');
unlink($TestFile);
# Test output to an IO handle
ok(!-e $TestFile);
-eval {
- open my $fh, '>', $TestFile or die "$!";
- XMLout($hashref1, outputfile => $fh);
- $fh->close();
-};
+open my $fh, '>', $TestFile or die "$!";
+XMLout($hashref1, outputfile => $fh);
+$fh->close();
ok(-e $TestFile, 'create XML output file via IO::File');
is(ReadFile($TestFile), $xml, 'Contents match expectations');
unlink($TestFile);
# Check undefined values generate warnings
{
- local($^W) = 1;
my $warn = '';
local $SIG{__WARN__} = sub { $warn = $_[0] };
$ref = { 'one' => 1, 'two' => undef };
like($warn, qr/Use of uninitialized value/,
'caught warning re uninitialised value');
like($_, $expect, 'undef maps to any empty attribute by default');
+}
+{
# unless warnings are disabled
- $^W = 0;
- $warn = '';
+ no warnings;
+ my $warn = '';
+ local $SIG{__WARN__} = sub { $warn = $_[0] };
+ my $expect = qr/^<\w+(\s+one="1"|\s+two=""){2}/;
+
$_ = XMLout($ref);
is($warn, '', 'no warning re uninitialised value if warnings off');
like($_, $expect, 'undef still maps to any empty attribute');
# Confirm content key works with undef values (and no warnings)
{
- $^W = 1;
my $warn = '';
local $SIG{__WARN__} = sub { $warn = $_[0] };
- $_ = eval {
- $ref = {
- column => [
- { name => 'title', content => 'A Title' },
- { name => 'sponsor', content => undef },
- ],
- };
- XMLout($ref, suppress_empty => undef, content_key => 'content');
+ $ref = {
+ column => [
+ { name => 'title', content => 'A Title' },
+ { name => 'sponsor', content => undef },
+ ],
};
+ $_ = XMLout($ref, suppress_empty => undef, content_key => 'content');
ok(!$warn, 'no warnings with suppress_empty => undef');
like($_, qr{^<(\w+)>
\s*<column\s+name="title"\s*>A\sTitle</column>
# Initialise filenames and check they're there
my $SrcFile = File::Spec->catfile('t', 'desertnet.src');
-my $XMLFile = File::Spec->catfile('t', 'desertnet.xml');
-my $CacheFile = File::Spec->catfile('t', 'desertnet.stor');
+my $XMLFile = File::Spec->catfile('t', 'desertnet3.xml');
+my $CacheFile = File::Spec->catfile('t', 'desertnet3.stor');
unless(-e $SrcFile) {
plan skip_all => 'test data missing';
# Initialise filenames and check they're there
my $SrcFile = File::Spec->catfile('t', 'desertnet.src');
-my $XMLFile = File::Spec->catfile('t', 'desertnet.xml');
+my $XMLFile = File::Spec->catfile('t', 'desertnet4.xml');
unless(-e $SrcFile) {
plan skip_all => 'test data missing';
is($opt2->{three}, 3, 'cache was modified');
+unlink($XMLFile);
exit(0);
# Initialise filenames and check they're there
my $SrcFile = File::Spec->catfile('t', 'desertnet.src');
-my $XMLFile = File::Spec->catfile('t', 'desertnet.xml');
+my $XMLFile = File::Spec->catfile('t', 'desertnet5.xml');
unless(-e $SrcFile) {
plan skip_all => 'test data missing';
# Initialise filenames and check they're there
my $SrcFile = File::Spec->catfile('t', 'desertnet.src');
-my $XMLFile = File::Spec->catfile('t', 'desertnet.xml');
+my $XMLFile = File::Spec->catfile('t', 'desertnet7.xml');
my $CacheFile = File::Spec->catfile('t', 'desertnet.stor');
unless(-e $SrcFile) {
};
$xml = XMLout($opt);
-like($xml, qr{
+like($xml, qr[
^\s*<opt
(\s+{http://www.w3.org/2000/xmlns/}perl="http://www.perl.com/"
|\s+{http://www.perl.com/}attr="value"
|\s+bare="Beer!"){3}
\s*>
- \s*<{http://www.perl.com/}element\s*>data</{http://www.perl.com/}element\s*>
+ \s*<\{http://www.perl.com/\}element\s*>data</\{http://www.perl.com/\}element\s*>
\s*</opt>
\s*$
-}sx, 'clarkian names not converted to qnames on output by default');
+]sx, 'clarkian names not converted to qnames on output by default');
# Confirm nsexpand option works on output
use File::Spec;
-# The suppress-able warnings still check the global flag
-
-$^W = 1;
-
# Initialise filenames and check they're there
my $XMLFile = File::Spec->catfile('t', 'test1.xml'); # t/test1.xml
{
local($SIG{__WARN__}) = \&warn_handler;
- $@ = '';
- $opt = eval { XMLin('<x y="z" />', nsexpand => 1) };
+ $opt = XMLin('<x y="z" />', nsexpand => 1);
}
isnt($last_warning, '', "Parsing caused warning (as expected)");
{
local($SIG{__WARN__}) = \&warn_handler;
- $@ = '';
$last_warning = '';
- $opt = eval { XMLin('<x y="z" />', ParserOpts => [ ParseParamEnt => 1 ]) };
+ $opt = XMLin('<x y="z" />', ParserOpts => [ ParseParamEnt => 1 ]);
}
isnt($last_warning, '', "Using ParserOpts caused warning (as expected)");
# Check it doesn't happen if warnings disabled
{
+ no warnings;
local($SIG{__WARN__}) = \&warn_handler;
- $@ = '';
$last_warning = '';
- local($^W) = 0;
- $opt = eval { XMLin('<x y="z" />', ParserOpts => [ ParseParamEnt => 1 ]) };
+ $opt = XMLin('<x y="z" />', ParserOpts => [ ParseParamEnt => 1 ]);
}
is($last_warning, '', "ParserOpts warning uppressed successfully");
# Try parsing a string
-$@ = '';
$opt = eval {
XMLin(q(<opt name1="value1" name2="value2"></opt>));
};
# Try parsing a named external file
-$@ = '';
$opt = eval{ XMLin($XMLFile); };
is($@, '', "XML::Parser didn't choke on named external file");
is_deeply($opt, {
# Try parsing from an IO::Handle
-$@ = '';
my $fh = new IO::File;
$XMLFile = File::Spec->catfile('t', '1_XMLin.xml'); # t/1_XMLin.xml
eval {
skip "Tie::IxHash not installed", 3 if $@;
- $@ = '';
eval <<'EOF';
package SimpleOrder;
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+use Test::Pod 1.41;
all_pod_files_ok();