[Catalyst-commits] r7443 - in trunk/Catalyst-Model-LDAP: .
lib/Catalyst/Model/LDAP
dwc at dev.catalyst.perl.org
dwc at dev.catalyst.perl.org
Tue Feb 19 20:39:34 GMT 2008
Author: dwc
Date: 2008-02-19 20:39:34 +0000 (Tue, 19 Feb 2008)
New Revision: 7443
Modified:
trunk/Catalyst-Model-LDAP/Changes
trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm
Log:
Improve behavior of Catalyst::Model::LDAP::Entry for nonexistent attributes (RT #28752) and implement ->can
Modified: trunk/Catalyst-Model-LDAP/Changes
===================================================================
--- trunk/Catalyst-Model-LDAP/Changes 2008-02-17 11:51:40 UTC (rev 7442)
+++ trunk/Catalyst-Model-LDAP/Changes 2008-02-19 20:39:34 UTC (rev 7443)
@@ -12,6 +12,9 @@
- Make Catalyst::Model::LDAP::Connection->bind a little more
flexible
- s/LDAP_TEST_LIVE/TEST_AUTHOR/g in tests
+ - Tweak Catalyst::Model::LDAP::Entry's AUTOLOAD error message
+ to more closely match Perl's error message (RT #28752)
+ - Add Catalyst::Model::LDAP::Entry::can method
0.15 Fri Feb 23 11:37:25 EST 2007
- Throw runtime require errors
Modified: trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm 2008-02-17 11:51:40 UTC (rev 7442)
+++ trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm 2008-02-19 20:39:34 UTC (rev 7443)
@@ -109,13 +109,26 @@
return $self->next::method($client, @_);
}
+=head2 can
+
+Override C<can> to declare existence of the LDAP entry attribute
+methods from C<AUTOLOAD>.
+
+=cut
+
+sub can {
+ my ($self, $method) = @_;
+
+ $self->exists($method) || $self->SUPER::can($method);
+}
+
sub AUTOLOAD {
my ($self, @args) = @_;
my ($attribute) = (our $AUTOLOAD =~ /([^:]+)$/);
return if $attribute eq 'DESTROY';
- croak "Can't locate object method $AUTOLOAD via package \"" . __PACKAGE__ . '"'
+ croak qq[Can't locate object method "$attribute" via package "] . ref($self) . qq["]
unless $self->exists($attribute);
if (scalar @args) {
More information about the Catalyst-commits
mailing list