Permalink
Browse files

Fixed auto_can bug in Badger::Class::Methods that didn't work with su…

…bclassing
  • Loading branch information...
1 parent 055c66d commit 065b0fa7bf6e3fb22e9e9112bf98d16cd9a582b6 @abw committed Jun 12, 2012
Showing with 8 additions and 5 deletions.
  1. +3 −2 lib/Badger/Class/Methods.pm
  2. +2 −0 lib/Badger/Config.pm
  3. +3 −3 lib/Badger/Hub.pm
@@ -185,8 +185,9 @@ sub auto_can {
my ($name) = ($AUTOLOAD =~ /([^:]+)$/ );
return if $name eq 'DESTROY';
if (my $method = $this->can($name, @args)) {
- $class->debug("installing $name method in $target ($class)") if DEBUG;
- $target->method( $name => $method );
+ my $that = class($this);
+ $class->debug("$class installing $name method in $that") if DEBUG;
+ $that->method( $name => $method );
return $method->($this, @args);
}
View
@@ -111,6 +111,8 @@ sub can_configure {
$self = $self->prototype unless ref $self;
+ $self->debug("can_configure($name)") if DEBUG;
+
return
unless $name && $self->{ item }->{ $name };
View
@@ -120,15 +120,15 @@ sub auto_can {
my $target;
if ($target = $self->component($name)) {
- $self->debug("creating component method for $name") if DEBUG;
+ $self->debug("creating component method in $self for $name") if DEBUG;
return $self->auto_component( $name => $target );
}
elsif ($target = $self->delegate($name)) {
- $self->debug("creating delegate method for $name") if DEBUG;
+ $self->debug("creating delegate method in $self for $name") if DEBUG;
return $self->auto_delegate( $name => $target );
}
elsif (DEBUG) {
- $self->debug("no component or delegate found for $name");
+ $self->debug("no component or delegate found in $self for $name");
}
return undef;

0 comments on commit 065b0fa

Please sign in to comment.