projects
/
webpac2
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
report missing marc_remove
[webpac2]
/
lib
/
WebPAC
/
Config.pm
diff --git
a/lib/WebPAC/Config.pm
b/lib/WebPAC/Config.pm
index
9e6f7af
..
4724699
100644
(file)
--- a/
lib/WebPAC/Config.pm
+++ b/
lib/WebPAC/Config.pm
@@
-14,11
+14,11
@@
WebPAC::Config - handle WebPAC configuration file
=head1 VERSION
=head1 VERSION
-Version 0.0
1
+Version 0.0
2
=cut
=cut
-our $VERSION = '0.0
1
';
+our $VERSION = '0.0
2
';
=head1 SYNOPSIS
=head1 SYNOPSIS
@@
-55,6
+55,8
@@
sub new {
$self->{path} ||= 'conf/config.yml';
$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}, ": $!");
$self->{config} = LoadFile($self->{path}) ||
$log->logdie("can't open ",$self->{path}, ": $!");
@@
-92,9
+94,8
@@
Which indexer are we using?
sub use_indexer {
my $self = shift;
sub use_indexer {
my $self = shift;
- my $default = 'hyperestraier';
return unless ($self->{config});
return unless ($self->{config});
- return $self->{config}->{use_indexer} ||
$default
;
+ return $self->{config}->{use_indexer} ||
undef
;
}
=head2 get
}
=head2 get
@@
-136,10
+137,13
@@
sub webpac {
=head2 iterate_inputs
$config->iterate_inputs( sub {
=head2 iterate_inputs
$config->iterate_inputs( sub {
- my
$input = shift
;
+ my
($input, $database, $database_config_hash) = @_
;
# ... do something with input config hash
} );
# ... do something with input config hash
} );
+This function will also modify C<< $input->{normalize} >> to
+be C<ARRAY>, even with just one element.
+
=cut
sub iterate_inputs {
=cut
sub iterate_inputs {
@@
-162,7
+166,10
@@
sub iterate_inputs {
foreach my $input (@inputs) {
$log->debug("iterating over input ", dump($input));
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);
}
}
}
}