Commit | Line | Data |
e7724627 |
1 | package Moose::Meta::Method::Accessor::Native::String::match; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
88e88a7b |
6 | use Moose::Util (); |
7 | use Params::Util (); |
8 | |
efa728b4 |
9 | our $VERSION = '1.15'; |
e7724627 |
10 | $VERSION = eval $VERSION; |
11 | our $AUTHORITY = 'cpan:STEVAN'; |
12 | |
8b9641b8 |
13 | use Moose::Role; |
14 | |
15 | with 'Moose::Meta::Method::Accessor::Native::Reader' => { |
16 | -excludes => [ |
17 | qw( |
18 | _minimum_arguments |
19 | _maximum_arguments |
20 | _inline_check_arguments |
21 | ) |
22 | ] |
23 | }; |
e7724627 |
24 | |
25 | sub _minimum_arguments { 1 } |
8b9641b8 |
26 | |
e7724627 |
27 | sub _maximum_arguments { 1 } |
28 | |
29 | sub _inline_check_arguments { |
30 | my $self = shift; |
31 | |
32 | return $self->_inline_throw_error( |
33 | q{'The argument passed to match must be a string or regexp reference'} |
5394a1c7 |
34 | ) . q{ unless Moose::Util::_STRINGLIKE0( $_[0] ) || Params::Util::_REGEX( $_[0] );}; |
e7724627 |
35 | } |
36 | |
37 | sub _return_value { |
38 | my ( $self, $slot_access ) = @_; |
39 | |
40 | return "$slot_access =~ \$_[0]"; |
41 | } |
42 | |
8b9641b8 |
43 | no Moose::Role; |
44 | |
e7724627 |
45 | 1; |