Bug 17600: Standardize our EXPORT_OK
[srvgit] / Koha / RecordProcessor.pm
index b9d2918..ec7cbea 100644 (file)
@@ -59,7 +59,7 @@ clone it I<prior> to passing it off to the RecordProcessor.
 
 use Modern::Perl;
 
-use Module::Load::Conditional qw(can_load);
+use Module::Load::Conditional qw( can_load );
 use Module::Pluggable::Object;
 
 use base qw(Class::Accessor);
@@ -121,6 +121,29 @@ sub new {
     return $self;
 }
 
+=head3 options
+
+    $processor->options( $new_options );
+
+Overloaded accessor, that spreads the new options to the filter objects when set
+
+=cut
+
+sub options {
+    my ( $self, $options ) = @_;
+
+    if ( $options ) {  # Set
+        foreach my $filter ( @{$self->filters} ) {
+            $filter->params->{options} = $options;
+        }
+
+        $self->{options} = $options;
+        return $self;
+    }
+
+    return $self->{options};
+}
+
 =head2 bind
 
     $normalizer->bind($record)
@@ -152,14 +175,12 @@ sub process {
 
     return unless defined $record;
 
-    my $newrecord = $record;
-
     foreach my $filterobj (@{$self->filters}) {
         next unless $filterobj;
-        $newrecord = $filterobj->filter($newrecord);
+        $filterobj->filter($record);
     }
 
-    return $newrecord;
+    return $record;
 }
 
 sub DESTROY {