From a75c073ab0a451223af8ca8b7e34a8936cf42001 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 15 Sep 2004 06:23:33 +0000 Subject: [PATCH] * Add more documentation to Class::Modular git-svn-id: file:///srv/don_svn/class_modular/trunk@23 96c6a18b-02ce-0310-9fca-9eb62c757ba6 --- lib/Class/Modular.pm | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/Class/Modular.pm b/lib/Class/Modular.pm index 95921ce..71f86b8 100644 --- a/lib/Class/Modular.pm +++ b/lib/Class/Modular.pm @@ -16,6 +16,25 @@ Class::Modular -- Modular class generation superclass use base qw(Class::Modular); + sub new { + my $class = shift; + my $self = bless {}, ref($class) || $class; + $self->SUPER::_init(@_); + return $self; + } + + [...] + + package Bar; + + sub method_that_bar_provides{ + print qq(Hello World!\n); + } + + sub _methods($$){ + return qw(method_that_bar_provides); + } + [...] use Foo; @@ -36,6 +55,9 @@ 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. +This module attempts to fill the middle ground between +L and true classless OOP, like L. + =head1 FUNCTIONS =cut @@ -48,7 +70,7 @@ use Carp; use Storable qw(dclone); # Used for deep copying objects BEGIN{ - $VERSION = undef || q(SVN Development Version: ).q$Id:$; + $VERSION = undef || q(SVN Development Version: ).q$Id$; ($REVISION) = q$LastChangedRevision$ =~ /\$LastChangedRevision:\s+([^\s+])/; $DEBUG = 0 unless defined $DEBUG; } @@ -104,7 +126,7 @@ Stores the arguments used at new so modules that are loaded later can read them from B You can also override this method, but if you do so, you should call -Class::Modular::_init(@_) if you don't set creation_args. +Class::Modular::_init($self,@_) if you don't set creation_args. =cut @@ -446,8 +468,8 @@ __END__ Because this module works through AUTOLOAD, utilities that use can($object) instead of $object->can() will fail to see routines that -are actually there. Params::Validate, an excellent module, is one of -these offenders. +are actually there. Params::Validate, an excellent module, is +currently one of these offenders. =head1 COPYRIGHT -- 2.39.2