Subject: | Model initialized incorrectly |
When I use configuration from sources (in MyApp::Model::Solr) all
working well. But when I use application config file, then options is
ignored. This is because your module use $self->config to read
configuration, but this method should be used only to set value, not to
get they. Patch is attached, and initially based on mst's code snippet.
Subject: | Catalyst::Model::WebService::Solr1.patch |
--- /usr/local/share/perl/5.10.1/Catalyst/Model/WebService/Solr.pm 2009-06-24 22:48:22.000000000 +0300
+++ lib/Catalyst/Model/WebService/Solr.pm 2009-11-22 16:49:47.000000000 +0200
@@ -4,10 +4,23 @@
use warnings;
use Moose;
+use Moose::Util::TypeConstraints;
use WebService::Solr;
extends 'Catalyst::Model';
+has 'server' => (
+ is => 'ro',
+ isa => 'Str',
+ default => 'http://localhost:8983/solr',
+);
+
+has 'options' => (
+ is => 'ro',
+ isa => 'HashRef',
+ default => sub { {} },
+);
+
has 'solr' => (
is => 'ro',
isa => 'WebService::Solr',
@@ -15,14 +28,12 @@
lazy_build => 1
);
-our $VERSION = '0.02';
+our $VERSION = '0.03';
sub _build_solr {
my $self = shift;
- my $config = $self->config;
- return WebService::Solr->new( $config->{ server },
- ( $config->{ options } || {} ) );
+ return WebService::Solr->new( $self->server, $self->options );
}
1;
@@ -74,6 +85,12 @@
Brian Cassidy E<lt>bricas@cpan.orgE<gt>
+=head1 CONTRIBUTORS
+
+Matt S. Trout E<lt>mst@shadowcatsystems.co.ukE<gt>
+
+Oleg Kostyuk E<lt>cub@cpan.orgE<gt>
+
=head1 COPYRIGHT AND LICENSE
Copyright 2008-2009 by Brian Cassidy