r4912 - in /packages/libset-object-perl/trunk: Changes.pod MANIFEST META.yml Makefile.PL Object.xs README debian/changelog lib/Set/Object.pm lib/Set/Object/ t/ingy/arrayref.t t/misc/ t/object/weakref.t t/scalar/compare.t

gwolf at users.alioth.debian.org gwolf at users.alioth.debian.org
Thu Mar 1 00:29:31 CET 2007


Author: gwolf
Date: Thu Mar  1 00:29:30 2007
New Revision: 4912

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4912
Log:
New upstream version

Added:
    packages/libset-object-perl/trunk/lib/Set/Object/
      - copied from r4911, packages/libset-object-perl/branches/upstream/current/lib/Set/Object/
    packages/libset-object-perl/trunk/t/misc/
      - copied from r4911, packages/libset-object-perl/branches/upstream/current/t/misc/
    packages/libset-object-perl/trunk/t/object/weakref.t
      - copied unchanged from r4911, packages/libset-object-perl/branches/upstream/current/t/object/weakref.t
Modified:
    packages/libset-object-perl/trunk/Changes.pod
    packages/libset-object-perl/trunk/MANIFEST
    packages/libset-object-perl/trunk/META.yml
    packages/libset-object-perl/trunk/Makefile.PL
    packages/libset-object-perl/trunk/Object.xs
    packages/libset-object-perl/trunk/README
    packages/libset-object-perl/trunk/debian/changelog
    packages/libset-object-perl/trunk/lib/Set/Object.pm
    packages/libset-object-perl/trunk/t/ingy/arrayref.t
    packages/libset-object-perl/trunk/t/scalar/compare.t

Modified: packages/libset-object-perl/trunk/Changes.pod
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/Changes.pod?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/Changes.pod (original)
+++ packages/libset-object-perl/trunk/Changes.pod Thu Mar  1 00:29:30 2007
@@ -1,5 +1,57 @@
 
 =head1 REVISION HISTORY FOR Set::Object
+
+=head1 1.21, 17 Feb 2007
+
+=over
+
+=item *
+
+Fix false negative when Test::Pod::Coverage isn't installed.  Reported
+by Anna Bernathova of SuSE.
+
+=back
+
+=head1 1.20, 16 Feb 2007
+
+=over
+
+=item *
+
+The C<-E<gt>compare> function was returning "disjoint" for empty sets.
+RT#24965.  (Nigel Metheringham)
+
+=item *
+
+Document lots of methods that were previously not documented.
+
+=item *
+
+Fix C<Set::Object::Weak::set()>.  It was not passing its arguments to
+C<Set::Object::Weak-E<gt>new()>, which was very broken.
+
+=back
+
+=head1 1.19, 23 Jan 2007
+
+=over
+
+=item *
+
+remove bogus inclusions of Data::Dumper and Devel::Peek
+
+=item *
+
+New class C<Set::Object::Weak>, which all weak sets should get
+re-blessed into when you call C<-E<gt>weaken>.  Also added alternative
+methods of constructing weak sets.
+
+=item *
+
+Fix a memory leak with scalar members (the internal hash used to store
+the items was never being freed).  RT#24508.
+
+=back
 
 =head1 1.18, 14 Sep 2006
 

Modified: packages/libset-object-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/MANIFEST?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/MANIFEST (original)
+++ packages/libset-object-perl/trunk/MANIFEST Thu Mar  1 00:29:30 2007
@@ -4,6 +4,7 @@
 README
 META.yml                                Module meta-data (added by MakeMaker)
 lib/Set/Object.pm
+lib/Set/Object/Weak.pm
 Object.xs
 t/object/equal.t
 t/object/clear.t
@@ -23,6 +24,7 @@
 t/object/abuse.t
 t/object/properties.t
 t/object/storable.t
+t/object/weakref.t
 
 t/scalar/basic_overload.t
 t/scalar/basic.t
@@ -44,4 +46,8 @@
 
 t/ingy/arrayref.t
 
+t/misc/leaks.t
+t/misc/pod.t
+t/misc/pod_coverage.t
+
 ppport.h

Modified: packages/libset-object-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/META.yml?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/META.yml (original)
+++ packages/libset-object-perl/trunk/META.yml Thu Mar  1 00:29:30 2007
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Set-Object
-version:      1.18
+version:      1.21
 version_from: lib/Set/Object.pm
 installdirs:  site
 requires:

Modified: packages/libset-object-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/Makefile.PL?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/Makefile.PL (original)
+++ packages/libset-object-perl/trunk/Makefile.PL Thu Mar  1 00:29:30 2007
@@ -8,6 +8,8 @@
     'LIBS'	=> [''],   # e.g., '-lm' 
     'DEFINE'	=> '',     # e.g., '-DHAVE_SOMETHING' 
     'INC'	=> '',     # e.g., '-I/usr/include/other' 
