r3205 - in /packages/libconfig-auto-perl/branches/upstream/current: Changes MANIFEST META.yml Makefile.PL lib/Config/Auto.pm t/xml-unavailable.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sun Jul 2 14:22:45 UTC 2006


Author: gregoa-guest
Date: Sun Jul  2 14:22:44 2006
New Revision: 3205

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3205
Log:
Load /tmp/tmp.yJivC13236/libconfig-auto-perl-0.18 into
packages/libconfig-auto-perl/branches/upstream/current.

Added:
    packages/libconfig-auto-perl/branches/upstream/current/t/xml-unavailable.t
Modified:
    packages/libconfig-auto-perl/branches/upstream/current/Changes
    packages/libconfig-auto-perl/branches/upstream/current/MANIFEST
    packages/libconfig-auto-perl/branches/upstream/current/META.yml
    packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL
    packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm

Modified: packages/libconfig-auto-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/Changes?rev=3205&op=diff
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/Changes (original)
+++ packages/libconfig-auto-perl/branches/upstream/current/Changes Sun Jul  2 14:22:44 2006
@@ -1,3 +1,14 @@
+0.18    Wed Jun 28 12:22:29 2006
+================================
+    - Address #19938 which states that calling parse()
+      on an xml config without XML::Simple installed
+      dies ungracefully. As of this version, better
+      diagnostics will be provided.
+
+0.17    Tue May  2 14:41:18 2006
+================================
+    - Improved YAML autodetection [#18241]
+
 0.15_01 Thu Aug 11 17:00:50 2005
 ================================
     - Added experimental YAML support

Modified: packages/libconfig-auto-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/MANIFEST?rev=3205&op=diff
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libconfig-auto-perl/branches/upstream/current/MANIFEST Sun Jul  2 14:22:44 2006
@@ -2,7 +2,6 @@
 lib/Config/Auto.pm
 Makefile.PL
 MANIFEST			This list of files
-META.yml			Module meta-data (added by MakeMaker)
 README
 t/00.load.t
 t/colon.t
@@ -20,5 +19,7 @@
 t/pod.t
 t/resolv.t
 t/winini.t
+t/xml-unavailable.t
 t/xml.t
 t/yaml.t
+META.yml                                 Module meta-data (added by MakeMaker)

Modified: packages/libconfig-auto-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/META.yml?rev=3205&op=diff
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/META.yml (original)
+++ packages/libconfig-auto-perl/branches/upstream/current/META.yml Sun Jul  2 14:22:44 2006
@@ -1,12 +1,14 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Config-Auto
-version:      0.16
+version:      0.18
 version_from: lib/Config/Auto.pm
 installdirs:  site
 requires:
     Config::IniFiles:              0
+    File::Spec::Functions:         0
+    Test::More:                    0
     YAML:                          0
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.25
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL?rev=3205&op=diff
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL Sun Jul  2 14:22:44 2006
@@ -15,9 +15,11 @@
 }
 
 my $prereqs = {
-    'XML::Simple'       => 0,
-    'YAML'              => 0,
-    'Config::IniFiles'  => 0,
+    'XML::Simple'           => 0,
+    'YAML'                  => 0,
+    'Config::IniFiles'      => 0,
+    'File::Spec::Functions' => 0,
+    'Test::More'            => 0,
 };
 delete $prereqs->{'XML::Simple'} unless $opts->{'x'};             
 
@@ -26,7 +28,7 @@
     'VERSION_FROM'	    => 'lib/Config/Auto.pm', # finds $VERSION
     'PREREQ_PM'		    => $prereqs, 
     ( $] >= 5.005 
-        ? ( ABSTRACT_FROM    => 'lib/Config/Auto.pm', # retrieve abstract from module
+        ? ( ABSTRACT_FROM    => 'lib/Config/Auto.pm', 
             AUTHOR           => 'Jos I. Boumans <kane at cpan.org>') 
         : ()
     ),

Modified: packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm?rev=3205&op=diff
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm (original)
+++ packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm Sun Jul  2 14:22:44 2006
@@ -10,7 +10,7 @@
 
 use vars qw[$VERSION $DisablePerl $Untaint $Format];
 
-$VERSION = '0.16';
+$VERSION = '0.18';
 $DisablePerl = 0;
 $Untaint = 0;
 
@@ -27,7 +27,9 @@
     yaml   => \&yaml,
 );
 
-delete $methods{'xml'}
+### make sure we give good diagnostics when XML::Simple is not available,
+### but required to parse a config
+$methods{'xml'} = sub { croak "XML::Simple not available. Can not parse '@_'" }
     unless eval { require XML::Simple; XML::Simple->import; 1 };
 
 sub parse {
@@ -39,7 +41,14 @@
     croak "No config file found!"           if not defined $file;
     croak "Config file $file not readable!" if not -e $file;
 
-    return if -B $file;
+    
+    ### from Toru Marumoto: Config-Auto return undef if -B $file     
+    ### <21d48be50604271656n153e6db6m9b059f57548aaa32 at mail.gmail.com>
+    # If a config file "$file" contains multibyte charactors like japanese,
+    # -B returns "true" in old version of perl such as 5.005_003. It seems
+    # there is no problem in perl 5.6x or older.
+    ### so check -B and only return only if 
+    return if -B $file and $] >= '5.006';
 
     my $method;
     my @data;
@@ -58,6 +67,7 @@
             @data = <CONFIG>;
         }
         my %scores = score(\@data);
+
         delete $scores{perl} if exists $scores{perl} and $DisablePerl;
         croak "Unparsable file format!" if !keys %scores;
         # Clear winner?
@@ -85,8 +95,13 @@
 
     for (@$data_r) {
         ### it's almost definately YAML if the first line matches this
-        $score{yaml} += 20              if /--- #YAML:/ and $data_r->[0] eq $_;
-    
+        $score{yaml} += 20              if /(?:\#|%)    # a #YAML or %YAML
+                                            YAML
+                                            (?::|\s)    # a YAML: or YAML[space]
+                                        /x and $data_r->[0] eq $_;
+        $score{yaml} += 20              if /^---/ and $data_r->[0] eq $_;   
+        $score{yaml} += 10              if /^\s+-\s\w+:\s\w+/;
+        
         # Easy to comment out foo=bar syntax
         $score{equal}++                 if /^\s*#\s*\w+\s*=/;
         next if /^\s*#/;

Added: packages/libconfig-auto-perl/branches/upstream/current/t/xml-unavailable.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libconfig-auto-perl/branches/upstream/current/t/xml-unavailable.t?rev=3205&op=file
==============================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/t/xml-unavailable.t (added)
+++ packages/libconfig-auto-perl/branches/upstream/current/t/xml-unavailable.t Sun Jul  2 14:22:44 2006
@@ -1,0 +1,21 @@
+use Test::More tests => 3;
+use strict;
+use warnings;
+use File::Spec::Functions;
+
+### whitebox test, disabling XML::Simple
+{   package XML::Simple;
+    $INC{'XML/Simple.pm'} = $0;
+    
+    sub import { die };
+}
+
+use_ok('Config::Auto');
+
+eval { Config::Auto::parse(
+            'config.xml',path => catdir('t','config')
+        );
+};
+
+ok( $@,                     "parse() on xml dies without XML::Simple" );
+like( $@, qr/XML::Simple/,  "   Error message is informative" );




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