==============================================================================
Release of version 1.10 of Class::Contract
==============================================================================
NAME
Class::Contract - Design-by-Contract OO in Perl
DESCRIPTION
The Class::Contract module implements strong encapsulation, static
inheritance, and design-by-contract condition checking for
object-oriented Perl. The module provides a declarative syntax for
attribute, method, constructor, and destructor definitions at both
the object and class level. Pre-conditions, post-conditions, and
class invariants are also fully supported.
AUTHOR
Damian Conway (damian@conway.org)
MAINTAINER
Garrett Goebel (ggoebel@cpan.org)
COPYRIGHT
Copyright (c) 2000-2001, C. Garrett Goebel. All Rights Reserved. This
module is free software. It may be used, redistributed and/or modified
under the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
Copyright (c) 1999-2000, Damian Conway. All Rights Reserved. This module
is free software. It may be used, redistributed and/or modified under
the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 1.01-1.10
- Added missing old. It was documented but not implemented
- &self is now only way to access object/class reference. Use
self(self->next) instead of $_[0] = $_[0]->next.
- refactored all condition checking to use generic_check function
- revisted _inheritence and generic_check. Think I've finally got
weakening pre-conditional checks working correctly. There is a good
test covering this in t/method.t
1.04 Wed Jan 31 15:45:42 2001
- Begun the process of writing extensive tests. Finding and
fixing many bugs.
- Calling a class accessor or method with an object reference
will now auto-magically change &self into a class name reference.
This was documented but not implemented. The converse, calling an
object accessor or method with a class reference causes an assertion
- Added keyword 'private'. Methods declared private can only be
invoked by the class or its descendants.
- Added optional exportation of shortcuts: scalar_attrs, array_attrs,
hash_attrs, methods. Allows defining clauses like:
abstract methods qw( foo bar baz );
- Fixed inheritence of pre-condition and implementation sub-clauses.
Sub-clauses weren't always inherited when the derived class
failed to define one.
- Fixed pre-condition checks. Satisfying self or any ancestor
wasn't working correctly when either the ancestor or the
derived class did not define any preconditions.
- &inherits now croaks on circular references in inheritence
- Rewrote _location so we can now use eval within the
contract statement to generate attribs, methods, etc.
- Post conditions and invariants can no longer modify by
reference a method's @_. Now conditional checks receive a
@{[@_]} shallow copy.
- Fixed flyweight objects returned by constructor to avoid a
dangling reference which was preventing garbage collection.
The flyweight object is a blessed reference to $key which is
itself a reference to an undefined lexical scalar. $key is
also used as the hash key to the lexical %Class::Contract::data
which stores a given object's data. Previously constructors
returned $key. Consequently, when an object went out of scope
in your script, %data continued to reference $key. Now, when the
flyweight, which is not internally referenced by Class::Contract,
goes out of scope its destructor clears $data{$key}, and Perl's
garbage collection takes place. For a coherent explanation of
such issues read section 13.13 of the Perl Cookbook, 1st Edition.
- Fixed multiple inheritence to appropriately handle cases where
a descendant might inherit the same base class through 2 or
more intermediary classes. I.e. diamond patterns in inheritence
tree. This affects inheritence of invars, attributes, methods,
constructors, and destructors. Previously, it was possible to have
a base class' initialization code called multiple times by a
descendant's constructor. Once for each ancestor with the common
base class.
- Fixed multiple inheritence with regard to constructor
initialization to be left-most depth-first, instead of
right-most depth-first. Destructors are the symetrical opposite
right-most derived-first.
1.03 Wed Dec 27 14:06:11 2000
- Reformatted source to new maintainer's tastes. 2 space indent
and tabs, removal of barewords, foreach instead of for, etc.
Otherwise no changes to the underlying code.
1.02 Fri Dec 21 10:22:48 2000
- One line change to C to fix improper skipping
pre-conditional checks in some cases (thanks Jeff)
1.01 Fri Dec 9 09:52:02 2000
- Change to generic constructor to work around magical limitations
of overload.pm. Should now play nicer with overload.pm
- Reversed ordering of Changes (this document)
- Updated documentation to reflect probationary new maintainer
C. Garrett Goebel, GGOEBEL,
==============================================================================
AVAILABILITY
Class::Contract has been uploaded to the CPAN
==============================================================================