| 1 | package Cikl::Smrt::ParserHelpers::XPathRegexMapping; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Mouse; | ||
| 6 | use Mouse::Util::TypeConstraints; | ||
| 7 | |||
| 8 | |||
| 9 | has 'event_fields' => ( | ||
| 10 | is => 'ro', | ||
| 11 | isa => 'ArrayRef[Str]', | ||
| 12 | required => 1 | ||
| 13 | ); | ||
| 14 | |||
| 15 | has 'xpath' => ( | ||
| 16 | is => 'ro', | ||
| 17 | isa => 'Str', | ||
| 18 | required => 1 | ||
| 19 | ); | ||
| 20 | |||
| 21 | has 'regex' => ( | ||
| 22 | is => 'ro', | ||
| 23 | isa => 'RegexpRef', | ||
| 24 | required => 1 | ||
| 25 | ); | ||
| 26 | |||
| 27 | sub BUILD { | ||
| 28 | my $self = shift; | ||
| 29 | |||
| 30 | if ( $#{$self->event_fields} == -1 ) { | ||
| 31 | die 'event_fields: at least one field name required!'; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | __PACKAGE__->meta->make_immutable; | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 |