r53469 - in /trunk/dh-make-perl/lib: DhMakePerl.pm DhMakePerl/Command/locate.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Mon Mar 1 20:25:26 UTC 2010


Author: dmn
Date: Mon Mar  1 20:25:15 2010
New Revision: 53469

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53469
Log:
spin-off locate implementation it its own module

Added:
    trunk/dh-make-perl/lib/DhMakePerl/Command/locate.pm
Modified:
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=53469&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Mon Mar  1 20:25:15 2010
@@ -180,7 +180,8 @@
     die "CPANPLUS support disabled, sorry" if $self->cfg->cpanplus;
 
     if (   $self->cfg->command eq 'refresh-cache'
-        or $self->cfg->command eq 'dump-config' )
+        or $self->cfg->command eq 'dump-config'
+        or $self->cfg->command eq 'locate' )
     {
         my $cmd_mod = $self->cfg->command;
         $cmd_mod =~ s/-/_/g;
@@ -266,39 +267,6 @@
 
         print "--- Done\n" if $self->cfg->verbose;
         return 0;
-    }
-
-    if ( $self->cfg->command eq 'locate' ) {
-        @ARGV == 1
-            or die
-                 "--locate command requires exactly one non-option argument\n";
-
-        my $apt_contents = $self->get_apt_contents;
-
-        unless ($apt_contents) {
-            die <<EOF;
-Unable to locate module packages, because APT Contents files
-are not available on the system.
-
-Install the 'apt-file' package, run 'apt-file update' as root
-and retry.
-EOF
-        }
-        my $mod = $ARGV[0];
-
-        if ( defined( my $core_since = $self->is_core_module($mod) ) ) {
-            print "$mod is in Perl core (package perl)";
-            print $core_since ? " since $core_since\n" : "\n";
-            return 0;
-        }
-
-        if ( my $pkg = $apt_contents->find_perl_module_package($mod) ) {
-            print "$mod is in $pkg package\n";
-            return 0;
-        }
-
-        print "$mod is not found in any Debian package\n";
-        return 1;
     }
 
     $self->load_overrides();

Added: trunk/dh-make-perl/lib/DhMakePerl/Command/locate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/locate.pm?rev=53469&op=file
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/locate.pm (added)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/locate.pm Mon Mar  1 20:25:15 2010
@@ -1,0 +1,90 @@
+package DhMakePerl::Command::locate;
+
+=head1 NAME
+
+DhMakePerl::Command::locate - dh-make-perl locate implementation
+
+=head1 DESCRIPTION
+
+This module implements the I<locate> command of L<dh-make-perl(1)>.
+
+=cut
+
+use strict; use warnings;
+
+use base 'DhMakePerl';
+
+=head1 METHODS
+
+=over
+
+=item execute
+
+Provides I<locate> command implementation.
+
+=cut
+
+sub execute {
+    my $self = shift;
+
+    @ARGV == 1
+        or die "--locate command requires exactly one non-option argument\n";
+
+    my $apt_contents = $self->get_apt_contents;
+
+    unless ($apt_contents) {
+        die <<EOF;
+Unable to locate module packages, because APT Contents files
+are not available on the system.
+
+Install the 'apt-file' package, run 'apt-file update' as root
+and retry.
+EOF
+    }
+    my $mod = $ARGV[0];
+
+    if ( defined( my $core_since = $self->is_core_module($mod) ) ) {
+        print "$mod is in Perl core (package perl)";
+        print $core_since ? " since $core_since\n" : "\n";
+        return 0;
+    }
+
+    if ( my $pkg = $apt_contents->find_perl_module_package($mod) ) {
+        print "$mod is in $pkg package\n";
+        return 0;
+    }
+
+    print "$mod is not found in any Debian package\n";
+    return 1;
+}
+
+=back
+
+=cut
+
+1;
+
+=head1 COPYRIGHT & LICENSE
+
+=over
+
+=item Copyright (C) 2009 Franck Joncourt <franck.mail at dthconnex.com>
+
+=item Copyright (C) 2009, 2010 Damyan Ivanov <dmn at debian.org>
+
+=back
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License version 2 as published by the Free
+Software Foundation.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=cut
+




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