[libdist-zilla-plugin-test-podspelling-perl] 04/13: break add stopwords out into a subroutine

Axel Beckert abe at deuxchevaux.org
Mon May 25 10:03:45 UTC 2015


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

abe pushed a commit to annotated tag 2.004000
in repository libdist-zilla-plugin-test-podspelling-perl.

commit 3f8093013ac7beb56cd875b5ae2183b7c303999a
Author: Caleb Cushing <xenoterracide at gmail.com>
Date:   Thu Feb 14 18:52:30 2013 -0600

    break add stopwords out into a subroutine
    
    Signed-off-by: Caleb Cushing <xenoterracide at gmail.com>
---
 lib/Dist/Zilla/Plugin/Test/PodSpelling.pm | 35 ++++++++++++++++---------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/lib/Dist/Zilla/Plugin/Test/PodSpelling.pm b/lib/Dist/Zilla/Plugin/Test/PodSpelling.pm
index b888457..5d49a56 100644
--- a/lib/Dist/Zilla/Plugin/Test/PodSpelling.pm
+++ b/lib/Dist/Zilla/Plugin/Test/PodSpelling.pm
@@ -51,6 +51,18 @@ has directories => (
 	}
 );
 
+sub add_stopword {
+	my ( $self, $data ) = @_;
+
+	my ( $word ) = $data =~ /(\w{2,})/uxms;
+
+	return unless $word;
+
+	$self->log_debug( 'add stopword: ' . $word );
+
+	$self->push_stopwords( $word );
+}
+
 around add_file => sub {
 	my ($orig, $self, $file) = @_;
 	my ($set_spell_cmd, $add_stopwords, $stopwords);
@@ -59,21 +71,13 @@ around add_file => sub {
 	}
 
 	# automatically add author names to stopwords
-	for (@{ $self->zilla->authors }) {
-		my ( $word ) = $_ =~ /(\w{2,})/uxms;
-		$self->log_debug( 'author name: ' . $word );
-		$self->push_stopwords( $word );
+	foreach my $name (@{ $self->zilla->authors }) {
+		$self->add_stopword( $name );
 	}
 
 	if ( $self->zilla->copyright_holder ) {
-		for ( split( /\s/uxms, $self->zilla->copyright_holder ) ) {
-			my ( $word ) = $_ =~ /(\w{2,})/uxms;
-
-			next unless $word;
-
-			$self->log_debug( 'copyright_holder word: ' . $word );
-
-			$self->push_stopwords( $word );
+		foreach my $holder ( split( /\s/uxms, $self->zilla->copyright_holder ) ) {
+			$self->add_stopword( $holder );
 		}
 	} else {
 		$self->log_debug( 'no copyright_holder found' );
@@ -83,11 +87,8 @@ around add_file => sub {
 		# many of my stopwords are part of a filename
 		$self->log_debug( 'splitting filenames for more words' );
 
-		foreach ( split( '/', $file->name ) ) {
-			my ( $word ) = $_ =~ /(\w+)/xms;
-			$self->log_debug( 'word: ' . $word);
-
-			$self->push_stopwords( $word );
+		foreach my $name ( split( '/', $file->name ) ) {
+			$self->add_stopword( $name );
 		}
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-test-podspelling-perl.git



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