Show
Ignore:
Timestamp:
09/23/08 09:47:21 (5 years ago)
Author:
lopnor
Message:

you can specify File::Find::Rule rules in config.yaml

Location:
lang/perl/App-Hachero/trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Input/File.pm

    r19478 r19752  
    44use base qw(App::Hachero::Plugin::Base); 
    55use File::Find::Rule; 
     6use File::Find::Rule::Age; 
    67use File::stat; 
    78 
     
    2627sub _get_rule { 
    2728    my ($self, $context) = @_; 
    28     my $work_path = $context->work_path; 
    29     $self->{rule} = File::Find::Rule->file()->start( $work_path ); 
     29    my $path = $self->config->{config}->{path} || $context->work_path; 
     30    my $rule = File::Find::Rule->file(); 
     31    my $config = $self->config->{config}->{rule}; 
     32    for my $key (keys %{$config}) { 
     33        my $value = $config->{$key}; 
     34        $rule->$key( 
     35            ref $value eq 'HASH' ? %{$value} : 
     36            ref $value eq 'ARRAY' ? @{$value} : 
     37            $value 
     38        ); 
     39    } 
     40    $self->{rule} = $rule->start( $path ); 
    3041    return $self->{rule}; 
    3142}