Implement can() for attribute delegation
Florian Ragwitz [Mon, 4 Oct 2010 23:00:20 +0000 (23:00 +0000)]
lib/Catalyst/Authentication/Store/LDAP/User.pm
t/pod-coverage.t

index 42e4417..82a24da 100644 (file)
@@ -314,6 +314,15 @@ sub DESTROY {
     delete $_ldap_connection_passwords{refaddr($self)};
 }
 
+sub can {
+    my ($self, $method) = @_;
+
+    return $self->SUPER::can($method) || do {
+        return unless $self->has_attribute($method);
+        return sub { $_[0]->has_attribute($method) };
+    };
+}
+
 sub AUTOLOAD {
     my $self = shift;
 
index 703f91d..44f5d76 100644 (file)
@@ -3,4 +3,4 @@
 use Test::More;
 eval "use Test::Pod::Coverage 1.04";
 plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
-all_pod_coverage_ok();
+all_pod_coverage_ok({ also_private => ['can'] });