[libcatmandu-perl] 02/46: Removed variants Catmandu::Importer::Modules

Jonas Smedegaard dr at jones.dk
Tue Oct 14 13:52:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.9205
in repository libcatmandu-perl.

commit 480639301ed3777f0d9f5560feee31718414553a
Author: Jakob Voss <voss at gbv.de>
Date:   Mon Jun 23 13:59:24 2014 +0200

    Removed variants Catmandu::Importer::Modules
    
    The importers only differ in the 'namespace' option that can also be
    specified directly instead of bloating the Catmandu core code base.
    
    Further simplification is possible by merging duplicated code in parts of
    Catmandu::Cmd::{importers,exporters,fixes,stores,modules}.
---
 lib/Catmandu/Cmd/exporters.pm      | 13 ++++++----
 lib/Catmandu/Cmd/fixes.pm          | 13 ++++++----
 lib/Catmandu/Cmd/importers.pm      | 13 ++++++----
 lib/Catmandu/Cmd/modules.pm        |  5 ++--
 lib/Catmandu/Cmd/stores.pm         | 11 +++++----
 lib/Catmandu/Importer/Exporters.pm | 49 --------------------------------------
 lib/Catmandu/Importer/Fixes.pm     | 42 --------------------------------
 lib/Catmandu/Importer/Importers.pm | 43 ---------------------------------
 lib/Catmandu/Importer/Stores.pm    | 42 --------------------------------
 9 files changed, 34 insertions(+), 197 deletions(-)

diff --git a/lib/Catmandu/Cmd/exporters.pm b/lib/Catmandu/Cmd/exporters.pm
index 131eda3..8787f7c 100644
--- a/lib/Catmandu/Cmd/exporters.pm
+++ b/lib/Catmandu/Cmd/exporters.pm
@@ -2,7 +2,7 @@ package Catmandu::Cmd::exporters;
 
 use Catmandu::Sane;
 use parent 'Catmandu::Cmd';
