[Catalyst-commits] r7538 - in trunk/Catalyst-Model-LDAP: .
lib/Catalyst/Model/LDAP t t/lib t/lib/TestApp2
t/lib/TestApp2/Model t/lib/TestApp2/Model/LDAP
omega at dev.catalyst.perl.org
omega at dev.catalyst.perl.org
Tue Apr 1 12:56:53 BST 2008
Author: omega
Date: 2008-04-01 12:56:53 +0100 (Tue, 01 Apr 2008)
New Revision: 7538
Added:
trunk/Catalyst-Model-LDAP/t/inherited_component.t
trunk/Catalyst-Model-LDAP/t/lib/TestApp2.pm
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP.pm
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Connection.pm
trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Entry.pm
Modified:
trunk/Catalyst-Model-LDAP/
trunk/Catalyst-Model-LDAP/Changes
trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm
Log:
r24451 at andreas-marienborgs-computer: andreas | 2008-04-01 13:56:30 +0200
Fix a problem with custom Entry and Connection classes living under the Model namespace
Property changes on: trunk/Catalyst-Model-LDAP
___________________________________________________________________
Name: svk:merge
- 20164c6d-cd09-0410-925d-b4c4e616b846:/local/Catalyst-Model-LDAP:15102
d5d31d6e-1f00-0410-95d2-b6c42ccb6655:/trunk:90
ea49d7f7-7c45-40ca-be27-1349e20c1c07:/local/c-model-ldap:15955
+ 20164c6d-cd09-0410-925d-b4c4e616b846:/local/Catalyst-Model-LDAP:15102
d5d31d6e-1f00-0410-95d2-b6c42ccb6655:/trunk:90
ea49d7f7-7c45-40ca-be27-1349e20c1c07:/local/c-model-ldap:24451
Modified: trunk/Catalyst-Model-LDAP/Changes
===================================================================
--- trunk/Catalyst-Model-LDAP/Changes 2008-03-31 23:54:34 UTC (rev 7537)
+++ trunk/Catalyst-Model-LDAP/Changes 2008-04-01 11:56:53 UTC (rev 7538)
@@ -1,4 +1,8 @@
Revision history for Perl extension Catalyst::Model::LDAP.
+ - Fix a problem when the Entry and Connection classes
+ live under the same app namespace, when COMPONENT gets
+ called from Catalyst, Net::LDAP::Entry dies because
+ $self is not a ref.
0.16 Wed Feb 20 19:17:04 EST 2008
- Fix Catalyst::Model::LDAP::Entry's constructor
Modified: trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm 2008-03-31 23:54:34 UTC (rev 7537)
+++ trunk/Catalyst-Model-LDAP/lib/Catalyst/Model/LDAP/Entry.pm 2008-04-01 11:56:53 UTC (rev 7538)
@@ -118,7 +118,7 @@
sub can {
my ($self, $method) = @_;
-
+ return 0 unless ref($self);
$self->exists($method) || $self->SUPER::can($method);
}
Added: trunk/Catalyst-Model-LDAP/t/inherited_component.t
===================================================================
--- trunk/Catalyst-Model-LDAP/t/inherited_component.t (rev 0)
+++ trunk/Catalyst-Model-LDAP/t/inherited_component.t 2008-04-01 11:56:53 UTC (rev 7538)
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Catalyst::Test 'TestApp2';
+
+plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR};
+plan tests => 2;
+
+{
+ my $res = request('/search?sn=TEST');
+ ok($res->is_success);
+ like($res->content, qr/TEST/);
+}
\ No newline at end of file
Added: trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Connection.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Connection.pm (rev 0)
+++ trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Connection.pm 2008-04-01 11:56:53 UTC (rev 7538)
@@ -0,0 +1,11 @@
+package TestApp2::Model::LDAP::Connection;
+
+use strict;
+use warnings;
+use base qw/Catalyst::Model::LDAP::Connection/;
+
+sub blarg {
+ shift->search(@_);
+}
+
+1;
Added: trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Entry.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Entry.pm (rev 0)
+++ trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP/Entry.pm 2008-04-01 11:56:53 UTC (rev 7538)
@@ -0,0 +1,13 @@
+package TestApp2::Model::LDAP::Entry;
+
+use strict;
+use warnings;
+use base qw/Catalyst::Model::LDAP::Entry/;
+
+sub is_cool {
+ my ($self) = @_;
+
+ return $self->uid . ' is cool!';
+}
+
+1;
Added: trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP.pm (rev 0)
+++ trunk/Catalyst-Model-LDAP/t/lib/TestApp2/Model/LDAP.pm 2008-04-01 11:56:53 UTC (rev 7538)
@@ -0,0 +1,7 @@
+package TestApp2::Model::LDAP;
+
+use strict;
+use warnings;
+use base qw/Catalyst::Model::LDAP/;
+
+1;
Added: trunk/Catalyst-Model-LDAP/t/lib/TestApp2.pm
===================================================================
--- trunk/Catalyst-Model-LDAP/t/lib/TestApp2.pm (rev 0)
+++ trunk/Catalyst-Model-LDAP/t/lib/TestApp2.pm 2008-04-01 11:56:53 UTC (rev 7538)
@@ -0,0 +1,47 @@
+package TestApp2;
+
+use strict;
+use warnings;
+use Catalyst;# qw/-Debug/;
+use Data::Dumper;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config(
+ name => 'TestApp',
+ 'Model::LDAP' => {
+ host => 'ldap.ufl.edu',
+ base => 'ou=People,dc=ufl,dc=edu',
+ connection_class => 'TestApp2::Model::LDAP::Connection',
+ entry_class => 'TestApp2::Model::LDAP::Entry',
+ },
+);
+
+__PACKAGE__->setup;
+
+sub filter {
+ my ($self, $params) = @_;
+
+ my @parts = map { $_ . '=' . $params->{$_} } keys %$params;
+ my $filter = '(' . join('&', @parts) . ')';
+
+ return $filter;
+}
+
+sub search : Local {
+ my ($self, $c) = @_;
+
+ my $filter = $self->filter($c->request->params);
+ my $mesg = $c->model('LDAP')->search($filter);
+
+ $c->stash(entries => [ $mesg->entries ]);
+ $c->forward('results');
+}
+sub results : Local {
+ my ($self, $c) = @_;
+
+ $c->response->content_type('text/plain');
+ $c->response->body(Dumper $c->stash);
+}
+
+1;
More information about the Catalyst-commits
mailing list