r26942 - in /branches/upstream/libconfig-any-perl/current: ./ inc/Module/ inc/Module/Install/ lib/Config/ lib/Config/Any/ t/ t/conf/ t/lib/ t/lib/Config/ t/lib/Config/Any/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sun Nov 16 11:41:38 UTC 2008


Author: ansgar-guest
Date: Sun Nov 16 11:41:32 2008
New Revision: 26942

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26942
Log:
[svn-upgrade] Integrating new upstream version, libconfig-any-perl (0.15)

Added:
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/Base.pm
    branches/upstream/libconfig-any-perl/current/t/63-unsupported.t
    branches/upstream/libconfig-any-perl/current/t/64-extfail.t
    branches/upstream/libconfig-any-perl/current/t/conf/conf.unsupported
    branches/upstream/libconfig-any-perl/current/t/lib/
    branches/upstream/libconfig-any-perl/current/t/lib/Config/
    branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/
    branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/Unsupported.pm
Modified:
    branches/upstream/libconfig-any-perl/current/Changes
    branches/upstream/libconfig-any-perl/current/MANIFEST
    branches/upstream/libconfig-any-perl/current/META.yml
    branches/upstream/libconfig-any-perl/current/inc/Module/Install.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/AutoInstall.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Base.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Can.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Fetch.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Include.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Makefile.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Metadata.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/Win32.pm
    branches/upstream/libconfig-any-perl/current/inc/Module/Install/WriteAll.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/General.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/INI.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/JSON.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/Perl.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/XML.pm
    branches/upstream/libconfig-any-perl/current/lib/Config/Any/YAML.pm
    branches/upstream/libconfig-any-perl/current/t/10-branches.t
    branches/upstream/libconfig-any-perl/current/t/50-general.t
    branches/upstream/libconfig-any-perl/current/t/51-ini.t
    branches/upstream/libconfig-any-perl/current/t/52-json.t
    branches/upstream/libconfig-any-perl/current/t/53-perl.t
    branches/upstream/libconfig-any-perl/current/t/54-xml.t
    branches/upstream/libconfig-any-perl/current/t/55-yaml.t
    branches/upstream/libconfig-any-perl/current/t/61-features.t

Modified: branches/upstream/libconfig-any-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/Changes?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/Changes (original)
+++ branches/upstream/libconfig-any-perl/current/Changes Sun Nov 16 11:41:32 2008
@@ -1,4 +1,15 @@
 Revision history for Config-Any
+
+0.15 Wed 12 Nov 2008
+    - when use_ext is true, we will check to see if there are no supported
+      modules for a particular file. instead of the file being skipped, an
+      error will be thrown (RT #38927).
+    - also, when use_ext is true, a fatal error will be thrown if there are
+      no loaders available that understand the file extension.
+    - officially support multiple loaders per extension
+    - add a Config::Any::Base for all loaders to inherit from, plus add
+      a new dependency mechanism: requires_any_of() and requires_all_of().
+    - filter out loaders that don't inherit from Config::Any::Base (RT #40830)
 
 0.14 Wed 06 Aug 2008
     - skip xml failure tests if XML::LibXML < 1.59 is installed, it seems

Modified: branches/upstream/libconfig-any-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/MANIFEST?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/MANIFEST (original)
+++ branches/upstream/libconfig-any-perl/current/MANIFEST Sun Nov 16 11:41:32 2008
@@ -11,6 +11,7 @@
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/Config/Any.pm
+lib/Config/Any/Base.pm
 lib/Config/Any/General.pm
 lib/Config/Any/INI.pm
 lib/Config/Any/JSON.pm
@@ -32,11 +33,14 @@
 t/55-yaml.t
 t/61-features.t
 t/62-multi.t
+t/63-unsupported.t
+t/64-extfail.t
 t/conf/conf.conf
 t/conf/conf.foo
 t/conf/conf.ini
 t/conf/conf.json
 t/conf/conf.pl
+t/conf/conf.unsupported
 t/conf/conf.xml
 t/conf/conf.yml
 t/conf/conf2.ini
@@ -47,6 +51,7 @@
 t/invalid/conf.pl
 t/invalid/conf.xml
 t/invalid/conf.yml
+t/lib/Config/Any/Unsupported.pm
 t/multi/conf.yml
 t/pod-coverage.t
 t/pod.t

Modified: branches/upstream/libconfig-any-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/META.yml?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/META.yml (original)
+++ branches/upstream/libconfig-any-perl/current/META.yml Sun Nov 16 11:41:32 2008
@@ -5,7 +5,7 @@
 build_requires:
   Test::More: 0
 distribution_type: module
-generated_by: 'Module::Install version 0.76'
+generated_by: 'Module::Install version 0.77'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,4 +20,4 @@
   perl: 5.6.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.14
+version: 0.15

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install.pm Sun Nov 16 11:41:32 2008
@@ -30,7 +30,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 
 	*inc::Module::Install::VERSION = *VERSION;
 	@inc::Module::Install::ISA     = __PACKAGE__;
@@ -125,8 +125,10 @@
 			goto &$code unless $cwd eq $pwd;
 		}
 		$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
