Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1. Change name of identify_distros_from_prepared_list() to

identify_distros_from_derived_list().
2.  Write DESCRIPTION and GLOSSARY sections of .pod.
  • Loading branch information...
commit 5448517b4700ea3e4ed72c84481da12a0b6ababd 1 parent b72c506
@jkeenan authored
View
8 lib/CPAN/Mini/Visit/Simple.pm
@@ -41,13 +41,13 @@ sub new {
return $self;
}
-sub identify_distros_from_prepared_list {
+sub identify_distros_from_derived_list {
my ($self, $args) = @_;
- croak "Bad argument 'start_dir' provided to identify_distros_from_prepared_list()"
+ croak "Bad argument 'start_dir' provided to identify_distros_from_derived_list()"
if exists $args->{start_dir};
- croak "Bad argument 'pattern' provided to identify_distros_from_prepared_list()"
+ croak "Bad argument 'pattern' provided to identify_distros_from_derived_list()"
if exists $args->{pattern};
- croak "identify_distros_from_prepared_list() needs 'list' element"
+ croak "identify_distros_from_derived_list() needs 'list' element"
unless exists $args->{list};
croak "Value of 'list' must be array reference"
unless reftype($args->{list}) eq 'ARRAY';
View
71 lib/CPAN/Mini/Visit/Simple.pod
@@ -5,13 +5,55 @@ CPAN::Mini::Visit::Simple - Lightweight traversal of a minicpan repository
=head1 SYNOPSIS
use CPAN::Mini::Visit::Simple;
- $self = CPAN::Mini::Visit::Simple->new({});
+ $self = CPAN::Mini::Visit::Simple->new();
$self->identify_distros();
=head1 DESCRIPTION
This Perl extension is a variant on David Golden's App-CPAN-Mini-Visit. It
-can be used in the following circumstances:
+can be used to:
+
+=over 4
+
+=item *
+
+Calculate a subset of the set of distributions in a minicpan repository.
+
+=item *
+
+Refresh such a subset when new versions of the distributions which are its
+elements have appeared in the minicpan repository.
+
+=item *
+
+Perform an action on each element of the subset.
+
+=back
+
+=head1 GLOSSARY
+
+=over 4
+
+=item * Primary List
+
+A set of distributions calculated by this module's methods.
+
+=item * Derived List
+
+A humanly edited version of a primary list; prepared via deletions from -- but
+not additions to -- a primary list.
+
+=item * Refreshed List
+
+A prepared list whose elements have been updated to reflect the arrival of
+updated versions of those distributions in the minicpan repository.
+
+=item * Visit
+
+An operation performed on each element of any of the three types of list
+above.
+
+=back
=head1 SUBROUTINES
@@ -27,16 +69,20 @@ directories are present.
=item * Arguments
+ $self = CPAN::Mini::Visit::Simple->new();
+
+or
+
$self = CPAN::Mini::Visit::Simple->new({
- minicpan => $phony_minicpan, # optional
+ minicpan => /path/to/a/minicpan,
});
-Optional single hash reference. That hash should have a C<minicpan> element
-whose value is the absolute path to your minicpan repository.
-
If called with no arguments, the constructor will use the value of the
C<local> key-value pair in your F<.minicpanrc> file.
+May also be called with a single hash reference whose C<minicpan> element's
+value is the absolute path to a minicpan repository.
+
=item * Return Value
CPAN::Mini::Visit::Simple object.
@@ -49,8 +95,9 @@ CPAN::Mini::Visit::Simple object.
=item * Purpose
-Prepare the list of distributions in the minicpan repository which will be
-visited.
+By traversing a minicpan repository and examining the names of distributions,
+prepare a list of distributions needing a visit. We will call this list,
+which is produced without human editing, a B<primary list>.
=item * Arguments
@@ -62,14 +109,12 @@ May be called in any of the following two mutually exclusive ways:
$self->identify_distros();
-Will add all distributions found in the minicpan repository to the list of
-distributions to be visited.
+This will add all distributions found in the minicpan repository to the primary
+list.
=item 2 Single hash reference
-You may provide a hash reference with B<one> of several elements. These
-elements are mutually exclusive and are listed in descending order of
-priority.
+You may provide a hash reference with one or more of several elements.
=over 4
View
20 t/002_identify_distros.t
@@ -18,7 +18,7 @@ $self = CPAN::Mini::Visit::Simple->new({});
isa_ok ($self, 'CPAN::Mini::Visit::Simple');
eval {
- $self->identify_distros_from_prepared_list({
+ $self->identify_distros_from_derived_list({
list => {},
});
};
@@ -26,7 +26,7 @@ like($@, qr/Value of 'list' must be array reference/,
"Got expected error message for bad 'list' value -- must be array ref" );
eval {
- $self->identify_distros_from_prepared_list({
+ $self->identify_distros_from_derived_list({
list => [],
});
};
@@ -41,24 +41,24 @@ like($@, qr/Value of 'list' must be non-empty/,
/home/user/minicpan/authors/id/A/AA/AARDVARK/Epsilon-Zeta-0.03-tar.gz
);
eval {
- $self->identify_distros_from_prepared_list({
+ $self->identify_distros_from_derived_list({
list => \@list,
start_dir => '/foo/bar',
});
};
like($@,
- qr/Bad argument 'start_dir' provided to identify_distros_from_prepared_list()/,
- "Got expected error message when calling identify_distros_from_prepared_list() with 'start_dir'" );
+ qr/Bad argument 'start_dir' provided to identify_distros_from_derived_list()/,
+ "Got expected error message when calling identify_distros_from_derived_list() with 'start_dir'" );
eval {
- $self->identify_distros_from_prepared_list({
+ $self->identify_distros_from_derived_list({
list => \@list,
pattern => qr/foo\/bar/,
});
};
like($@,
- qr/Bad argument 'pattern' provided to identify_distros_from_prepared_list()/,
- "Got expected error message when calling identify_distros_from_prepared_list() with 'pattern'" );
+ qr/Bad argument 'pattern' provided to identify_distros_from_derived_list()/,
+ "Got expected error message when calling identify_distros_from_derived_list() with 'pattern'" );
}
{
@@ -86,8 +86,8 @@ like($@, qr/Value of 'list' must be non-empty/,
/home/user/minicpan/authors/id/A/AA/AARDVARK/Gamma-Delta-0.02-tar.gz
/home/user/minicpan/authors/id/A/AA/AARDVARK/Epsilon-Zeta-0.03-tar.gz
);
- ok( $self->identify_distros_from_prepared_list({ list => \@list, }),
- "identify_distros_from_prepared_list() returned true value" );
+ ok( $self->identify_distros_from_derived_list({ list => \@list, }),
+ "identify_distros_from_derived_list() returned true value" );
my ($stdout, $stderr);
capture(
View
2  t/005_get_list.t
@@ -16,7 +16,7 @@ isa_ok ($self, 'CPAN::Mini::Visit::Simple');
/home/user/minicpan/authors/id/A/AA/AARDVARK/Gamma-Delta-0.02-tar.gz
/home/user/minicpan/authors/id/A/AA/AARDVARK/Epsilon-Zeta-0.03-tar.gz
);
-$self->identify_distros_from_prepared_list( { list => \@input_list } );
+$self->identify_distros_from_derived_list( { list => \@input_list } );
@output_list = $self->get_list();
is_deeply(
View
6 t/006_refresh_list.t
@@ -68,9 +68,9 @@ my ( @source_list, $output_list_ref, $refreshed_list_ref );
TODO: {
local $TODO = "Code not written";
- eval { $self->identify_distros_from_prepared_list( { list => $refreshed_list_ref } ) };
+ eval { $self->identify_distros_from_derived_list( { list => $refreshed_list_ref } ) };
is($@, q{}, "No error code found");
-# ok( $self->identify_distros_from_prepared_list( { list => $refreshed_list_ref } ),
-# "identify_distros_from_prepared_list() returned true value" );
+# ok( $self->identify_distros_from_derived_list( { list => $refreshed_list_ref } ),
+# "identify_distros_from_derived_list() returned true value" );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.