Badger::Factory::Class - class module for Badger::Factory sub-classes
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 );
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.
The following methods are provided in addition to those inherited from the Badger::Class base class.
The singular name of the item that the factory manages. This is used to set the $ITEM package variable for Badger::Factory to use.
$ITEM
The plural name of the item that the factory manages. This is used to set the $ITEMS package variable for Badger::Factory to use.
$ITEMS
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.
widgets
$WIDGETS_PATH
Andy Wardley http://wardley.org/
Copyright (C) 2006-2009 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.
Badger::Factory, Badger::Codecs
To install Badger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Badger
CPAN shell
perl -MCPAN -e shell install Badger
For more information on module installation, please visit the detailed CPAN module installation guide.