On Thu, Apr 30, 2009 at 02:47:21PM +0300, Peter Pentchev wrote:
> Hi,
>
> Thanks for writing and maintaining the Array::Diff module!
>
[snip description of the missing copyright issue]
>
> Also, what do you think about the following patch that fleshes out
> the module's documentation a bit? :) I think some of the information
> there could help others in using this module, although it is quite
> simple and easy to use :)
>
> Once again, thanks for your work on Array::Diff!
And, of course, the moment I sent the e-mail I spotted two problems
with the patch - missing "C" before two variable names :)
Here's the new version of the patch.
G'luck,
Peter
Index: lib/Array/Diff.pm
===================================================================
--- lib/Array/Diff.pm (revision 34386)
+++ lib/Array/Diff.pm (working copy)
@@ -12,7 +12,7 @@
=head1 NAME
-Array::Diff - Diff two arrays
+Array::Diff - Find the differences between two arrays
=head1 SYNOPSIS
@@ -27,18 +27,18 @@
=head1 DESCRIPTION
-This module do diff two arrays, and return added and deleted arrays.
-It's simple usage of Algorithm::Diff.
+This module compares two arrays and returns the added or deleted elements
+in two separate arrays. It's a simple wrapper around L<Algorithm::Diff>.
And if you need more complex array tools, check L<Array::Compare>.
-=head1 SEE ALSO
+=head1 METHODS
-L<Algorithm::Diff>
+=over 4
-=head1 METHODS
+=item new ()
-=head2 new
+Create a new C<Array::Diff> object.
=cut
@@ -50,8 +50,18 @@
$self;
}
-=head2 diff
+=item diff ( OLD, NEW )
+Compute the differences between two arrays. The results are stored
+in the C<added>, C<deleted>, and C<count> properties that may be
+examined using the corresponding methods.
+
+This method may be invoked as an object method, in which case it will
+recalculate the differences and repopulate the C<count>, C<added>, and
+C<removed> properties, or as a static method, in which case it will
+return a newly-created C<Array::Diff> object with the properies
+set appropriately.
+
=cut
sub diff {
@@ -78,6 +88,31 @@
$self;
}
+=item added ( [VALUES ] )
+
+Get or set the elements present in the C<NEW> array and absent in
+the C<OLD> one at the comparison performed by the last C<diff()>
+invocation.
+
+=item deleted ( [VALUES] )
+
+Get or set the elements present in the C<OLD> array and absent in
+the C<NEW> one at the comparison performed by the last C<diff()>
+invocation.
+
+=item count ( [VALUE] )
+
+Get or set the total number of added or deleted elements at
+the comparison performed by the last C<diff()> invocation.
+This count should be equal to the sum of the number of elements in
+the C<added> and C<deleted> properties.
+
+=back
+
+=head1 SEE ALSO
+
+L<Algorithm::Diff>
+
=head1 AUTHOR
Daisuke Murase <typester@cpan.org>
--
Peter Pentchev roam@ringlet.net roam@space.bg roam@FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
You have, of course, just begun reading the sentence that you have just finished reading.
Attachment:
pgpSJrK6cUtaU.pgp
Description: PGP signature