]> git.donarmstrong.com Git - class_modular.git/.git/commitdiff
* Documentation changes
authorDon Armstrong <don@donarmstrong.com>
Mon, 16 Feb 2004 07:26:46 +0000 (07:26 +0000)
committerDon Armstrong <don@donarmstrong.com>
Mon, 16 Feb 2004 07:26:46 +0000 (07:26 +0000)
 * Updated the copyright statement to reflect that Class::Modular is
   now separate

git-svn-id: file:///srv/don_svn/class_modular/trunk@14 96c6a18b-02ce-0310-9fca-9eb62c757ba6

lib/Class/Modular.pm

index 1b4a88113e3989007476c4f5f03d52fb14cfb833..5611de9cee97451824d2742def4383303d10e655 100644 (file)
@@ -1,7 +1,7 @@
-# This module is part of DA, Don Armstrong's Modules, and is released
-# under the terms of the GPL version 2, or any later version. See the
-# file README and COPYING for more information. Copyright 2003 by Don
-# Armstrong <don@donarmstrong.com>.
+# This file is part of Class::Modular and is released under the terms
+# of the GPL version 2, or any later version at your option. See the
+# file README and COPYING for more information.
+# Copyright 2003, 2004 by Don Armstrong <don@donarmstrong.com>.
 # $Id$
 
 package Class::Modular;
 # $Id$
 
 package Class::Modular;
@@ -16,7 +16,6 @@ Class::Modular -- Modular class generation superclass
 
      use base qw(Class::Modular);
 
 
      use base qw(Class::Modular);
 
-
 =head1 DESCRIPTION
 
 Class::Modular is a superclass for generating modular classes, where
 =head1 DESCRIPTION
 
 Class::Modular is a superclass for generating modular classes, where
@@ -28,6 +27,10 @@ functions. Less generic functions can be included or overridden
 without modifying the base classes. This allows for code to be more
 modular, and reduces code duplication.
 
 without modifying the base classes. This allows for code to be more
 modular, and reduces code duplication.
 
+It fills the middle ground between traditional class based OOP and
+classless OOP. L<Class::Mutator> and L<Sex> are similar to
+Class::Modular but less manic.
+
 =head1 FUNCTIONS
 
 =cut
 =head1 FUNCTIONS
 
 =cut
@@ -49,15 +52,17 @@ our $AUTOLOAD;
 
 =head2 new
 
 
 =head2 new
 
- Title   : new
- Usage   : $obj = Foo::Bar->new();
- Function: Creates a new Foo::Bar object
- Returns : A new Foo::Bar object
- Args    : none.
+=head3 Usage
+
+     $obj = Foo::Bar->new();
+
+=head3 Function
+
+Creates a new C<Foo::Bar> object.
 
 
- Aditional arguments can be passed to this creator, and they are
- stored in $self->{_creation_args}. You can also override the new
- method in your subclass. It's just provided here for completeness.
+Aditional arguments can be passed to this creator, and they are stored
+in C<$self->{_creation_args}>. You can also override the new method in
+your subclass. It's just provided here for completeness.
 
 =cut
 
 
 =cut
 
