Hash-Wrap
view release on metacpan or search on metacpan
lib/Hash/Wrap.pm view on Meta::CPAN
validate_inline => 'exists $self->{\<<KEY>>}',
validate_method => 'exists $self->{$key}',
set => '$self->{q[\<<KEY>>]} = $_[0] if @_;',
return_value => '$self->{q[\<<KEY>>]}',
recursion_constructor => q{},
meta => [ map { ( qq[q($_) => q($attr->{$_}),] ) } keys %$attr ],
predicate_template => q{},
);
if ( $attr->{-lvalue} ) {
if ( $] lt '5.016000' ) {
_croak( 'lvalue accessors require Perl 5.16 or later' )
if $attr->{-lvalue} < 0;
}
else {
$dict{autoload_attr} = q[: lvalue];
$dict{signature} = q[: lvalue];
}
}
if ( $attr->{-undef} ) {
use Test2::V0;
use Hash::Wrap ();
my $HAS_LVALUE;
BEGIN {
$HAS_LVALUE = $] ge '5.01600';
}
like(
dies {
Hash::Wrap->import( 'not_exported' )
},
qr/not_exported is not exported/,
'not exported'
);
use Test2::V0;
use Test2::API qw/ context /;
use Scalar::Util 'blessed';
use Hash::Wrap ();
my $HAS_LVALUE;
BEGIN {
$HAS_LVALUE = $] ge '5.01600';
}
sub test_generator {
my ( $generator ) = @_;
my $ctx = context();
my %hash = ( a => 1, b => 2 );
t/lvalue_undef.t view on Meta::CPAN
#! perl
use Test2::V0;
use Test2::API qw/ context /;
use Scalar::Util 'blessed';
my $HAS_LVALUE;
BEGIN {
$HAS_LVALUE = $] ge '5.01600';
}
skip_all( "lvalue support requires perl 5.16 or later" )
unless $HAS_LVALUE;
sub test_generator {
my ( $generator ) = @_;
my $ctx = context();
( run in 0.524 second using v1.01-cache-2.11-cpan-cc502c75498 )