r58442 - in /branches/upstream/libconfig-mvp-perl/current: ./ lib/Config/ lib/Config/MVP/ lib/Config/MVP/Assembler/ lib/Config/MVP/Reader/ lib/Config/MVP/Reader/Findable/ t/ t/lib/Config/MVP/Reader/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Wed May 26 10:55:29 UTC 2010


Author: ansgar-guest
Date: Wed May 26 10:52:21 2010
New Revision: 58442

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

Added:
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/ByExtension.pm
Modified:
    branches/upstream/libconfig-mvp-perl/current/Changes
    branches/upstream/libconfig-mvp-perl/current/MANIFEST
    branches/upstream/libconfig-mvp-perl/current/META.json
    branches/upstream/libconfig-mvp-perl/current/META.yml
    branches/upstream/libconfig-mvp-perl/current/Makefile.PL
    branches/upstream/libconfig-mvp-perl/current/README
    branches/upstream/libconfig-mvp-perl/current/dist.ini
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler/WithBundles.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Finder.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Hash.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Section.pm
    branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Sequence.pm
    branches/upstream/libconfig-mvp-perl/current/t/hash.t
    branches/upstream/libconfig-mvp-perl/current/t/lib/Config/MVP/Reader/Test.pm
    branches/upstream/libconfig-mvp-perl/current/t/reader.t

Modified: branches/upstream/libconfig-mvp-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/Changes?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/Changes (original)
+++ branches/upstream/libconfig-mvp-perl/current/Changes Wed May 26 10:52:21 2010
@@ -1,4 +1,23 @@
 Revision history for Config-MVP
+
+1.101451  2010-05-25 22:38:06 America/New_York
+          always finalize sections added by bundles
+
+1.101450  2010-05-25 18:13:19 America/New_York
+          [BREAKS BACKWARD COMPATIBILITY]
+
+          The Reader interface has been substantially overhauled.
+
+          Readers no longer have persistent Assembler, but now must be handed
+          one (or will generate one as needed)
+
+          the arguments for Reader->read_config have changed
+
+          classes implementing Reader are required to provide a
+          read_into_assembler method, now
+
+          Reader::Findable has been broken into Findable and
+          Findable::ByExtension
 
 0.101410  2010-05-21 22:09:48 America/New_York
           Sections, Sequences, and Assemblers  can now be finalized

Modified: branches/upstream/libconfig-mvp-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/MANIFEST?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/MANIFEST (original)
+++ branches/upstream/libconfig-mvp-perl/current/MANIFEST Wed May 26 10:52:21 2010
@@ -11,6 +11,7 @@
 lib/Config/MVP/Assembler/WithBundles.pm
 lib/Config/MVP/Reader.pm
 lib/Config/MVP/Reader/Findable.pm
+lib/Config/MVP/Reader/Findable/ByExtension.pm
 lib/Config/MVP/Reader/Finder.pm
 lib/Config/MVP/Reader/Hash.pm
 lib/Config/MVP/Section.pm

Modified: branches/upstream/libconfig-mvp-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/META.json?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/META.json (original)
+++ branches/upstream/libconfig-mvp-perl/current/META.json Wed May 26 10:52:21 2010
@@ -4,7 +4,7 @@
       "Ricardo Signes <rjbs at cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 3.101410",
+   "generated_by" : "Dist::Zilla version 3.101450",
    "license" : "perl_5",
    "meta-spec" : {
       "url" : "http://github.com/dagolden/cpan-meta/",
@@ -40,7 +40,7 @@
          "url" : "git://git.codesimply.com/Config-MVP.git"
       }
    },