-		unshift @_, ( $self, $1 );
-		goto &{$self->can('call')} unless uc($1) eq $1;
+		unless ( uc($1) eq $1 ) {
+			unshift @_, ( $self, $1 );
+			goto &{$self->can('call')};
+		}
 	};
 }
 
@@ -339,6 +341,9 @@
 	close FH or die "close($_[0]): $!";
 }
 
+# _version is for processing module versions (eg, 1.03_05) not
+# Perl versions (eg, 5.8.1).
+
 sub _version ($) {
 	my $s = shift || 0;
 	   $s =~ s/^(\d+)\.?//;

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/AutoInstall.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/AutoInstall.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/AutoInstall.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Base.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Base.pm Sun Nov 16 11:41:32 2008
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.76';
+$VERSION = '0.77';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Can.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Can.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Can.pm Sun Nov 16 11:41:32 2008
@@ -11,7 +11,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -39,6 +39,7 @@
 	return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
 
 	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+		next if $dir eq '';
 		my $abs = File::Spec->catfile($dir, $_[1]);
 		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
 	}
@@ -79,4 +80,4 @@
 
 __END__
 
-#line 157
+#line 158

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Fetch.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Fetch.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Fetch.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Include.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Include.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Include.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Makefile.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Makefile.pm Sun Nov 16 11:41:32 2008
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -181,7 +181,9 @@
 
 	my $user_preop = delete $args{dist}->{PREOP};
 	if (my $preop = $self->admin->preop($user_preop)) {
-		$args{dist} = $preop;
+		foreach my $key ( keys %$preop ) {
+			$args{dist}->{$key} = $preop->{$key};
+		}
 	}
 
 	my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -248,4 +250,4 @@
 
 __END__
 
-#line 377
+#line 379

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Metadata.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Metadata.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -175,6 +175,12 @@
 	my $version = shift or die(
 		"Did not provide a value to perl_version()"
 	);
+
+	# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
+	# numbers (eg, 5.006001 or 5.008009).
+
+	$version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
+
 	$version =~ s/_.+$//;
 	$version = $version + 0; # Numify
 	unless ( $version >= 5.005 ) {
@@ -212,6 +218,9 @@
 		unless ( -e $file ) {
 			die("all_from cannot find $file from $name");
 		}
+	}
+	unless ( -f $file ) {
+		die("The path '$file' does not exist, or is not a file");
 	}
 
 	# Some methods pull from POD instead of code.
