CXC-Form-Tiny-Plugin-OptArgs2
view release on metacpan or search on metacpan
lib/CXC/Form/Tiny/Plugin/OptArgs2/Meta.pm view on Meta::CPAN
package CXC::Form::Tiny::Plugin::OptArgs2::Meta;
# ABSTRACT: Form metaclass role for OptArgs2
use v5.20;
use warnings;
our $VERSION = '0.12';
use Clone ();
use Scalar::Util qw( blessed );
use Ref::Util qw( is_plain_hashref is_arrayref is_regexpref is_ref );
use Form::Tiny::Utils 'get_package_form_meta';
use Types::Standard
qw( ArrayRef Bool CodeRef Dict Enum Int Optional RegexpRef Str Tuple Undef Value );
use Type::Params qw( signature_for );
use Types::Common::String qw ( NonEmptySimpleStr NonEmptyStr );
use Moo::Role;
use experimental 'signatures', 'postderef', 'lexical_subs';
use namespace::clean;
my sub croak {
require Carp;
goto \&Carp::croak;
}
# need to stash which form this field was added to in order to handle
# inheritance of inherited fields which aren't options, but which
# contain nested forms which *are* options.
around add_field => sub ( $orig, $self, @parameters ) {
# this may return either a FieldDefinition or a FieldDefinition, but
# in either case, it has an addons methods.
my $field = $self->$orig( @parameters );
$field->addons->{ +__PACKAGE__ }{package} = $self->package;
return $field;
};
has inherit_required => (
is => 'rwp',
isa => Bool,
builder => sub { !!1 },
);
has inherit_optargs => (
is => 'rwp',
isa => Bool,
builder => sub { !!0 },
);
( run in 2.146 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )