Bot-Backbone
view release on metacpan or search on metacpan
lib/Bot/Backbone/Types.pm view on Meta::CPAN
package Bot::Backbone::Types;
$Bot::Backbone::Types::VERSION = '0.161950';
use v5.10;
use Moose;
use List::MoreUtils qw( all );
use MooseX::Types::Moose qw( ArrayRef ClassName CodeRef HashRef Object );
use MooseX::Types -declare => [ qw(
DispatcherType
EventLoop
PredicateList
ServiceList
VolumeLevel
) ];
use Scalar::Util qw( blessed );
use namespace::autoclean;
# ABSTRACT: The type library for Bot::Backbone
class_type 'Moose::Meta::Class';
enum DispatcherType, [qw( bot service )];
coerce DispatcherType,
from 'Moose::Meta::Class',
via {
if ($_->name->isa('Bot::Backbone::Bot')) { 'bot' }
elsif ($_->name->does('Bot::Backbone::Service::Role::Service')) { 'service' }
else { die "unknown meta object $_ in DispatherType coercion" }
};
subtype EventLoop,
as ClassName|Object,
where { $_->can('run') };
role_type 'Bot::Backbone::Dispatcher::Predicate';
subtype PredicateList,
as ArrayRef,
where { all { $_->does('Bot::Backbone::Dispatcher::Predicate') } @$_ };
class_type 'Bot::Backbone::Service::Role::Service';
subtype ServiceList,
as HashRef[Object],
where { all { blessed $_ and $_->does('Bot::Backbone::Service::Role::Service') } values %$_ };
enum VolumeLevel, [ qw( shout spoken whisper ) ];
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
Bot::Backbone::Types - The type library for Bot::Backbone
=head1 VERSION
version 0.161950
=head1 DESCRIPTION
This is a container for the various types used by L<Bot::Backbone>. It is built
using L<MooseX::Types>.
=head1 TYPES
=head2 DispatcherType
This is an enum with the following values:
( run in 0.474 second using v1.01-cache-2.11-cpan-39bf76dae61 )