Badger::Class
package Your::Point; use Badger::Class version => 2.718, debug => 0, base => 'Badger::Base', config => 'x! y!', get_methods => 'x y', init_method => 'configure', throws => 'point', messages => { missing => 'No value specified for %s', };
Thus Spake Andy:
And this is what it looks like with a bit of Badger::Class
magic. We've
already seen what version
does. The debug
option is a hook into
Badger::Debug
's default
option, so we get $DEBUG
and DEBUG
defined as
discussed earlier. The base
option declares a base class of Badger::Base
.
config
hooks into the Badger::Class::Config
helper module which generates
a configure()
method which copies the x
and y
parameters into $self
,
throwing an error if they're not defined (the !
suffix). The next two options
are delegated to Badger::Class::Methods
which generates methods. get_methods
generates simple accessors. init_method
generates an init()
method, which
in this case is forwarded onto the configure()
method that we just generated.
throws
and messages
define the $THROWS
and $MESSAGES
package variables
respectively. We've already seen what they do.