/[webpac2]/trunk/lib/WebPAC/Config.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Config.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 685 by dpavlin, Sun Sep 24 17:24:59 2006 UTC revision 967 by dpavlin, Fri Nov 2 13:11:35 2007 UTC
# Line 14  WebPAC::Config - handle WebPAC configura Line 14  WebPAC::Config - handle WebPAC configura
14    
15  =head1 VERSION  =head1 VERSION
16    
17  Version 0.01  Version 0.02
18    
19  =cut  =cut
20    
21  our $VERSION = '0.01';  our $VERSION = '0.02';
22    
23  =head1 SYNOPSIS  =head1 SYNOPSIS
24    
# Line 55  sub new { Line 55  sub new {
55    
56          $self->{path} ||= 'conf/config.yml';          $self->{path} ||= 'conf/config.yml';
57    
58            $log->logdie("can't open ", $self->{path}, ": $!") if ! -r $self->{path};
59    
60          $self->{config} = LoadFile($self->{path}) ||          $self->{config} = LoadFile($self->{path}) ||
61                  $log->logdie("can't open ",$self->{path}, ": $!");                  $log->logdie("can't open ",$self->{path}, ": $!");
62    
# Line 92  Which indexer are we using? Line 94  Which indexer are we using?
94    
95  sub use_indexer {  sub use_indexer {
96          my $self = shift;          my $self = shift;
         my $default = 'hyperestraier';  
97          return unless ($self->{config});          return unless ($self->{config});
98          return $self->{config}->{use_indexer} || $default;          return $self->{config}->{use_indexer} || undef;
99  }  }
100    
101  =head2 get  =head2 get
# Line 136  sub webpac { Line 137  sub webpac {
137  =head2 iterate_inputs  =head2 iterate_inputs
138    
139    $config->iterate_inputs( sub {    $config->iterate_inputs( sub {
140          my $input = shift;          my ($input, $database, $database_config_hash) = @_;
141          # ... do something with input config hash          # ... do something with input config hash
142    } );    } );
143    
144    This function will also modify C<< $input->{normalize} >> to
145    be C<ARRAY>, even with just one element.
146    
147  =cut  =cut
148    
149  sub iterate_inputs {  sub iterate_inputs {
# Line 162  sub iterate_inputs { Line 166  sub iterate_inputs {
166    
167                  foreach my $input (@inputs) {                  foreach my $input (@inputs) {
168                          $log->debug("iterating over input ", dump($input));                          $log->debug("iterating over input ", dump($input));
169                          $code_ref->($input);                          if ( defined( $input->{normalize} ) && ref($input->{normalize}) ne 'ARRAY' ) {
170                                    $input->{normalize} = [ $input->{normalize} ];
171                            }
172                            $code_ref->($input, $database, $db_config);
173                  }                  }
174          }          }
175    

Legend:
Removed from v.685  
changed lines
  Added in v.967

  ViewVC Help
Powered by ViewVC 1.1.26