@@ -98,22 +103,22 @@ sub _init {
 
 =head2 load
 
 
 =head2 load
 
- Title   : load
- Usage   : $db->load('FOO::Subclass');
- Function: loads a Class::Modular subclass
- Returns : nothing
- Args    : SCALAR subclass SCALAR options
+=head3 Usage
+
+     $db->load('FOO::Subclass');
 
 
- Loads the named subclass into this object if the named subclass has
- not been loaded.
+=head3 Function
+
+Loads the named subclass into this object if the named subclass has
+not been loaded.
 
 
- The options scalar is passed to $subclass::_methods when determining
- which methods should be added using _addmethods.
+The options scalar is passed to $subclass::_methods when determining
+which methods should be added using _addmethods.
 
 
- The subclasses _init method is called right after methods are loaded.
+The subclasses _init method is called right after methods are loaded.
 
 
- If debugging is enabled, will warn about loading already loaded
- subclasses.
+If debugging is enabled, will warn about loading already loaded
+subclasses.
 
 =cut
 
 
 =cut
 
@@ -129,6 +134,7 @@ sub load($$;$) {
          eval {
               no strict 'refs';
               eval "require $subclass" or die $@;
          eval {
               no strict 'refs';
               eval "require $subclass" or die $@;
+              # Use subclass::METHODS if it exists [use constants METHODS => qw(foo)]
               $self->_addmethods($subclass,&{"${subclass}::_methods"}($self,$options));
               &{"${subclass}::_init"}($self);
          };
               $self->_addmethods($subclass,&{"${subclass}::_methods"}($self,$options));
               &{"${subclass}::_init"}($self);
          };
@@ -142,17 +148,17 @@ sub load($$;$) {
 
 =head2 _addmethods
 
 
 =head2 _addmethods
 
- Title   : _addmethods
- Usage   : $self->_addmethods()
- Function: Adds the passed methods into the function table
- Returns : 
- Args    : ARRAY of methods
+=head3 Usage
+
+     $self->_addmethods($subclass,&{"${subclass}::_methods"}($self,$options));
+
+=head3 Function
 
 
- Given an array of methods, adds the methods into the _methodhash
- calling table.
+Given an array of methods, adds the methods into the _methodhash
+calling table.
 
 
- Methods that have previously been overridden by override are _NOT_
- overridden again. This may need to be adjusted in load.
+Methods that have previously been overridden by override are _NOT_
+overridden again. This may need to be adjusted in load.
 
 =cut
 
 
 =cut
 
@@ -182,22 +188,21 @@ sub _addmethods($@) {
 
 =head2 override
 
 
 =head2 override
 
- Title   : override
- Usage   : $obj->override('methodname', $code_ref)
- Function: Overrides the method methodname and calls $code_ref instead.
- Returns : TRUE on success, FALSE on failure.
- Args    : SCALAR method name
-           CODEREF function reference
+=head3 Usage
+
+     $obj->override('methodname', $code_ref)
+
+=head3 Function
 
 
- Allows you to override utility functions that are called internally
- to provide a different default function.
+Allows you to override utility functions that are called internally to
+provide a different default function.
 
 
- It's superficially similar to _addmethods, which is called by load,
- but it deals with code references, and requires the method name to be
- known.
+It's superficially similar to _addmethods, which is called by load,
+but it deals with code references, and requires the method name to be
+known.
 
 
- Methods overridden here are _NOT_ overrideable in _addmethods. This
- may need to be changed.
+Methods overridden here are _NOT_ overrideable in _addmethods. This
+may need to be changed.
 
 =cut
 
 
 =cut
 
@@ -210,19 +215,19 @@ sub override {
 
 =head2 clone
 
 
 =head2 clone
 
- Title   : clone
- Usage   : my $clone  = $obj->clone
- Function: Produces a clone of the Class::Modular object
- Returns : 
- Args    : 
+=head3 Usage
+
+     my $clone  = $obj->clone
 
 
- Produces a clone of the object with duplicates of all data and/or new
- connections as appropriate.
+=head3 Function
+
+Produces a clone of the object with duplicates of all data and/or new
+connections as appropriate.
 
 
- Calls _clone on all loaded subclasses.
+Calls _clone on all loaded subclasses.
 
 
- Warns if debugging is on for classes which don't have a _clone
- method.  Dies on other errors.
+Warns if debugging is on for classes which don't have a _clone method.
+Dies on other errors.
 
 =cut
 
 
 =cut
 
@@ -364,11 +369,7 @@ sub DESTROY{
 
 =head2 AUTOLOAD
 
 
 =head2 AUTOLOAD
 
- Title   : AUTOLOAD
- Usage   : Called by perl
- Function: Calls child methods which have been installed into this handle
- Returns : N/A
- Args    : N/A
+=head3 Function
 
 The AUTOLOAD function is responsible for calling child methods which
 have been installed into the current Class::Modular handle.
 
 The AUTOLOAD function is responsible for calling child methods which
 have been installed into the current Class::Modular handle.