@@ -424,8 +433,12 @@
 		my $license_text = $1;
 		my @phrases      = (
 			'under the same (?:terms|license) as perl itself' => 'perl',        1,
+			'GNU general public license'                      => 'gpl',         1,
 			'GNU public license'                              => 'gpl',         1,
+			'GNU lesser general public license'               => 'lgpl',        1,
 			'GNU lesser public license'                       => 'lgpl',        1,
+			'GNU library general public license'              => 'lgpl',        1,
+			'GNU library public license'                      => 'lgpl',        1,
 			'BSD license'                                     => 'bsd',         1,
 			'Artistic license'                                => 'artistic',    1,
 			'GPL'                                             => 'gpl',         1,

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/Win32.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/Win32.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/Win32.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: branches/upstream/libconfig-any-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/inc/Module/Install/WriteAll.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/inc/Module/Install/WriteAll.pm (original)
+++ branches/upstream/libconfig-any-perl/current/inc/Module/Install/WriteAll.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.77';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any.pm Sun Nov 16 11:41:32 2008
@@ -6,7 +6,7 @@
 use Carp;
 use Module::Pluggable::Object ();
 
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 =head1 NAME
 
@@ -149,7 +149,10 @@
     my $use_ext_lut = !$force && $args->{ use_ext };
     if ( $use_ext_lut ) {
         for my $plugin ( @plugins ) {
-            $extension_lut{ $_ } = $plugin for $plugin->extensions;
+            for ( $plugin->extensions ) {
+                $extension_lut{ $_ } ||= [];
+                push @{ $extension_lut{ $_ } }, $plugin;
+            }
         }
 
         $extension_re = join( '|', keys %extension_lut );
@@ -174,12 +177,21 @@
 
         if ( $use_ext_lut ) {
             $filename =~ m{\.($extension_re)\z};
-            next unless $1;
-            @try_plugins = $extension_lut{ $1 };
-        }
-
+
+            if( !$1 ) {
+                $filename =~ m{\.([^.]+)\z};
+                croak "There are no loaders available for .${1} files";
+            }
+
+            @try_plugins = @{ $extension_lut{ $1 } };
+        }
+
+        # not using use_ext means we try all plugins anyway, so we'll
+        # ignore it for the "unsupported" error
+        my $supported = $use_ext_lut ? 0 : 1;
         for my $loader ( @try_plugins ) {
             next unless $loader->is_supported;
+            $supported = 1;
             my @configs
                 = eval { $loader->load( $filename, $loader_args{ $loader } ); };
 
@@ -196,6 +208,12 @@
                 { $filename => @configs == 1 ? $configs[ 0 ] : \@configs };
             last;
         }
+
+        if ( !$supported ) {
+            croak
+                "Cannot load $filename: required support modules are not available.\nPlease install "
+                . join( " OR ", map { _support_error( $_ ) } @try_plugins );
+        }
     }
 
     if ( defined $args->{ flatten_to_hash } ) {
@@ -204,6 +222,17 @@
     }
 
     return \@results;
+}
+
+sub _support_error {
+    my $module = shift;
+    if ( $module->can( 'requires_all_of' ) ) {
+        return join( ' and ',
+            map { ref $_ ? join( ' ', @$_ ) : $_ } $module->requires_all_of );
+    }
+    if ( $module->can( 'requires_any_of' ) ) {
+        return 'one of ' . join( ' or ', $module->requires_any_of );
+    }
 }
 
 =head2 finder( )
@@ -219,6 +248,7 @@
     my $class  = shift;
     my $finder = Module::Pluggable::Object->new(
         search_path => [ __PACKAGE__ ],
+        except      => [ __PACKAGE__ . '::Base' ],
         require     => 1
     );
     return $finder;
@@ -233,7 +263,8 @@
 
 sub plugins {
     my $class = shift;
-    return $class->finder->plugins;
+    # filter out things that don't look like our plugins
+    return grep { $_->isa( 'Config::Any::Base' ) } $class->finder->plugins;
 }
 
 =head2 extensions( )

