--- trunk/lib/WebPAC/Config.pm 2006/09/24 17:24:59 685 +++ trunk/lib/WebPAC/Config.pm 2007/11/02 13:11:35 967 @@ -14,11 +14,11 @@ =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; =head1 SYNOPSIS @@ -55,6 +55,8 @@ $self->{path} ||= 'conf/config.yml'; + $log->logdie("can't open ", $self->{path}, ": $!") if ! -r $self->{path}; + $self->{config} = LoadFile($self->{path}) || $log->logdie("can't open ",$self->{path}, ": $!"); @@ -92,9 +94,8 @@ sub use_indexer { my $self = shift; - my $default = 'hyperestraier'; return unless ($self->{config}); - return $self->{config}->{use_indexer} || $default; + return $self->{config}->{use_indexer} || undef; } =head2 get @@ -136,10 +137,13 @@ =head2 iterate_inputs $config->iterate_inputs( sub { - my $input = shift; + my ($input, $database, $database_config_hash) = @_; # ... do something with input config hash } ); +This function will also modify C<< $input->{normalize} >> to +be C, even with just one element. + =cut sub iterate_inputs { @@ -162,7 +166,10 @@ foreach my $input (@inputs) { $log->debug("iterating over input ", dump($input)); - $code_ref->($input); + if ( defined( $input->{normalize} ) && ref($input->{normalize}) ne 'ARRAY' ) { + $input->{normalize} = [ $input->{normalize} ]; + } + $code_ref->($input, $database, $db_config); } }