Acme-Mitey-Cards
view release on metacpan or search on metacpan
lib/Acme/Mitey/Cards/Card.pm.mite.pm view on Meta::CPAN
no warnings qw( once void );
our $USES_MITE = "Mite::Class";
our $MITE_SHIM = "Acme::Mitey::Cards::Mite";
our $MITE_VERSION = "0.013000";
# Mite keywords
BEGIN {
my ( $SHIM, $CALLER ) =
( "Acme::Mitey::Cards::Mite", "Acme::Mitey::Cards::Card" );
(
*after, *around, *before, *extends, *field,
*has, *param, *signature_for, *with
)
= do {
package Acme::Mitey::Cards::Mite;
no warnings 'redefine';
(
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
sub { },
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
);
};
}
# Mite imports
BEGIN {
require Scalar::Util;
*STRICT = \&Acme::Mitey::Cards::Mite::STRICT;
*bare = \&Acme::Mitey::Cards::Mite::bare;
*blessed = \&Scalar::Util::blessed;
*carp = \&Acme::Mitey::Cards::Mite::carp;
*confess = \&Acme::Mitey::Cards::Mite::confess;
*croak = \&Acme::Mitey::Cards::Mite::croak;
*false = \&Acme::Mitey::Cards::Mite::false;
*guard = \&Acme::Mitey::Cards::Mite::guard;
*lazy = \&Acme::Mitey::Cards::Mite::lazy;
*lock = \&Acme::Mitey::Cards::Mite::lock;
*ro = \&Acme::Mitey::Cards::Mite::ro;
*rw = \&Acme::Mitey::Cards::Mite::rw;
*rwp = \&Acme::Mitey::Cards::Mite::rwp;
*true = \&Acme::Mitey::Cards::Mite::true;
*unlock = \&Acme::Mitey::Cards::Mite::unlock;
}
# Gather metadata for constructor and destructor
sub __META__ {
no strict 'refs';
my $class = shift;
$class = ref($class) || $class;
my $linear_isa = mro::get_linear_isa($class);
return {
BUILD => [
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
map { "$_\::BUILD" } reverse @$linear_isa
],
DEMOLISH => [
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
map { "$_\::DEMOLISH" } @$linear_isa
],
HAS_BUILDARGS => $class->can('BUILDARGS'),
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
};
}
# Moose-compatibility method
sub meta {
require Acme::Mitey::Cards::MOP;
Moose::Util::find_meta( ref $_[0] or $_[0] );
}
# Standard Moose/Moo-style constructor
sub new {
my $class = ref( $_[0] ) ? ref(shift) : shift;
my $meta = ( $Mite::META{$class} ||= $class->__META__ );
my $self = bless {}, $class;
my $args =
$meta->{HAS_BUILDARGS}
? $class->BUILDARGS(@_)
: { ( @_ == 1 ) ? %{ $_[0] } : @_ };
my $no_build = delete $args->{__no_BUILD__};
# Attribute deck (type: Deck)
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 9
if ( exists $args->{"deck"} ) {
blessed( $args->{"deck"} )
&& $args->{"deck"}->isa("Acme::Mitey::Cards::Deck")
or croak "Type check failed in constructor: %s should be %s",
"deck", "Deck";
$self->{"deck"} = $args->{"deck"};
}
require Scalar::Util && Scalar::Util::weaken( $self->{"deck"} )
if ref $self->{"deck"};
# Attribute reverse (type: Str)
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 19
if ( exists $args->{"reverse"} ) {
do {
package Acme::Mitey::Cards::Mite;
defined( $args->{"reverse"} ) and do {
ref( \$args->{"reverse"} ) eq 'SCALAR'
or ref( \( my $val = $args->{"reverse"} ) ) eq 'SCALAR';
}
}
or croak "Type check failed in constructor: %s should be %s",
"reverse", "Str";
$self->{"reverse"} = $args->{"reverse"};
}
# Call BUILD methods
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } );
# Unrecognized parameters
my @unknown = grep not(/\A(?:deck|reverse)\z/), keys %{$args};
@unknown
and croak(
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
( run in 1.907 second using v1.01-cache-2.11-cpan-140bd7fdf52 )