Subject: Shlomif's Tenth Law of Perl OOP and Test-Run

Hi all!

Shlomif's Tenth Law of Perl OOP: "Every sufficiently complex Class::Accessor
program contains contains an ad hoc, informally-specified, bug-ridden, slow
implementation of half of Moose."

(see's_Tenth_Rule ).

I used Class::Accessor for Test-Run ( see ), because that's what I was used to
using, and found the easiest solution, but ended up implementing a lot of
extra Object Orientation logic (and not-so-OO logic) in Test-Run-Base and in
other classes, and wonder if I can use Moose (possibly with some extra MooseX
plugins, to replace it. I can possibly write some of my own plugins.

Here goes. The files in question are at: - Test::Run::Base:

# Contains an abstraction above Text::Sprintf::Named, that allows a class to
format strings using Python-like "%(attribute)s" escapes. Useful as a
mini-templating language. I might mostly ditch it completely in favour of
Template Toolkit.

In turn I maintain a set of compiled formatters as an object-based property,
and can format according them.

# Has a silly copy_from() method to copy a list of attributes from another
object using the accessors.

# accum_array():

This is a more simplistic version of the :CUMULATIVE functionality
in Class::Std. It was done to make sure that one can collect all the
members of array refs out of methods defined in each class into one big
array ref, that can later be used.

# $self->_run_sequence(\@params)

Runs the sequence of commands specified using
C<_calc__${calling_sub}__callbacks> while passing @params to
each one. Generates a list of all the callbacks return values.

# package->delegate_methods($field, \@methods)

I think this would be trivial to do using Moose.

# - Test::Run::Base::Struct

These are classes whose constructors (the ->new() subroutines) can only be
passed proper pre-defined fields. It's very hacky and ad-hoc at the moment,
so I'm open for better Moose-based solutions.

# - Test::Run::Base::Plugger
# - Test::Run::Base::PlugHelpers

Two plugin-abstractions. For more information see:

I also have some other OO and other abstractions stuff there spread around the
code, but I think that's the main thing.

I'd appreciate any pointers to how I can implement these things using Moose so
I can convert Test-Run to it.


Shlomi Fish

Shlomi Fish
The Case for File Swapping -

The bad thing about hardware is that it sometimes work and sometimes doesn't.
The good thing about software is that it's consistent: it always does not
work, and it always does not work in exactly the same way.

Programming list archiving by: Enterprise Git Hosting