r2113 - in packages/libconfig-auto-perl/branches/upstream/current: . lib/Config t t/config

Krzysztof Krzyzaniak eloy at costa.debian.org
Sun Feb 12 16:42:18 UTC 2006


Author: eloy
Date: 2006-02-12 16:42:17 +0000 (Sun, 12 Feb 2006)
New Revision: 2113

Added:
   packages/libconfig-auto-perl/branches/upstream/current/META.yml
   packages/libconfig-auto-perl/branches/upstream/current/t/config/config.yml
   packages/libconfig-auto-perl/branches/upstream/current/t/yaml.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/Makefile.PL
   packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm
Log:
Load /tmp/tmp.Dzd1qD/libconfig-auto-perl-0.16 into
packages/libconfig-auto-perl/branches/upstream/current.


Modified: packages/libconfig-auto-perl/branches/upstream/current/Changes
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/Changes	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/Changes	2006-02-12 16:42:17 UTC (rev 2113)
@@ -1,3 +1,7 @@
+0.15_01 Thu Aug 11 17:00:50 2005
+================================
+    - Added experimental YAML support
+
 0.14    Thu Aug 11 16:27:50 2005
 ================================
     - Fix uninitialized value warning

Modified: packages/libconfig-auto-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/MANIFEST	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/MANIFEST	2006-02-12 16:42:17 UTC (rev 2113)
@@ -1,12 +1,14 @@
 Changes
+lib/Config/Auto.pm
+Makefile.PL
 MANIFEST			This list of files
-Makefile.PL
+META.yml			Module meta-data (added by MakeMaker)
 README
-lib/Config/Auto.pm
 t/00.load.t
 t/colon.t
 t/config/colon.conf
 t/config/config.xml
+t/config/config.yml
 t/config/deb.conf
 t/config/nsswitch.conf
 t/config/passwd
@@ -19,4 +21,4 @@
 t/resolv.t
 t/winini.t
 t/xml.t
-
+t/yaml.t

Added: packages/libconfig-auto-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/META.yml	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/META.yml	2006-02-12 16:42:17 UTC (rev 2113)
@@ -0,0 +1,12 @@
+# 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_from: lib/Config/Auto.pm
+installdirs:  site
+requires:
+    Config::IniFiles:              0
+    YAML:                          0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.25

Modified: packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/Makefile.PL	2006-02-12 16:42:17 UTC (rev 2113)
@@ -16,6 +16,7 @@
 
 my $prereqs = {
     'XML::Simple'       => 0,
+    'YAML'              => 0,
     'Config::IniFiles'  => 0,
 };
 delete $prereqs->{'XML::Simple'} unless $opts->{'x'};             

Modified: packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/lib/Config/Auto.pm	2006-02-12 16:42:17 UTC (rev 2113)
@@ -10,7 +10,7 @@
 
 use vars qw[$VERSION $DisablePerl $Untaint $Format];
 
-$VERSION = '0.14';
+$VERSION = '0.16';
 $DisablePerl = 0;
 $Untaint = 0;
 
@@ -24,6 +24,7 @@
     xml    => \&parse_xml,
     ini    => \&parse_ini,
     list   => \&return_list,
+    yaml   => \&yaml,
 );
 
 delete $methods{'xml'}
@@ -83,6 +84,9 @@
     my %score;
 
     for (@$data_r) {
+        ### it's almost definately YAML if the first line matches this
+        $score{yaml} += 20              if /--- #YAML:/ and $data_r->[0] eq $_;
+    
         # Easy to comment out foo=bar syntax
         $score{equal}++                 if /^\s*#\s*\w+\s*=/;
         next if /^\s*#/;
@@ -189,8 +193,10 @@
 }
 
 sub parse_xml   { return XMLin(shift); }
-sub parse_ini   { tie my %ini, 'Config::IniFiles', (-file=>$_[0]); return \%ini; }
+sub parse_ini   { tie my %ini, 'Config::IniFiles', (-file=>$_[0]); 
+                    return \%ini; }
 sub return_list { open my $fh, shift or die $!; return [<$fh>]; }
+sub yaml        { require YAML; return YAML::LoadFile( shift ) }
 
 sub bind_style  { croak "BIND8-style config not supported in this release" }
 sub irssi_style { croak "irssi-style config not supported in this release" }
@@ -472,9 +478,10 @@
 
 =item * list    => list (e.g., ??)
 
+=item * yaml    => yaml (via YAML.pm)
+
 =back
 
-
 =head1 TROUBLESHOOTING
 
 =over 4
@@ -498,7 +505,7 @@
 =head1 LICENSE
 
 This module is
-copyright (c) 2003 Jos Boumans E<lt>kane at cpan.orgE<gt>.
+copyright (c) 2003-2006 Jos Boumans E<lt>kane at cpan.orgE<gt>.
 All rights reserved.
 
 This library is free software;

Added: packages/libconfig-auto-perl/branches/upstream/current/t/config/config.yml
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/t/config/config.yml	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/t/config/config.yml	2006-02-12 16:42:17 UTC (rev 2113)
@@ -0,0 +1,3 @@
+--- #YAML:1.0
+test:
+  foo: bar

Added: packages/libconfig-auto-perl/branches/upstream/current/t/yaml.t
===================================================================
--- packages/libconfig-auto-perl/branches/upstream/current/t/yaml.t	2006-02-12 16:40:11 UTC (rev 2112)
+++ packages/libconfig-auto-perl/branches/upstream/current/t/yaml.t	2006-02-12 16:42:17 UTC (rev 2113)
@@ -0,0 +1,20 @@
+use Test::More tests => 5;
+
+use strict;
+use warnings;
+no warnings qw(once);
+use File::Spec::Functions;
+
+my $Class = 'Config::Auto';
+
+use_ok( $Class );
+
+my $sub = $Class->can('parse');
+my $config = $sub->( 'config.yml',   path => catdir('t','config') );
+
+is( $Config::Auto::Format, 'yaml',
+                                'Config file colon formatted');
+
+ok( $config->{test},            "   Key 'test' exists" );
+is( ref $config->{test}, 'HASH',"   It's a hash" );
+is( $config->{test}{foo}, 'bar',"   With the proper value");




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