-   "version" : "0.101410",
+   "version" : "1.101451",
    "x_Dist_Zilla" : {
       "plugins" : [
          {
@@ -52,112 +52,112 @@
                }
             },
             "name" : "Prereq",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::GatherDir",
             "name" : "@RJBS/@Basic/GatherDir",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::PruneCruft",
             "name" : "@RJBS/@Basic/PruneCruft",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::ManifestSkip",
             "name" : "@RJBS/@Basic/ManifestSkip",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "@RJBS/@Basic/MetaYAML",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "@RJBS/@Basic/License",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "@RJBS/@Basic/Readme",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExtraTests",
             "name" : "@RJBS/@Basic/ExtraTests",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "@RJBS/@Basic/ExecDir",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::ShareDir",
             "name" : "@RJBS/@Basic/ShareDir",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::MakeMaker",
             "name" : "@RJBS/@Basic/MakeMaker",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "@RJBS/@Basic/Manifest",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "@RJBS/@Basic/TestRelease",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "@RJBS/@Basic/ConfirmRelease",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "@RJBS/@Basic/UploadToCPAN",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::AutoPrereq",
             "name" : "@RJBS/AutoPrereq",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::AutoVersion",
             "name" : "@RJBS/AutoVersion",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::PkgVersion",
             "name" : "@RJBS/PkgVersion",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "@RJBS/MetaConfig",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "@RJBS/MetaJSON",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::NextRelease",
             "name" : "@RJBS/NextRelease",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "@RJBS/PodSyntaxTests",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::Repository",
@@ -192,22 +192,22 @@
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "3.101410"
+            "version" : "3.101450"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "3.101410"
+            "version" : "3.101450"
          }
       ],
       "zilla" : {
@@ -215,7 +215,7 @@
          "config" : {
             "is_trial" : 0
          },
-         "version" : "3.101410"
+         "version" : "3.101450"
       }
    }
 }

Modified: branches/upstream/libconfig-mvp-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/META.yml?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/META.yml (original)
+++ branches/upstream/libconfig-mvp-perl/current/META.yml Wed May 26 10:52:21 2010
@@ -2,10 +2,12 @@
 abstract: 'multivalue-property package-oriented configuration'
 author:
   - 'Ricardo Signes <rjbs at cpan.org>'
+build_requires:
+  Test::More: 0
 configure_requires:
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 3.101410, CPAN::Meta::Converter version 2.101390'
+generated_by: 'Dist::Zilla version 3.101450, CPAN::Meta::Converter version 2.101450'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,8 +24,8 @@
   Tie::IxHash: 0
 resources:
   repository: git://git.codesimply.com/Config-MVP.git
-version: 0.101410
-xDistZilla:
+version: 1.101451
+x_Dist_Zilla:
   plugins:
     -
       class: Dist::Zilla::Plugin::Prereq
@@ -32,91 +34,91 @@
           phase: runtime
           type: requires
       name: Prereq
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::GatherDir
       name: '@RJBS/@Basic/GatherDir'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::PruneCruft
       name: '@RJBS/@Basic/PruneCruft'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::ManifestSkip
       name: '@RJBS/@Basic/ManifestSkip'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: '@RJBS/@Basic/MetaYAML'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::License
       name: '@RJBS/@Basic/License'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::Readme
       name: '@RJBS/@Basic/Readme'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::ExtraTests
       name: '@RJBS/@Basic/ExtraTests'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: '@RJBS/@Basic/ExecDir'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::ShareDir
       name: '@RJBS/@Basic/ShareDir'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::MakeMaker
       name: '@RJBS/@Basic/MakeMaker'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::Manifest
       name: '@RJBS/@Basic/Manifest'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: '@RJBS/@Basic/TestRelease'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: '@RJBS/@Basic/ConfirmRelease'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: '@RJBS/@Basic/UploadToCPAN'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::AutoPrereq
       name: '@RJBS/AutoPrereq'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::AutoVersion
       name: '@RJBS/AutoVersion'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::PkgVersion
       name: '@RJBS/PkgVersion'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: '@RJBS/MetaConfig'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: '@RJBS/MetaJSON'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::NextRelease
       name: '@RJBS/NextRelease'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: '@RJBS/PodSyntaxTests'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::Repository
       name: '@RJBS/Repository'
@@ -144,21 +146,21 @@
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: 3.101410
+      version: 3.101450
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: 3.101410
+      version: 3.101450
   zilla:
     class: Dist::Zilla
     config:
       is_trial: 0
-    version: 3.101410
+    version: 3.101450

Modified: branches/upstream/libconfig-mvp-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/Makefile.PL?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/Makefile.PL (original)
+++ branches/upstream/libconfig-mvp-perl/current/Makefile.PL Wed May 26 10:52:21 2010
@@ -11,7 +11,9 @@
 my %WriteMakefileArgs = (
   'ABSTRACT' => 'multivalue-property package-oriented configuration',
   'AUTHOR' => 'Ricardo Signes <rjbs at cpan.org>',
-  'BUILD_REQUIRES' => {},
+  'BUILD_REQUIRES' => {
+    'Test::More' => '0'
+  },
   'CONFIGURE_REQUIRES' => {
     'ExtUtils::MakeMaker' => '6.31'
   },
@@ -29,7 +31,7 @@
     'Test::More' => '0.88',
     'Tie::IxHash' => '0'
   },
