supprot \x42 HEX numbers in recode
[webpac2] / lib / WebPAC / Config.pm
index efeb941..4724699 100644 (file)
@@ -55,6 +55,8 @@ sub new {
 
        $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 @@ Which indexer are we using?
 
 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
@@ -140,6 +141,9 @@ sub webpac {
        # ... 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 {
@@ -162,6 +166,9 @@ sub iterate_inputs {
 
                foreach my $input (@inputs) {
                        $log->debug("iterating over input ", dump($input));
+                       if ( defined( $input->{normalize} ) && ref($input->{normalize}) ne 'ARRAY' ) {
+                               $input->{normalize} = [ $input->{normalize} ];
+                       }
                        $code_ref->($input, $database, $db_config);
                }
        }