X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lib%2FClass%2FModular.pm;fp=lib%2FClass%2FModular.pm;h=71f86b89f223bbab840dbfc12e3c1700004957e9;hb=a75c073ab0a451223af8ca8b7e34a8936cf42001;hp=95921ce2dfcf89b5e808d08c70fd23830fef07cb;hpb=e4098159566cf249d306e89cc0e6a3953499ea14;p=class_modular.git%2F.git 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