-  'VERSION' => '0.101410',
+  'VERSION' => '1.101451',
   'test' => {
     'TESTS' => 't/*.t'
   }

Modified: branches/upstream/libconfig-mvp-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/README?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/README (original)
+++ branches/upstream/libconfig-mvp-perl/current/README Wed May 26 10:52:21 2010
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution Config-MVP,
-version 0.101410:
+version 1.101451:
 
   multivalue-property package-oriented configuration
 

Modified: branches/upstream/libconfig-mvp-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/dist.ini?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/dist.ini (original)
+++ branches/upstream/libconfig-mvp-perl/current/dist.ini Wed May 26 10:52:21 2010
@@ -10,3 +10,4 @@
 Test::More = 0.88
 
 [@RJBS]
+version = 1

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP;
 BEGIN {
-  $Config::MVP::VERSION = '0.101410';
+  $Config::MVP::VERSION = '1.101451';
 }
 # ABSTRACT: multivalue-property package-oriented configuration
 use strict;
@@ -18,7 +18,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Assembler;
 BEGIN {
-  $Config::MVP::Assembler::VERSION = '0.101410';
+  $Config::MVP::Assembler::VERSION = '1.101451';
 }
 use Moose;
 # ABSTRACT: multivalue-property config-loading state machine
@@ -123,7 +123,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler/WithBundles.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler/WithBundles.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler/WithBundles.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Assembler/WithBundles.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Assembler::WithBundles;
 BEGIN {
-  $Config::MVP::Assembler::WithBundles::VERSION = '0.101410';
+  $Config::MVP::Assembler::WithBundles::VERSION = '1.101451';
 }
 use Moose::Role;
 # ABSTRACT: a role to make assemblers expand bundles
@@ -79,6 +79,7 @@
       }
 
       $self->sequence->add_section($section);
+      $section->finalize;
     }
   }
 }
@@ -95,7 +96,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Reader;
 BEGIN {
-  $Config::MVP::Reader::VERSION = '0.101410';
+  $Config::MVP::Reader::VERSION = '1.101451';
 }
 use Moose::Role;
 # ABSTRACT: role to load MVP-style config from a file
@@ -8,18 +8,19 @@
 use Config::MVP::Assembler;
 
 
-has assembler => (
-  is   => 'ro',
-  isa  => 'Config::MVP::Assembler',
-  lazy => 1,
-  builder => 'build_assembler',
-);
-
-
 sub build_assembler { Config::MVP::Assembler->new; }
 
 
-requires 'read_config';
+sub read_config {
+  my ($self, $location, $arg) = @_;
+  $arg ||= {};
+
+  my $assembler = $arg->{assembler} || $self->build_assembler;
+
+  $self->read_into_assembler($location, $assembler);
+}
+
+requires 'read_into_assembler';
 
 no Moose::Role;
 1;
@@ -33,7 +34,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 
@@ -42,35 +43,19 @@
 It delegates assembly of the configuration sequence to an Assembler.  The
 Reader is responsible for opening, reading, and interpreting a file.
 
-=head1 ATTRIBUTES
-
-=head2 assembler
-
-The L<assembler> attribute must be a Config::MVP::Assembler, has a sensible
-default that will handle the standard needs of a config loader.  Namely, it
-will be pre-loaded with a starting section for root configuration.  That
-starting section will alias C<author> to C<authors> and will set that up as a
-multivalue argument.
-
 =head1 METHODS
 
 =head2 build_assembler
 
-This is the builder for the C<assembler> attribute and must return a
-Config::MVP::Assembler object.  It's here so subclasses can produce assemblers
-of other classes or with pre-loaded sections.
+If no Assembler is provided to C<read_config>'s C<assembler> parameter, this
+method will be called on the Reader to construct one.
+
+It must return a Config::MVP::Assembler object, and by default will return an
+entirely generic one.
 
 =head2 read_config
 
-  my $sequence = $reader->read_config(\%arg);
-
-This method, B<which must be implemented by classes including this role>, is
-passed a hashref of arguments and returns a Config::MVP::Sequence.
-
-Likely arguments include:
-
-  root     - the name of the directory in which to look
-  filename - the filename in that directory to read
+  my $sequence = $reader->read_config($location, \%arg);
 
 =head1 AUTHOR
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable.pm Wed May 26 10:52:21 2010
@@ -1,44 +1,12 @@
 package Config::MVP::Reader::Findable;
 BEGIN {
-  $Config::MVP::Reader::Findable::VERSION = '0.101410';
+  $Config::MVP::Reader::Findable::VERSION = '1.101451';
 }
 use Moose::Role;
 # ABSTRACT: a config class that Config::MVP::Reader::Finder can find
 
 