Added: branches/upstream/libconfig-any-perl/current/lib/Config/Any/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/Base.pm?rev=26942&op=file
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/Base.pm (added)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/Base.pm Sun Nov 16 11:41:32 2008
@@ -1,0 +1,85 @@
+package Config::Any::Base;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Config::Any::Base - Base class for loaders
+
+=head1 DESCRIPTION
+
+This is a base class for all loaders. It currently handles the specification
+of dependencies in order to ensure the subclass can load the config file
+format.
+
+=head1 METHODS
+
+=head2 is_supported( )
+
+Allows us to determine if the file format can be loaded. The can be done via
+one of two subclass methds:
+
+=over 4
+
+=item * C<requires_all_of()> - returns an array of items that must all be present in order to work
+
+=item * C<requires_any_of()> - returns an array of items in which at least one must be present
+
+=back
+
+You can specify a module version by passing an array reference in the return.
+
+    sub requires_all_of { [ 'My::Module', '1.1' ], 'My::OtherModule' }
+
+Lack of specifying these subs will assume you require no extra modules to function.
+
+=cut
+
+sub is_supported {
+    my ( $class ) = shift;
+    if ( $class->can( 'requires_all_of' ) ) {
+        eval join( '', map { _require_line( $_ ) } $class->requires_all_of );
+        return $@ ? 0 : 1;
+    }
+    if ( $class->can( 'requires_any_of' ) ) {
+        for ( $class->requires_any_of ) {
+            eval _require_line( $_ );
+            return 1 unless $@;
+        }
+        return 0;
+    }
+
+    # requires nothing!
+    return 1;
+}
+
+sub _require_line {
+    my ( $input ) = shift;
+    my ( $module, $version ) = ( ref $input ? @$input : $input );
+    return "require $module;"
+        . ( $version ? "${module}->VERSION('${version}');" : '' );
+}
+
+=head1 AUTHOR
+
+Brian Cassidy E<lt>bricas at cpan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2008 by Brian Cassidy
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself. 
+
+=head1 SEE ALSO
+
+=over 4 
+
+=item * L<Config::Any>
+
+=back
+
+=cut
+
+1;

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/General.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/General.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/General.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/General.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 =head1 NAME
 
@@ -68,16 +70,13 @@
     return defined $is_perl_src;
 }
 
-=head2 is_supported( )
+=head2 requires_all_of( )
 
-Returns true if L<Config::General> is available.
+Specifies that this module requires L<Config::General> in order to work.
 
 =cut
 
-sub is_supported {
-    eval { require Config::General; };
-    return $@ ? 0 : 1;
-}
+sub requires_all_of { 'Config::General' }
 
 =head1 AUTHOR
 

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/INI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/INI.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/INI.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/INI.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 our $MAP_SECTION_SPACE_TO_NESTED_KEY = 1;
 
@@ -66,16 +68,13 @@
     return $out;
 }
 
-=head2 is_supported( )
+=head2 requires_all_of( )
 
-Returns true if L<Config::Tiny> is available.
+Specifies that this module requires L<Config::Tiny> in order to work.
 
 =cut
 
-sub is_supported {
-    eval { require Config::Tiny; };
-    return $@ ? 0 : 1;
-}
+sub requires_all_of { 'Config::Tiny' }
 
 =head1 PACKAGE VARIABLES
 

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/JSON.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/JSON.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/JSON.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/JSON.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 =head1 NAME
 
@@ -58,18 +60,14 @@
     }
 }
 
-=head2 is_supported( )
+=head2 requires_any_of( )
 
-Returns true if either L<JSON::Syck> or L<JSON> is available.
+Specifies that this modules requires one of L<JSON::Syck> or L<JSON> in 
+order to work.
 
 =cut
 