-    PM => {'lib/Set/Object.pm' => '$(INST_LIBDIR)/Object.pm'},
-    test => { TESTS => join(' ', glob('t/object/*.t'), glob('t/scalar/*.t')) },
+    PM => {'lib/Set/Object.pm' => '$(INST_LIBDIR)/Object.pm',
+	   'lib/Set/Object/Weak.pm' => '$(INST_LIBDIR)/Object/Weak.pm',
+	  },
+    test => { TESTS => join(' ', glob('t/*/*.t')) },
 );

Modified: packages/libset-object-perl/trunk/Object.xs
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/Object.xs?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/Object.xs (original)
+++ packages/libset-object-perl/trunk/Object.xs Thu Mar  1 00:29:30 2007
@@ -818,6 +818,7 @@
       iset_clear(s);
       if (s->flat) {
 	hv_undef(s->flat);
+	SvREFCNT_dec(s->flat);
       }
       Safefree(s);
       
@@ -833,7 +834,7 @@
    OUTPUT: RETVAL
 
 void
-weaken(self)
+_weaken(self)
    SV* self
 
    CODE:
@@ -849,7 +850,7 @@
       _fiddle_strength(s, 0);
 
 void
-strengthen(self)
+_strengthen(self)
    SV* self
 
    CODE:
@@ -931,6 +932,20 @@
   magic = newRV_inc(mg->mg_obj);
   PUSHs(magic);
   XSRETURN(1);
+
+SV*
+get_flat(sv)
+     SV* sv
+PROTOTYPE: $
+CODE:
+  ISET* s = INT2PTR(ISET*, SvIV(SvRV(sv)));
+  if (s->flat) {
+    RETVAL = newRV_inc(s->flat);
+  } else {
+    XSRETURN_UNDEF;
+  }
+OUTPUT:
+  RETVAL
 
 char *
 blessed(sv)

Modified: packages/libset-object-perl/trunk/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/README?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/README (original)
+++ packages/libset-object-perl/trunk/README Thu Mar  1 00:29:30 2007
@@ -1,4 +1,4 @@
-README for Set::Object 1.18
+README for Set::Object 1.21
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Set::Object provides for sets of Perl objects - scalars and references.
 

Modified: packages/libset-object-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/debian/changelog?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/debian/changelog (original)
+++ packages/libset-object-perl/trunk/debian/changelog Thu Mar  1 00:29:30 2007
@@ -1,3 +1,9 @@
+libset-object-perl (1.21-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Gunnar Wolf <gwolf at debian.org>  Wed, 28 Feb 2007 17:22:35 -0600
+
 libset-object-perl (1.18-2) unstable; urgency=medium
 
   * Use $(CURDIR) [make] instead of $(PWD) [sh] to fix sudo issues.

Modified: packages/libset-object-perl/trunk/lib/Set/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/lib/Set/Object.pm?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/lib/Set/Object.pm (original)
+++ packages/libset-object-perl/trunk/lib/Set/Object.pm Thu Mar  1 00:29:30 2007
@@ -67,11 +67,21 @@
 into strings, so will lose any magic (eg, tie) or other special bits
 that they went in with; only strings come out.
 
-=head1 CLASS METHODS
-
-=head2 new( [I<list>] )
+=head1 CONSTRUCTORS
+
+=head2 Set::Object->new( [I<list>] )
 
 Return a new C<Set::Object> containing the elements passed in I<list>.
+
+=head2 C<set(@members)>
+
+Return a new C<Set::Object> filled with C<@members>.  You have to
+explicitly import this method.
+
+=head2 C<weak_set()>
+
+Return a new C<Set::Object::Weak>, filled with C<@members>.  You have
+to explicitly import this method.
 
 =head1 INSTANCE METHODS
 
@@ -134,9 +144,26 @@
 C<weaken>, please reduce your problem to a test script before
 submission.
 
+B<New:> as of Set::Object 1.19, you may use the C<weak_set> function
+to make weak sets, or C<Set::Object::Weak-E<gt>new>, or import the
+C<set> constructor from C<Set::Object::Weak> instead.  See
+L<Set::Object::Weak> for more.
+
+B<Note to people sub-classing C<Set::Object>:> this method re-blesses
+the invocant to C<Set::Object::Weak>.  Override the method C<weak_pkg>
+in your sub-class to control this behaviour.
+
+=head2 is_weak
+
+Returns a true value if this set is a weak set.
+
 =head2 strengthen
 
 Turns a weak set back into a normal one.
+
+B<Note to people sub-classing C<Set::Object>:> this method re-blesses
+the invocant to C<Set::Object>.  Override the method C<strong_pkg> in
+your sub-class to control this behaviour.
 
 =head2 invert( [I<list>] )
 
@@ -156,6 +183,20 @@
 Return a textual Smalltalk-ish representation of the C<Set::Object>.
 Also available as overloaded operator "".
 
+=head2 equal( I<set> )
+
+Returns a true value if I<set> contains exactly the same members as
+the invocant.
+
+Also available as overloaded operator C<==> (or C<eq>).
+
+=head2 not_equal( I<set> )
+
+Returns a false value if I<set> contains exactly the same members as
+the invocant.
+
+Also available as overloaded operator C<!=> (or C<ne>).
+
 =head2 intersection( [I<list>] )
 
 Return a new C<Set::Object> containing the intersection of the
@@ -207,6 +248,11 @@
 
 Return C<true> if this C<Set::Object> is a proper superset of I<set>
 Also available as operator C<E<gt>>.
+
+=head2 is_null( I<set> )
+
+Returns a true value if this set does not contain any members, that
+is, if its size is zero.
 
 =head1 Set::Scalar compatibility methods
 
@@ -306,6 +352,34 @@
 change the array :).  This is used only by the test suite, and if you
 find it useful for something then you should probably conjure up a
 test suite and send it to me, otherwise it could get pulled.