-use File::Spec;
-
-
-requires 'default_extension';
-
-
-sub can_be_found {
-  my ($self, $arg) = @_;
-
-  my $config_file = $self->filename_from_args($arg);
-  return -r "$config_file" and -f _;
-}
-
-
-sub filename_from_args {
-  my ($self, $arg) = @_;
-
-  # XXX: maybe we should detect conflicting cases -- rjbs, 2009-08-18
-  my $filename;
-  if ($arg->{filename}) {
-    $filename = $arg->{filename}
-  } else {
-    my $basename = $arg->{basename};
-    confess "no filename or basename supplied"
-      unless defined $arg->{basename} and length $arg->{basename};
-
-    my $extension = $self->default_extension;
-    $filename = $basename;
-    $filename .= ".$extension" if defined $extension;
-  }
-
-  return File::Spec->catfile("$arg->{root}", $filename);
-}
+requires 'refined_location';
 
 no Moose::Role;
 1;
@@ -53,37 +21,23 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 
 Config::MVP::Reader::Findable is a role meant to be composed alongside
-Config::MVP::Reader.  It indicates to L<Config::MVP::Reader::Finder> that the
-composing config reader can look in a directory and decide whether there's a
-relevant file in the configuration root.
+Config::MVP::Reader.
 
 =head1 METHODS
 
-=head2 default_extension
+=head2 refined_location
 
-This method, B<which must be composed by classes including this role>, returns
-the default extension used by files in the format this reader can read.
-
-When the Finder tries to find configuration, it have a directory root and a
-basename.  Each (Findable) reader that it tries in turn will look for a file
-F<basename.extension> in the root directory.  If exactly one file is found,
-that file is read.
-
-=head2 can_be_found
-
-This method gets the same arguments as C<read_config> and returns true if this
-config reader will be able to handle the request.
-
-=head2 filename_from_args
-
-This method gets the same arguments as C<read_config> and will return the fully
-qualified filename of the file it would want to read for configuration.  This
-file is not guaranteed to exist or be readable.
+This method is used to decide whether a Findable reader can read a specific
+thing under the C<$location> argument passed to C<read_config>.  The location
+could be a directory or base file name or dbh or almost anything else.  This
+method will return false if it can't find anything to read.  If it can find
+something to read, it will return a new (or unchanged) value for C<$location>
+to be used in reading the config.
 
 =head1 AUTHOR
 

Added: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/ByExtension.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/ByExtension.pm?rev=58442&op=file
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/ByExtension.pm (added)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Findable/ByExtension.pm Wed May 26 10:52:21 2010
@@ -1,0 +1,70 @@
+package Config::MVP::Reader::Findable::ByExtension;
+BEGIN {
+  $Config::MVP::Reader::Findable::ByExtension::VERSION = '1.101451';
+}
+use Moose::Role;
+# ABSTRACT: a Findable Reader that looks for files by extension
+
+with qw(Config::MVP::Reader Config::MVP::Reader::Findable);
+
+use File::Spec;
+
+
+requires 'default_extension';
+
+
+sub refined_location {
+  my ($self, $location) = @_;
+
+  my $candidate_name = "$location." . $self->default_extension;
+  return unless -r $candidate_name and -f _;
+  return $candidate_name;
+}
+
+no Moose::Role;
+1;
+
+__END__
+=pod
+
+=head1 NAME
+
+Config::MVP::Reader::Findable::ByExtension - a Findable Reader that looks for files by extension
+
+=head1 VERSION
+
+version 1.101451
+
+=head1 METHODS
+
+=head2 default_extension
+
+This method, B<which must be composed by classes including this role>, returns
+the default extension used by files in the format this reader can read.
+
+When the Finder tries to find configuration, it have a directory root and a
+basename.  Each (Findable) reader that it tries in turn will look for a file
+F<basename.extension> in the root directory.  If exactly one file is found,
+that file is read.
+
+=head2 refined_location
+
+This role provides a default implementation of the
+L<C<refined_location>|Config::MVP::Reader::Findable/refined_location> method
+required by Config::MVP::Reader.  It will return a filename based on the
+original location, if a file exists matching that location plus the reader's
+C<default_extension>.
+
+=head1 AUTHOR
+
+  Ricardo Signes <rjbs at cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2010 by Ricardo Signes.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
+

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Finder.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Finder.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Finder.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Finder.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Reader::Finder;
 BEGIN {
-  $Config::MVP::Reader::Finder::VERSION = '0.101410';
+  $Config::MVP::Reader::Finder::VERSION = '1.101451';
 }
 use Moose;
 with qw(Config::MVP::Reader);