-sub is_supported {
-    eval { require JSON::Syck; };
-    return 1 unless $@;
-    eval { require JSON; };
-    return $@ ? 0 : 1;
-}
+sub requires_any_of { 'JSON::Syck', 'JSON' }
 
 =head1 AUTHOR
 

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/Perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/Perl.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/Perl.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/Perl.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 my %cache;
 
@@ -54,16 +56,6 @@
     return $content;
 }
 
-=head2 is_supported( )
-
-Returns true.
-
-=cut
-
-sub is_supported {
-    return 1;
-}
-
 =head1 AUTHOR
 
 Brian Cassidy E<lt>bricas at cpan.orgE<gt>

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/XML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/XML.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/XML.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/XML.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 =head1 NAME
 
@@ -73,16 +75,13 @@
     $out;
 }
 
-=head2 is_supported( )
+=head2 requires_all_of( )
 
-Returns true if L<XML::Simple> is available.
+Specifies that this module requires L<XML::Simple> in order to work.
 
 =cut
 
-sub is_supported {
-    eval { require XML::Simple; };
-    return $@ ? 0 : 1;
-}
+sub requires_all_of { 'XML::Simple' }
 
 =head1 CAVEATS
 

Modified: branches/upstream/libconfig-any-perl/current/lib/Config/Any/YAML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/lib/Config/Any/YAML.pm?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/lib/Config/Any/YAML.pm (original)
+++ branches/upstream/libconfig-any-perl/current/lib/Config/Any/YAML.pm Sun Nov 16 11:41:32 2008
@@ -2,6 +2,8 @@
 
 use strict;
 use warnings;
+
+use base 'Config::Any::Base';
 
 =head1 NAME
 
@@ -54,18 +56,14 @@
     }
 }
 
-=head2 is_supported( )
+=head2 requires_any_of( )
 
-Returns true if either L<YAML::Syck> or L<YAML> is available.
+Specifies that this modules requires one of L<YAML::Syck> (0.70) or L<YAML> in 
+order to work.
 
 =cut
 
-sub is_supported {
-    eval { require YAML::Syck; YAML::Syck->VERSION( '0.70' ) };
-    return 1 unless $@;
-    eval { require YAML; };
-    return $@ ? 0 : 1;
-}
+sub requires_any_of { [ 'YAML::Syck', '0.70' ], 'YAML' }
 
 =head1 AUTHOR
 

Modified: branches/upstream/libconfig-any-perl/current/t/10-branches.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/10-branches.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/10-branches.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/10-branches.t Sun Nov 16 11:41:32 2008
@@ -38,7 +38,8 @@
     );
 }
 
-my @files = glob( "t/conf/conf.*" );
+# grep out files we don't understand for these tests
+my @files = grep { !m{\.(foo|unsupported)$} } glob( "t/conf/conf.*" );
 my $filter = sub { return };
 ok( Config::Any->load_files( { files => \@files, use_ext => 0 } ),
     "use_ext 0 works" );

