# 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>.
-# $Id: Modular.pm,v 1.5 2003/10/25 02:15:04 don Exp $
+# $Id: Modular.pm,v 1.6 2003/10/25 03:01:35 don Exp $
package Class::Modular;
use Data::Copy qw(deep_copy); # Used for deep copying objects
BEGIN{
- ($VERSION) = q$Revision: 1.5 $ =~ /\$Revision:\s+([^\s+])/;
+ ($VERSION) = q$Revision: 1.6 $ =~ /\$Revision:\s+([^\s+])/;
$DEBUG = 0 unless defined $DEBUG;
}
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 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