@@ -27,28 +27,50 @@
   },
 );
 
-sub _which_plugin {
-  my ($self, $arg) = @_;
+sub _which_reader {
+  my ($self, $location) = @_;
 
-  my @plugins = grep { $_->can_be_found($arg) }
-                grep { $_->does('Config::MVP::Reader::Findable') }
-                grep { $_->isa('Moose::Object') } # no roles!
-                $self->_module_pluggable_object->plugins;
+  my @options;
 
-  my @orig = $self->_module_pluggable_object->plugins;
+  for my $pkg ($self->_module_pluggable_object->plugins) {
+    next unless $pkg->isa('Moose::Object');
+    next unless $pkg->does('Config::MVP::Reader::Findable');
 
-  confess "no viable configuration could be found" unless @plugins;
-  confess "multiple possible config plugins found: @plugins" if @plugins > 1;
+    my $location = $pkg->refined_location($location);
 
-  return $plugins[0];
+    next unless defined $location;
+
+    push @options, [ $pkg, $location ];
+  }
+
+  confess "no viable configuration could be found" unless @options;
+
+  # XXX: Improve this error message -- rjbs, 2010-05-24
+  confess "multiple possible config plugins found" if @options > 1;
+
+  return {
+    'package'  => $options[0][0],
+    'location' => $options[0][1],
+  };
 }
 
 sub read_config {
-  my ($self, $arg) = @_;
+  my ($self, $location, $arg) = @_;
+  $self = $self->new unless blessed($self);
+  $arg ||= {};
 
-  my $plugin = $self->_which_plugin($arg);
+  local $arg->{assembler} = $arg->{assembler} || $self->build_assembler;
 
-  return $plugin->new({ assembler => $self->assembler })->read_config($arg);
+  my $which  = $self->_which_reader($location);
+  my $reader = $which->{package}->new;
+
+  return $reader->read_config( $which->{location}, $arg );
+}
+
+sub build_assembler { }
+
+sub read_into_assembler {
+  die "This method should never be called or reachable";
 }
 
 no Moose;
@@ -64,7 +86,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Hash.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Hash.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Hash.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Reader/Hash.pm Wed May 26 10:52:21 2010
@@ -1,18 +1,16 @@
 package Config::MVP::Reader::Hash;
 BEGIN {
-  $Config::MVP::Reader::Hash::VERSION = '0.101410';
+  $Config::MVP::Reader::Hash::VERSION = '1.101451';
 }
 use Moose;
 with qw(Config::MVP::Reader);
 # ABSTRACT: a reader that tries to cope with a plain old hashref
 
 
-sub read_config {
-  my ($self, $arg) = @_;
+sub read_into_assembler {
+  my ($self, $location, $assembler) = @_;
 
-  confess "no hash given to $self" unless my $hash = $arg->{hash};
-
-  my $assembler = $self->assembler;
+  confess "no hash given to $self" unless my $hash = $location;
 
   for my $name (keys %$hash) {
     my $payload = { %{ $hash->{ $name } } };
@@ -45,11 +43,11 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 SYNOPSIS
 
-  my $sequence = Config::MVP::Reader::Hash->new->read_config({ hash => \%h });
+  my $sequence = Config::MVP::Reader::Hash->new->read_config( \%config );
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Section.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Section.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Section.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Section.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Section;
 BEGIN {
-  $Config::MVP::Section::VERSION = '0.101410';
+  $Config::MVP::Section::VERSION = '1.101451';
 }
 use Moose;
 # ABSTRACT: one section of an MVP configuration sequence
@@ -165,7 +165,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Sequence.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Sequence.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Sequence.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/lib/Config/MVP/Sequence.pm Wed May 26 10:52:21 2010
@@ -1,6 +1,6 @@
 package Config::MVP::Sequence;
 BEGIN {
-  $Config::MVP::Sequence::VERSION = '0.101410';
+  $Config::MVP::Sequence::VERSION = '1.101451';
 }
 use Moose;
 # ABSTRACT: an ordered set of named configuration sections
@@ -129,7 +129,7 @@
 
 =head1 VERSION
 
-version 0.101410
+version 1.101451
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libconfig-mvp-perl/current/t/hash.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/t/hash.t?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/t/hash.t (original)
+++ branches/upstream/libconfig-mvp-perl/current/t/hash.t Wed May 26 10:52:21 2010
@@ -22,24 +22,22 @@
 
 {
   my $config = CMRFB->new->read_config({
-    hash => {
-      'Foo::Bar' => {
-        x => 1,
-        y => [ 2, 4 ],
-        z => 3,
-      },
-      'bz' => {
-        __package => 'Foo::Baz',
-        single => 1,
-        multi  => [ 2, 3 ],
-      },
-      'Foo::Metaboondle' => { },
-      'Foo::Quux' => {
-        a => 1,
-        b => 2,
-        c => 3,
-      }
+    'Foo::Bar' => {
+      x => 1,
+      y => [ 2, 4 ],
+      z => 3,
     },
+    'bz' => {
+      __package => 'Foo::Baz',
+      single => 1,
+      multi  => [ 2, 3 ],
+    },
+    'Foo::Metaboondle' => { },
+    'Foo::Quux' => {
+      a => 1,
+      b => 2,
+      c => 3,
+    }
   });
 
   my @sections = $config->sections;
@@ -73,9 +71,7 @@
 
 {
   my $config = CMRFB->new->read_config({
-    hash => {
-      'Foo::BoondleHref' => { },
-    },
+    'Foo::BoondleHref' => { },
   });
 
   my @sections = $config->sections;
@@ -89,9 +85,7 @@
 
 {
   my $config = CMRFB->new->read_config({
-    hash => {
-      'Foo::BoondleHref' => { },
-    },
+    'Foo::BoondleHref' => { },
   });
 
   my @sections = $config->sections;

Modified: branches/upstream/libconfig-mvp-perl/current/t/lib/Config/MVP/Reader/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/t/lib/Config/MVP/Reader/Test.pm?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/t/lib/Config/MVP/Reader/Test.pm (original)
+++ branches/upstream/libconfig-mvp-perl/current/t/lib/Config/MVP/Reader/Test.pm Wed May 26 10:52:21 2010
@@ -1,13 +1,13 @@
 package Config::MVP::Reader::Test;
 use Moose;
-with qw(Config::MVP::Reader Config::MVP::Reader::Findable);
+with qw(Config::MVP::Reader Config::MVP::Reader::Findable::ByExtension);
 
 sub default_extension { 'mvp-test' }
 
-sub read_config {
-  my ($self, $arg) = @_;
+sub read_into_assembler {
+  my ($self, $location, $assembler) = @_;
 
-  my $filename = $self->filename_from_args($arg);
+  my $filename = $location;
 
   open my $fh, '<', $filename or die "can't read $filename: $!";
 
@@ -16,19 +16,19 @@
     next if $line =~ m{\A\s*(;.+)?\z}; # skip blanks, comments
 
     if ($line =~ m{\A(\S+)\s*=\s*(\S+)\z}) {
-      $self->assembler->add_value($1, $2);
+      $assembler->add_value($1, $2);
       next LINE;
     }
 
     if ($line =~ m{\A\[(\S+)(?:\s+(\S+?))?\]\z}) {
-      $self->assembler->change_section($1, $2);
+      $assembler->change_section($1, $2);
       next LINE;
     }
 
     die "don't know how to handle this line: $line\n";
   }
 
-  return $self->assembler->sequence;
+  return $assembler->sequence;
 }
 
 1;

Modified: branches/upstream/libconfig-mvp-perl/current/t/reader.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-mvp-perl/current/t/reader.t?rev=58442&op=diff
==============================================================================
--- branches/upstream/libconfig-mvp-perl/current/t/reader.t (original)
+++ branches/upstream/libconfig-mvp-perl/current/t/reader.t Wed May 26 10:52:21 2010
@@ -20,10 +20,7 @@
   sub build_assembler { CMRFBA->new; }
 }
 
-my $config = CMRFB->new->read_config({
-  root     => 't/eg',
-  basename => 'config',
-});
+my $config = CMRFB->read_config('t/eg/config');
 
 my @sections = $config->sections;
 




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