Modified: branches/upstream/libconfig-any-perl/current/t/50-general.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/50-general.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/50-general.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/50-general.t Sun Nov 16 11:41:32 2008
@@ -30,5 +30,5 @@
     my $config = eval { Config::Any::General->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/51-ini.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/51-ini.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/51-ini.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/51-ini.t Sun Nov 16 11:41:32 2008
@@ -53,5 +53,5 @@
     my $config = eval { Config::Any::INI->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/52-json.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/52-json.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/52-json.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/52-json.t Sun Nov 16 11:41:32 2008
@@ -23,5 +23,5 @@
     my $config = eval { Config::Any::JSON->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/53-perl.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/53-perl.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/53-perl.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/53-perl.t Sun Nov 16 11:41:32 2008
@@ -22,5 +22,5 @@
     my $config = eval { Config::Any::Perl->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/54-xml.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/54-xml.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/54-xml.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/54-xml.t Sun Nov 16 11:41:32 2008
@@ -19,13 +19,14 @@
 
 # test invalid config
 SKIP: {
-    my $broken_libxml = eval { require XML::LibXML; XML::LibXML->VERSION lt '1.59'; };
+    my $broken_libxml
+        = eval { require XML::LibXML; XML::LibXML->VERSION lt '1.59'; };
     skip 'XML::LibXML < 1.58 has issues', 2 if $broken_libxml;
 
-    local $SIG{__WARN__} = sub {}; # squash warnings from XML::Simple
+    local $SIG{ __WARN__ } = sub { };    # squash warnings from XML::Simple
     my $file = 't/invalid/conf.xml';
     my $config = eval { Config::Any::XML->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/55-yaml.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/55-yaml.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/55-yaml.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/55-yaml.t Sun Nov 16 11:41:32 2008
@@ -23,5 +23,5 @@
     my $config = eval { Config::Any::YAML->load( $file ) };
 
     ok( !$config, 'config load failed' );
-    ok( $@, "error thrown ($@)" );
+    ok( $@,       "error thrown ($@)" );
 }

Modified: branches/upstream/libconfig-any-perl/current/t/61-features.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/61-features.t?rev=26942&op=diff
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/61-features.t (original)
+++ branches/upstream/libconfig-any-perl/current/t/61-features.t Sun Nov 16 11:41:32 2008
@@ -59,7 +59,7 @@
             }
         );
 
-        ok( $result, 'load file with parser forced, flatten to hash' );
+        ok( $result,     'load file with parser forced, flatten to hash' );
         ok( ref $result, 'load_files hashref contains a ref' );
 
         my $ref = blessed $result ? reftype $result : ref $result;

Added: branches/upstream/libconfig-any-perl/current/t/63-unsupported.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/63-unsupported.t?rev=26942&op=file
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/63-unsupported.t (added)
+++ branches/upstream/libconfig-any-perl/current/t/63-unsupported.t Sun Nov 16 11:41:32 2008
@@ -1,0 +1,22 @@
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use lib 't/lib';
+use Config::Any;
+
+{
+    my $result = eval {
+        Config::Any->load_files(
+            { files => [ 't/conf/conf.unsupported' ], use_ext => 1 } );
+    };
+
+    ok( !defined $result, 'empty result' );
+    ok( $@,               'error thrown' );
+    like(
+        $@,
+        qr/required support modules are not available/,
+        'error message'
+    );
+}

Added: branches/upstream/libconfig-any-perl/current/t/64-extfail.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/64-extfail.t?rev=26942&op=file
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/64-extfail.t (added)
+++ branches/upstream/libconfig-any-perl/current/t/64-extfail.t Sun Nov 16 11:41:32 2008
@@ -1,0 +1,21 @@
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Config::Any;
+
+{
+    my $result = eval {
+        Config::Any->load_files(
+            { files => [ 't/conf/conf.unsupported' ], use_ext => 1 } );
+    };
+
+    ok( !defined $result, 'empty result' );
+    ok( $@,               'error thrown' );
+    like(
+        $@,
+        qr/There are no loaders available for \.unsupported files/,
+        'error message'
+    );
+}

Added: branches/upstream/libconfig-any-perl/current/t/conf/conf.unsupported
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/conf/conf.unsupported?rev=26942&op=file
==============================================================================
    (empty)

Added: branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/Unsupported.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/Unsupported.pm?rev=26942&op=file
==============================================================================
--- branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/Unsupported.pm (added)
+++ branches/upstream/libconfig-any-perl/current/t/lib/Config/Any/Unsupported.pm Sun Nov 16 11:41:32 2008
@@ -1,0 +1,17 @@
+package Config::Any::Unsupported;
+
+use strict;
+use warnings;
+
+use base 'Config::Any::Base';
+
+sub extensions {
+    return qw( unsupported );
+}
+
+sub load {
+}
+
+sub requires_all_of { 'My::Module::DoesNotExist' }
+
+1;




More information about the Pkg-perl-cvs-commits mailing list