+=head2 can
+
+=head3 Usage
+
+ $obj->can('METHOD');
+ Class::Modular->can('METHOD');
+
+=head3 Function
+
+Replaces UNIVERSAL's can method so that handled methods are reported
+correctly. Calls UNIVERSAL::can in the places where
+
+=head3 Returns
+
+A coderef to the method if the method is supported, undef otherwise.
+
+=head3 Args
+
+Scalar Method Name
+
+=cut
+
+sub can{
+ my ($self,$method,$vars) = @_;
+
+ if (ref $self and exists $self->{_methodhash}->{$method}) {
+ # If the method is defined, return a reference to the
+ # method.
+ return $self->{_methodhash}->{$method}->{reference};
+ }
+ else {
+ # Otherwise, let UNIVERSAL::can deal with the method
+ # appropriately.
+ return UNIVERSAL::can($self,$method);
+ }
+}
+
+=head2 handledby
+
+=head3 Usage
+
+ $obj->handledby('methodname');
+ $obj->handledby('Class::Method::methodname');
+
+=head3 Function
+
+Returns the subclass that handles this method.
+
+=head3 Returns
+
+SCALAR subclass name
+
+=head3 Args
+
+SCALAR method name
+
+=cut
+
+sub handledby{
+ my ($self,$method_name) = @_;
+
+ $method_name =~ s/.*\://;
+
+ if (exists $self->{_methodhash}->{$method_name}) {
+ return $self->{_methodhash}->{$method_name}->{subclass};
+ }
+ return undef;
+}
+
+
+=head2 DESTROY
+
+=head3 Usage
+
+Called by perl.
+
+=head3 Function
+
+Calls all subclass _destroy methods.
+
+Subclasses need only implement a _destroy method if they have
+references that need to be uncircularized, or things that should be
+disconnected or closed.
+
+=cut
+
+sub DESTROY{
+ my $self = shift;
+ foreach my $subclass (keys %{$self->{_subclasses}}) {
+ # use eval to try and call the subclasses _destroy method.
+ # Ignore no such function errors, but trap other types of
+ # errors.
+ eval {
+ no strict 'refs';
+ &$subclass::_destroy($self);
+ };
+ if ($@) {
+ # Die unless we've hit an undefined subroutine.
+ die $@ unless $@ =~ /Undefined\s*subroutine\s*\&.*\:\:\_clone/;
+ warn "$subclass doesn't have a _clone method\n$@" if $DEBUG;
+ }
+ }
+}