On 21 Apr 2014, at 09:45, Dirk Koopman <d...@tobit.co.uk> wrote:

> This may be related to the question I asked recently about turning (up to) a 
> few hundred REGEXes into one giant REGEX. The goal being to test all those 
> disparate REGEXes in the most efficient way possible on a string.

Sounds like an implementation detail.

My reading of the problem was this:

package Evil;
use Moose;
has regexen => (
  is => ‘ro’,
  default => sub { [] },
  traits => [‘Array’],
  handles => {
    add_regex => ‘push’,
    res => ‘elements’,
  },
);

sub go {
  my ($self, $datum) = @_;
  for my $r ($self->res) {
    return 0 if $datum !~ $r;
  }
  1;
}  

__PACKAGE__->meta->make_immutable;
1;
__END__

Reply via email to