+
+=back
+
+=head1 CLASS METHODS
+
+These class methods are probably only interesting to those
+sub-classing C<Set::Object>.
+
+=over
+
+=item strong_pkg
+
+When a set that was already weak is strengthened using
+C<-E<gt>strengthen>, it gets re-blessed into this package.
+
+=item weak_pkg
+
+When a set that was NOT already weak is weakened using
+C<-E<gt>weaken>, it gets re-blessed into this package.
+
+=item tie_array_pkg
+
+When the object is accessed as an array, tie the array into this
+package.
+
+=item tie_hash_pkg
+
+When the object is accessed as a hash, tie the hash into this package.
 
 =back
 
@@ -390,7 +464,8 @@
 
 Portions Copyright (c) 2003 - 2005, Sam Vilain.  Same license.
 
-Portions Copyright (c) 2006, Catalyst IT (NZ) Limited.  Same license.
+Portions Copyright (c) 2006, 2007, Catalyst IT (NZ) Limited.  Same
+license.
 
 =head1 SEE ALSO
 
@@ -414,8 +489,8 @@
 # Do not simply export all your public functions/methods/constants.
 
 @EXPORT_OK = qw( ish_int is_int is_string is_double blessed reftype
-		 refaddr is_overloaded is_object is_key set );
-$VERSION = '1.18';
+		 refaddr is_overloaded is_object is_key set weak_set );
+$VERSION = '1.21';
 
 bootstrap Set::Object $VERSION;
 
@@ -860,7 +935,7 @@
     return ("v3-" . ($obj->is_weak ? "w" : "s"), [ $obj->members ]);
 }
 
-use Devel::Peek qw(Dump);
+#use Devel::Peek qw(Dump);
 
 sub STORABLE_thaw {
     #print Dump $_ foreach (@_);
@@ -935,7 +1010,12 @@
 	    }
 	}
     } else {
-	return "disjoint";
+	if ($self->size || $other->size) {
+	    return "disjoint";
+	} else {
+	    # both sets are empty
+	    return "equal";
+	}
     }
 }
 
@@ -947,7 +1027,7 @@
     return !($self*$other)->size;
 }
 
-use Data::Dumper;
+#use Data::Dumper;
 sub as_string_callback {
     shift;
     if ( @_ ) {
@@ -979,6 +1059,32 @@
 sub set {
     __PACKAGE__->new(@_);
 }
+sub weak_set {
+    my $self = __PACKAGE__->new();
+    $self->weaken;
+    $self->insert(@_);
+    return $self;
+}
+
+require Set::Object::Weak;
+sub weaken {
+    my $self = shift;
+    $self->_weaken;
+    bless $self, $self->weak_pkg;
+}
+
+sub strengthen {
+    my $self = shift;
+    $self->_strengthen;
+    bless $self, $self->strong_pkg;
+}
+
+sub weak_pkg {
+    "Set::Object::Weak";
+}
+sub strong_pkg {
+    "Set::Object";
+}
 1;
 
 __END__

Modified: packages/libset-object-perl/trunk/t/ingy/arrayref.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/t/ingy/arrayref.t?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/t/ingy/arrayref.t (original)
+++ packages/libset-object-perl/trunk/t/ingy/arrayref.t Thu Mar  1 00:29:30 2007
@@ -1,6 +1,6 @@
 #  -*- perl -*-
 
-use Set::Object;
+use Set::Object qw(set);
 use Test::More tests => 15;
 
 my $bob = bless {}, "Bob";

Modified: packages/libset-object-perl/trunk/t/scalar/compare.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libset-object-perl/trunk/t/scalar/compare.t?rev=4912&op=diff
==============================================================================
--- packages/libset-object-perl/trunk/t/scalar/compare.t (original)
+++ packages/libset-object-perl/trunk/t/scalar/compare.t Thu Mar  1 00:29:30 2007
@@ -10,7 +10,7 @@
 my $n = Set::Object->new(qw());
 my $o = Set::Object->new(qw());
 
-print "1..23\n";
+print "1..24\n";
 
 print "not " unless $t == $u;
 print "ok 1\n";
@@ -85,6 +85,10 @@
   print "ok 23\n";
 }
 
+# [cpan #24965]
+print "not " unless $n->compare($o) eq 'equal';
+print "ok 24\n";
+
 sub show {
     my $z = shift;
 




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