-use Catmandu::Importer::Exporters;
+use Catmandu::Importer::Modules;
 
 sub command_opt_spec {
     (
@@ -14,11 +14,13 @@ sub command_opt_spec {
 sub command {
     my ($self, $opts, $args) = @_;
     my $verbose = $opts->verbose;
-    my $from_opts = {};
+    my $from_opts = {
+        namespace => 'Catmandu::Exporter'
+    };
     for my $key (qw(inc)) {
         $from_opts->{$key} = $opts->$key if defined $opts->$key;
     }
-    my $from = Catmandu::Importer::Exporters->new($from_opts);
+    my $from = Catmandu::Importer::Modules->new($from_opts);
 
     my $into_args = [];
     my $into_opts = {};
@@ -55,9 +57,10 @@ sub command {
 
 Catmandu::Cmd::exporters - list installed Catmandu exporters
 
-=head1 SEE ALSO
+=head1 DESCRIPTION
 
-L<Catmandu::Importer::Exporters>
+This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all
+modules in namespace L<Catmandu::Exporter>.
 
 =cut
 
diff --git a/lib/Catmandu/Cmd/fixes.pm b/lib/Catmandu/Cmd/fixes.pm
index 244a622..b5d07da 100644
--- a/lib/Catmandu/Cmd/fixes.pm
+++ b/lib/Catmandu/Cmd/fixes.pm
@@ -2,7 +2,7 @@ package Catmandu::Cmd::fixes;
 
 use Catmandu::Sane;
 use parent 'Catmandu::Cmd';
-use Catmandu::Importer::Fixes;
+use Catmandu::Importer::Modules;
 
 sub command_opt_spec {
     (
@@ -14,11 +14,13 @@ sub command_opt_spec {
 sub command {
     my ($self, $opts, $args) = @_;
     my $verbose = $opts->verbose;
-    my $from_opts = {};
+    my $from_opts = {
+        namespace => 'Catmandu::Fix'
+    };
     for my $key (qw(inc)) {
         $from_opts->{$key} = $opts->$key if defined $opts->$key;
     }
-    my $from = Catmandu::Importer::Fixes->new($from_opts);
+    my $from = Catmandu::Importer::Modules->new($from_opts);
 
     my $into_args = [];
     my $into_opts = {};
@@ -55,9 +57,10 @@ sub command {
 
 Catmandu::Cmd::fixes - list installed Catmandu fixes
 
-=head1 SEE ALSO
+=head1 DESCRIPTION
 
-L<Catmandu::Importer::Fixes>
+This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all
+modules in namespace L<Catmandu::Fix>.
 
 =cut
 
diff --git a/lib/Catmandu/Cmd/importers.pm b/lib/Catmandu/Cmd/importers.pm
index 7a52b5c..3c62bbf 100644
--- a/lib/Catmandu/Cmd/importers.pm
+++ b/lib/Catmandu/Cmd/importers.pm
@@ -2,7 +2,7 @@ package Catmandu::Cmd::importers;
 
 use Catmandu::Sane;
 use parent 'Catmandu::Cmd';
-use Catmandu::Importer::Importers;
+use Catmandu::Importer::Modules;
 
 sub command_opt_spec {
     (
@@ -14,11 +14,13 @@ sub command_opt_spec {
 sub command {
     my ($self, $opts, $args) = @_;
     my $verbose = $opts->verbose;
-    my $from_opts = {};
+    my $from_opts = {
+        namespace => 'Catmandu::Importer'
+    };
     for my $key (qw(inc)) {
         $from_opts->{$key} = $opts->$key if defined $opts->$key;
     }
-    my $from = Catmandu::Importer::Importers->new($from_opts);
+    my $from = Catmandu::Importer::Modules->new($from_opts);
 
     my $into_args = [];
     my $into_opts = {};
@@ -55,9 +57,10 @@ sub command {
 
 Catmandu::Cmd::importers - list installed Catmandu importers
 
-=head1 SEE ALSO
+=head1 DESCRIPTION
 
-L<Catmandu::Importer::Importers>
+This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all
+modules in namespace L<Catmandu::Importer>.
 
 =cut
 
diff --git a/lib/Catmandu/Cmd/modules.pm b/lib/Catmandu/Cmd/modules.pm
index 2ec2294..e6752c1 100644
--- a/lib/Catmandu/Cmd/modules.pm
+++ b/lib/Catmandu/Cmd/modules.pm
@@ -57,9 +57,10 @@ sub command {
 
 Catmandu::Cmd::modules - list installed perl modules in a given namespace
 
-=head1 SEE ALSO
+=head1 DESCRIPTION
 
-L<Catmandu::Importer::Modules>
+This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all
+modules in a given namespace.
 
 =cut
 
diff --git a/lib/Catmandu/Cmd/stores.pm b/lib/Catmandu/Cmd/stores.pm
index 028b73d..4f075d8 100644
--- a/lib/Catmandu/Cmd/stores.pm
+++ b/lib/Catmandu/Cmd/stores.pm
@@ -2,7 +2,7 @@ package Catmandu::Cmd::stores;
 
 use Catmandu::Sane;
 use parent 'Catmandu::Cmd';
-use Catmandu::Importer::Stores;
+use Catmandu::Importer::Modules;
 
 sub command_opt_spec {
     (
@@ -14,11 +14,13 @@ sub command_opt_spec {
 sub command {
     my ($self, $opts, $args) = @_;
     my $verbose = $opts->verbose;
-    my $from_opts = {};
+    my $from_opts = {
+        namespace => 'Catmandu::Store'
+    };
     for my $key (qw(inc)) {
         $from_opts->{$key} = $opts->$key if defined $opts->$key;
     }
-    my $from = Catmandu::Importer::Stores->new($from_opts);
+    my $from = Catmandu::Importer::Modules->new($from_opts);
 
     my $into_args = [];
     my $into_opts = {};
@@ -57,7 +59,8 @@ Catmandu::Cmd::stores - list installed Catmandu stores
 
 =head1 SEE ALSO
 
-L<Catmandu::Importer::Stores>
+This L<Catmandu::Cmd> uses L<Catmandu::Importer::Modules> to list all
+modules in namespace L<Catmandu::Store>.
 
 =cut
 
diff --git a/lib/Catmandu/Importer/Exporters.pm b/lib/Catmandu/Importer/Exporters.pm
deleted file mode 100644
index e2794c4..0000000
--- a/lib/Catmandu/Importer/Exporters.pm
+++ /dev/null
@@ -1,49 +0,0 @@
-package Catmandu::Importer::Exporters;
-
-use Catmandu::Sane;
-use Moo;
-use Catmandu::Importer::Modules;
-
-has inc => (
-    is      => 'ro',
-    default => sub { [@INC] },
-);
-
-has _module_info => (
-    is      => 'ro',
-    lazy    => 1,
-    builder => '_build_module_info',
-    handles => 'Catmandu::Importer',
-);
-
-sub _build_module_info {
-    my ($self) = @_;
-    Catmandu::Importer::Modules->new(
-        namespace => 'Catmandu::Exporter',
-        inc       => $self->inc,
-        max_depth => 1,
-    );
-}
-
-=head1 NAME
-
-Catmandu::Importer::Exporters - list installed Catmandu exporters
-
-=head1 OPTIONS
-
-=over
-
-=item inc
-
-list of library paths (defaults to @INC)
-
-=back
-
-=head1 SEE ALSO
-
-L<Catmandu::Importer::Modules>
-
-=cut
-
-1;
-
diff --git a/lib/Catmandu/Importer/Fixes.pm b/lib/Catmandu/Importer/Fixes.pm
deleted file mode 100644
index 0dd9413..0000000
--- a/lib/Catmandu/Importer/Fixes.pm
+++ /dev/null
@@ -1,42 +0,0 @@
-package Catmandu::Importer::Fixes;
-
-use Catmandu::Sane;
-use Moo;
-use Catmandu::Importer::Modules;
-
-has inc => (
-    is      => 'ro',
-    default => sub { [@INC] },
-);
-
-has _module_info => (
-    is      => 'ro',
-    lazy    => 1,
-    builder => '_build_module_info',
-    handles => 'Catmandu::Importer',
-);
-
-sub _build_module_info {
-    my ($self) = @_;
-    Catmandu::Importer::Modules->new(
-        namespace => 'Catmandu::Fix',
-        inc       => $self->inc,
-        pattern   => qr/:[a-z][^:]*$/,
-    );
-}
-
-=head1 NAME
-
-Catmandu::Importer::Fixes - list installed Catmandu fixes
-
-=head1 OPTIONS
-
-    inc: list of library paths (defaults to @INC)
-
-=head1 SEE ALSO
-
-L<Catmandu::Importer::Modules>
-
-=cut
-
-1;
diff --git a/lib/Catmandu/Importer/Importers.pm b/lib/Catmandu/Importer/Importers.pm
deleted file mode 100644
index 35254f3..0000000
--- a/lib/Catmandu/Importer/Importers.pm
+++ /dev/null
@@ -1,43 +0,0 @@
-package Catmandu::Importer::Importers;
-
-use Catmandu::Sane;
-use Moo;
-use Catmandu::Importer::Modules;
-
-has inc => (
-    is      => 'ro',
-    default => sub { [@INC] },
-);
-
-has _module_info => (
-    is      => 'ro',
-    lazy    => 1,
-    builder => '_build_module_info',
-    handles => 'Catmandu::Importer',
-);
-
-sub _build_module_info {
-    my ($self) = @_;
-    Catmandu::Importer::Modules->new(
-        namespace => 'Catmandu::Importer',
-        inc       => $self->inc,
-        max_depth => 1,
-    );
-}
-
-=head1 NAME
-
-Catmandu::Importer::Importers - list installed Catmandu importers
-
-=head1 OPTIONS
-
-    inc: list of library paths (defaults to @INC)
-
-=head1 SEE ALSO
-
-L<Catmandu::Importer::Modules>
-
-=cut
-
-1;
-
diff --git a/lib/Catmandu/Importer/Stores.pm b/lib/Catmandu/Importer/Stores.pm
deleted file mode 100644
index 306b2c5..0000000
--- a/lib/Catmandu/Importer/Stores.pm
+++ /dev/null
@@ -1,42 +0,0 @@
-package Catmandu::Importer::Stores;
-
-use Catmandu::Sane;
-use Moo;
-use Catmandu::Importer::Modules;
-
-has inc => (
-    is      => 'ro',
-    default => sub { [@INC] },
-);
-
-has _module_info => (
-    is      => 'ro',
-    lazy    => 1,
-    builder => '_build_module_info',
-    handles => 'Catmandu::Importer',
-);
-
-sub _build_module_info {
-    my ($self) = @_;
-    Catmandu::Importer::Modules->new(
-        namespace => 'Catmandu::Store',
-        inc       => $self->inc,
-        max_depth => 1,
-    );
-}
-
-=head1 NAME
-
-Catmandu::Importer::Stores - list installed Catmandu stores
-
-=head1 OPTIONS
-
-    inc: list of library paths (defaults to @INC)
-
-=head1 SEE ALSO
-
-L<Catmandu::Importer::Modules>
-
-=cut
-
-1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git



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