in reply to rules : action processing like firewall

I known how to manipulate IPTC values, my point is finding
a module that allow me to configure a workflow on images
Like, if iptc caption field contain "blabla" do that with the images,
if iptc field credit containt "Alpha" move picture to Alpha folder ...
And that like a firewall rules way. As long as a rules didn't match get
to the next rule up to the last.
I have hard time to clearlly explain what I want.

  • Comment on Re: rules : action processing like firewall

Replies are listed 'Best First'.
Re^2: rules : action processing like firewall
by happy.barney (Friar) on Mar 26, 2010 at 09:44 UTC
    Try following:
    my $rules = [ [ sub { do_some_test_here } => sub { do_some_action } ], [ sub { test2 } => [ [ sub { sub_test } => sub { action } ], ], ]; sub process { my ($list, $data) = @_; my $retval; for my $def (@$list) { next unless $def->[0]($data); $retval = ref $def->[1] eq 'ARRAY' ? process ($def->[1], $data) : $def->[1]($data) || 1 ; last if $retval; } $retval; } process ($rules, { iptc => $iptc });
      yeah happy.barney,

      I was exploring that way right now.
      I will just allow rules file to be provided as a parameters (loaded at runtime) to the "rule engine" script.

      Like that I can monitor more than one folder (that will be considered as queues like suggested by roboticus) for new images.
      Each folder will need different processing.
      Images will pass from one folder to an other, giving me my workflow.

      That will also give me kind of multi processing.

      Sound's good to me !

      Thank's for your suggestions !

      Whow !
      I just realize that you provid "recursion" in the rules !
      Great, I didn't think about it !

      MacFurax