Reactive-Core
view release on metacpan or search on metacpan
local/lib/perl5/Eval/TypeTiny.pm view on Meta::CPAN
{ my $tie; sub _manufacture_ties { $tie ||= eval <<'FALLBACK'; } }
no warnings qw(void once uninitialized numeric);
{
package #
Eval::TypeTiny::_TieArray;
require Tie::Array;
our @ISA = qw( Tie::StdArray );
sub TIEARRAY {
my $class = shift;
bless $_[0] => $class;
}
sub AUTOLOAD {
my $self = shift;
my ($method) = (our $AUTOLOAD =~ /(\w+)$/);
defined tied(@$self) and return tied(@$self)->$method(@_);
require Carp;
Carp::croak(qq[Can't call method "$method" on an undefined value]);
}
sub can {
my $self = shift;
local/lib/perl5/Eval/TypeTiny.pm view on Meta::CPAN
fallback => 1,
;
}
{
package #
Eval::TypeTiny::_TieHash;
require Tie::Hash;
our @ISA = qw( Tie::StdHash );
sub TIEHASH {
my $class = shift;
bless $_[0] => $class;
}
sub AUTOLOAD {
my $self = shift;
my ($method) = (our $AUTOLOAD =~ /(\w+)$/);
defined tied(%$self) and return tied(%$self)->$method(@_);
require Carp;
Carp::croak(qq[Can't call method "$method" on an undefined value]);
}
sub can {
my $self = shift;
local/lib/perl5/Eval/TypeTiny.pm view on Meta::CPAN
fallback => 1,
;
}
{
package #
Eval::TypeTiny::_TieScalar;
require Tie::Scalar;
our @ISA = qw( Tie::StdScalar );
sub TIESCALAR {
my $class = shift;
bless $_[0] => $class;
}
sub AUTOLOAD {
my $self = shift;
my ($method) = (our $AUTOLOAD =~ /(\w+)$/);
defined tied($$self) and return tied($$self)->$method(@_);
require Carp;
Carp::croak(qq[Can't call method "$method" on an undefined value]);
}
sub can {
my $self = shift;
local/lib/perl5/Type/Params.pm view on Meta::CPAN
$obj->dump(undef); # dies
=head2 Slurpy Parameters
use Types::Standard qw( slurpy ClassName HashRef );
sub new
{
state $check = compile( ClassName, slurpy HashRef );
my ($class, $ref) = $check->(@_);
bless $ref => $class;
}
__PACKAGE__->new(foo => 1, bar => 2);
The following types from L<Types::Standard> can be made slurpy:
C<ArrayRef>, C<Tuple>, C<HashRef>, C<Map>, C<Dict>. Hash-like types
will die if an odd number of elements are slurped in.
A check may only have one slurpy parameter, and it must be the last
parameter.
( run in 0.359 second using v1.01-cache-2.11-cpan-2b1a40005be )