Howdy Gang,
You folks are probably the closest to an organized group of people who
might be interested, so I'm posting the changes I've made to the just
release Class::Meta 0.60 and Class::Meta::Express 0.10. I hacked on
these modules in response to a series of questions and requests that
Jon Swartz sent me around a year and a half ago. Yes, I finally go the
time.
What is Class::Meta? Well, it's a meta-object protocol not unlike
Moose. In fact, there is a hell of a lot of crossover. The other
reason I hacked on these modules last week was to get a bit back in
their mindset in preparation for a hack session with Stevan at YAPC.
Maybe we'll be able to merge some ideas, eh?
Anyway, the changes:
Class::Meta
0.60 2008-05-13T03:42:13
- Required constraints are now enforced by the constructor, as
well as the individual attributes themselves. Frankly, it was a
bug that this isn't the way it worked before, although at the
time I thought it was a feature. This is a backwards
compatibility change, but see the next point. Reported by Jon
Swartz.
- Added support for an optional subroutine reference to be passed
as the final argument to constructors created by Class::Meta.
The object being constructed will be passed to the anonymous
sub
after all of the specified and default values have been set,
but
before required constraints are enforced. This allows
developers
to have a scope within which to work before required attributes
throw an exception. Yes, I did borrow this idea from Ruby.
- Added a link to the Subversion repository.
- Moved the "Justification" section of the documentation nearer
to
the bottom. Suggested by Jon Swartz.
- The "view" parameter (PUBLIC, PRIVATE, PROTECTED, TRUSTED) is
now enforced for methods when the method body is passed via the
"code" parameter. Reported by Jon Swartz.
- Added the `trusted` method to Class::Meta::Class.
- You can now use strings to specify constant values when
declaring class attributes, methods, etc. The strings
correspond
to their equivalent constant names, such as "PUBLIC",
"PRIVATE",
"GET", "SET", "OBJECT", "CLASS", and so on. The corresponding
constant value will, however, be stored in the resulting
Class::Meta object.
- A more useful exception is now thrown when an attribute is
added
with a missing or unknown type.
- Added the `default_type` parameter to `new()`, and the
corresponding attribute to Class::Meta::Class. This value will
be used for the data type of attributes created without a data
type. Borrowed from Class::Meta::Express.
- Many of the parameters to `Class::Meta->new` are now passed on
to suclasses if they are not explicitly specified by those
subclasses. This makes it easier to get the same settings (like
the deafult type) without typing the same things over and over
in subclasses.
- Added a spelling test. This has the benefit of reducing the
number of annoying spelling errors in the documentation.
Class::Meta::Express
0.10 2008-05-13T03:45:58
- Added a link to the Subversion repository.
- Updated the documentation so that all examples use `class`
rather than the deprecated `build`.
- Calling the `meta` function is now optional. If it is not
called, Class::Meta::Express will create a key name from the
last part of the class name. Suggested by Jon Swartz.
- Moved the justification for creating this module towards the
end
of the documentation, so that the important description of how
to use it is more prominently towards the top. Suggested by Jon
Swartz.
- Added brief descriptions of the parameters supported by
Class::Meta for each function.
- Added tests to ensure that the `view` parameter is properly
respected.
- Now requiring Class::Meta 0.60 or later to take advantage of
its
integrated `default_type` parameter.
- The `reexport` parameter now respects many of the other
parameters passed to `meta`, not just `meta_class` and
`default_type`.
- Added a spelling test. This has the benefit of reducing the
number of annoying spelling errors in the documentation.
Thanks!
David