Boucherot::ModuleManager - A set of instance of Boucherot's Modules
use Boucherot::ModuleManager; my $mm=new Boucherot::ModuleManager;
# ...
# Foo::Bar is "ModuleManager" compatible. my $module=new Foo::Bar;
$mm->add($module);
printf "The module unique ID is %s\n",$module->mid;
my $mid=$module->mid;
$module2=$mm->get($mid);
# Here $module2 eq $module
This class is a module manager.
All instances of modules that are registred to the ModuleManager must be used only by storing the module id, and not by storing a reference on the module.
That mean, by removing the module from the module manager, the instance is destroyed.
The ModuleManager don't know the classes. It only know they can ``mid'' (as method)
class Boucherot::ModuleManager
Attributs:
-$ instance : Boucherot::ModuleManager
- modules : { mid => { module : } : Hash, ... } : Hash - next_mid : SCALAR
Methods:
+$ new () : Boucherot::ModuleManager
Read
+ get ( mid : SCALAR ) : UNIVERSAL + list () : { mid1 => class1 : SCALAR , ... }
Write
+ add ( module : UNIVERSAL ) : SCALAR + remove ( mid : SCALAR ) :
+$ new () : Boucherot::ModuleManager
Constructor. It takes no arguments, and return a module manager
+ get ( mid : SCALAR ) : UNIVERSAL
Get an object from it's ``mid''.
+ list () : { mid1 => class1 : SCALAR , ... }
List all the mid.
+ add ( module : UNIVERSAL ) : SCALAR
Add a new object to the manager.
+ remove ( mid : SCALAR ) :
Remove an existing object from the manager.
This class was written by Arthibus Gissehel <gissehel@vachefolle.com> in 2001.
This class is part of the Boucherot project.