NAME

Badger::Factory::Class - class module for Badger::Factory sub-classes

SYNOPSIS

This module can be used to create subclasses of Badger::Factory.

package My::Widgets;

use Badger::Factory::Class
    version => 0.01,
    item    => 'widget',
    path    => 'My::Widget Your::Widget',
    widgets => {
        extra => 'Another::Widget::Module',
        super => 'Golly::Gosh',
    };

package main;

# class method
my $widget = My::Widgets->widget( foo => @args );

# object method
my $widgets = My::Widgets->new;
my $widget  = $widgets->widget( foo => @args );

DESCRIPTION

This module is a subclass of Badger::Class specialised for the purpose of creating Badger::Factory subclasses. It is used by the Badger::Codecs module among others.

METHODS

The following methods are provided in addition to those inherited from the Badger::Class base class.

item($name)

The singular name of the item that the factory manages. This is used to set the $ITEM package variable for Badger::Factory to use.

items($name)

The plural name of the item that the factory manages. This is used to set the $ITEMS package variable for Badger::Factory to use.

path($name)

A list of module names that form the search path when loading modules. This will set the relevant package variable depending on the value of $ITEMS (or the regular plural form of $ITEM if $ITEMS is undefined). For example, is $ITEMS is set to widgets then this method will set $WIDGETS_PATH.

AUTHOR

Andy Wardley http://wardley.org/

COPYRIGHT

Copyright (C) 2006-2008 Andy Wardley. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Badger::Factory, Badger::Codecs