make github the primary repository
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / String / match.pm
CommitLineData
e7724627 1package Moose::Meta::Method::Accessor::Native::String::match;
2
3use strict;
4use warnings;
5
88e88a7b 6use Moose::Util ();
7use Params::Util ();
8
8b9641b8 9use Moose::Role;
10
00bbc132 11with 'Moose::Meta::Method::Accessor::Native::Reader';
e7724627 12
13sub _minimum_arguments { 1 }
8b9641b8 14
e7724627 15sub _maximum_arguments { 1 }
16
17sub _inline_check_arguments {
18 my $self = shift;
19
53a4677c 20 return (
21 'if (!Moose::Util::_STRINGLIKE0($_[0]) && !Params::Util::_REGEX($_[0])) {',
22 $self->_inline_throw_error(
23 '"The argument passed to match must be a string or regexp '
24 . 'reference"',
25 ) . ';',
26 '}',
27 );
e7724627 28}
29
30sub _return_value {
53a4677c 31 my $self = shift;
32 my ($slot_access) = @_;
e7724627 33
53a4677c 34 return $slot_access . ' =~ $_[0]';
e7724627 35}
36
8b9641b8 37no Moose::Role;
38
e7724627 391;