our $AUTOLOAD;
-=head2 new
-
-=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 C<$self->{_creation_args}>. You can also override the new method in
-your subclass. It's just provided here for completeness.
-
-=cut
-
-sub new {
- my ($class,@args) = @_;
-
- # We shouldn't be called $me->new, but just in case
- $class = ref($class) || $class;
-
- my $self = {};
- bless $self, $class;
-
- $self->_init(@args);
-
- return $self;
-}
-
-
-=head2 _init
-
-=head3 Usage
-
- $self->_init(@args);
-
-=head3 Function
-
-Stores the arguments used at new so modules that are loaded later can
-read them
-
-=cut
-
-sub _init {
- my ($self,@creation_args) = @_;
-
- $self->{creation_args} = [@_];
-}
-
-
=head2 load
=head3 Usage
}
}
-=head2 _addmethods
-
-=head3 Usage
-
- $self->_addmethods($subclass,&{"${subclass}::_methods"}($self,$options));
-
-=head3 Function
-
-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.
-
-=cut
-
-sub _addmethods($@) {
- my ($self,$subclass,@methods) = @_;
-
- # stick the method into the table
- # DLA: Make with the munchies!
-
- foreach my $method (@methods) {
- if (not $method =~ /^$subclass/) {
- $method = $subclass.'::'.$method;
- }
- my ($method_name) = $method =~ /\:*([^\:]+)\s*$/;
- if (exists $self->{_methodhash}->{$method_name}) {
- if ($self->{_methodhash}->{$method_name}->{overridden}) {
- carp "Not overriding already overriden method $method_name\n" if $DEBUG;
- next;
- }
- carp "Overriding $method_name $self->{_methodhash}->{$method_name}->{reference} with $method\n";
- }
- $self->{_methodhash}->{$method_name}->{reference} = $method;
- $self->{_methodhash}->{$method_name}->{subclass} = $subclass;
- }
-
-}
-
=head2 override
=head3 Usage
return undef;
}
+=head1 INTERNAL FUNCTIONS
+
+The functions below are functions internal to Class::Modular. The
+first two, new and _init should probably be overriden in any class
+that inherits from Class::Modular, but they are provided just in case
+you don't want to write a new and/or _init.
+
+=cut
+
+=head2 new
+
+=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 C<$self->{_creation_args}>. You can also override the new method in
+your subclass. It's just provided here for completeness.
+
+=cut
+
+sub new {
+ my ($class,@args) = @_;
+
+ # We shouldn't be called $me->new, but just in case
+ $class = ref($class) || $class;
+
+ my $self = {};
+ bless $self, $class;
+
+ $self->_init(@args);
+
+ return $self;
+}
+
+
+=head2 _init
+
+=head3 Usage
+
+ $self->_init(@args);
+
+=head3 Function
+
+Stores the arguments used at new so modules that are loaded later can
+read them
+
+This function is called by default from new. Classes may only wish to
+override _init.
+
+=cut
+
+sub _init {
+ my ($self,@creation_args) = @_;
+
+ $self->{creation_args} = [@_];
+}
+
=head2 DESTROY
=cut
+=head2 _addmethods
+
+=head3 Usage
+
+ $self->_addmethods($subclass,&{"${subclass}::_methods"}($self,$options));
+
+=head3 Function
+
+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.
+
+=cut
+
+sub _addmethods($@) {
+ my ($self,$subclass,@methods) = @_;
+
+ # stick the method into the table
+ # DLA: Make with the munchies!
+
+ foreach my $method (@methods) {
+ if (not $method =~ /^$subclass/) {
+ $method = $subclass.'::'.$method;
+ }
+ my ($method_name) = $method =~ /\:*([^\:]+)\s*$/;
+ if (exists $self->{_methodhash}->{$method_name}) {
+ if ($self->{_methodhash}->{$method_name}->{overridden}) {
+ carp "Not overriding already overriden method $method_name\n" if $DEBUG;
+ next;
+ }
+ carp "Overriding $method_name $self->{_methodhash}->{$method_name}->{reference} with $method\n";
+ }
+ $self->{_methodhash}->{$method_name}->{reference} = $method;
+ $self->{_methodhash}->{$method_name}->{subclass} = $subclass;
+ }
+
+}
+
+
+
sub DESTROY{
my $self = shift;
foreach my $subclass (keys %{$self->{_subclasses}}) {