| 1 | package Bot::Backbone::Types; | ||||||||||||||
| 2 | 4 | $Bot::Backbone::Types::VERSION = '0.160630'; | |||||||||||||
| 3 | 4 | ▶ | use v5.10; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 4 | ▶ | use Moose; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 4 | ▶ | use List::MoreUtils qw( all ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 4 | ▶ | use MooseX::Types::Moose qw( ArrayRef ClassName CodeRef HashRef Object ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 4 | use MooseX::Types -declare => [ qw( | |||||||||||||
| 9 | DispatcherType | ||||||||||||||
| 10 | EventLoop | ||||||||||||||
| 11 | PredicateList | ||||||||||||||
| 12 | ServiceList | ||||||||||||||
| 13 | VolumeLevel | ||||||||||||||
| 14 | 4 | ▶ | ) ]; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 15 | 4 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 4 | ▶ | use namespace::autoclean; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 18 | |||||||||||||||
| 19 | # ABSTRACT: The type library for Bot::Backbone | ||||||||||||||
| 20 | |||||||||||||||
| 21 | |||||||||||||||
| 22 | 4 | class_type 'Moose::Meta::Class'; | |||||||||||||
| 23 | 4 | enum DispatcherType, [qw( bot service )]; | |||||||||||||
| 24 | coerce DispatcherType, | ||||||||||||||
| 25 | from 'Moose::Meta::Class', | ||||||||||||||
| 26 | via { | ||||||||||||||
| 27 | 24 | ▶ | if ($_->name->isa('Bot::Backbone::Bot')) { 'bot' } | ||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
Branch: 2 branches
| |||||||||||||||
| 28 | 5 | elsif ($_->name->does('Bot::Backbone::Service::Role::Service')) { 'service' } | |||||||||||||
| 29 | 0 | else { die "unknown meta object $_ in DispatherType coercion" } | |||||||||||||
| 30 | 4 | }; | |||||||||||||
| 31 | |||||||||||||||
| 32 | |||||||||||||||
| 33 | subtype EventLoop, | ||||||||||||||
| 34 | as ClassName|Object, | ||||||||||||||
| 35 | 4 | ▶ | where { $_->can('run') }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 36 | |||||||||||||||
| 37 | |||||||||||||||
| 38 | 4 | role_type 'Bot::Backbone::Dispatcher::Predicate'; | |||||||||||||
| 39 | subtype PredicateList, | ||||||||||||||
| 40 | as ArrayRef, | ||||||||||||||
| 41 | 88 | ▶ | where { all { $_->does('Bot::Backbone::Dispatcher::Predicate') } @$_ }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 42 | |||||||||||||||
| 43 | |||||||||||||||
| 44 | 4 | class_type 'Bot::Backbone::Service::Role::Service'; | |||||||||||||
| 45 | subtype ServiceList, | ||||||||||||||
| 46 | as HashRef[Object], | ||||||||||||||
| 47 | 14 | ▶ | where { all { blessed $_ and $_->does('Bot::Backbone::Service::Role::Service') } values %$_ }; | ||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||
| 48 | |||||||||||||||
| 49 | |||||||||||||||
| 50 | 4 | enum VolumeLevel, [ qw( shout spoken whisper ) ]; | |||||||||||||
| 51 | |||||||||||||||
| 52 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||||
| 53 | |||||||||||||||
| 54 | __END__ | ||||||||||||||
| 55 | |||||||||||||||
| 56 | =pod | ||||||||||||||
| 57 | |||||||||||||||
| 58 | =encoding UTF-8 | ||||||||||||||
| 59 | |||||||||||||||
| 60 | =head1 NAME | ||||||||||||||
| 61 | |||||||||||||||
| 62 | Bot::Backbone::Types - The type library for Bot::Backbone | ||||||||||||||
| 63 | |||||||||||||||
| 64 | =head1 VERSION | ||||||||||||||
| 65 | |||||||||||||||
| 66 | version 0.160630 | ||||||||||||||
| 67 | |||||||||||||||
| 68 | =head1 DESCRIPTION | ||||||||||||||
| 69 | |||||||||||||||
| 70 | This is a container for the various types used by L<Bot::Backbone>. It is built | ||||||||||||||
| 71 | using L<MooseX::Types>. | ||||||||||||||
| 72 | |||||||||||||||
| 73 | =head1 TYPES | ||||||||||||||
| 74 | |||||||||||||||
| 75 | =head2 DispatcherType | ||||||||||||||
| 76 | |||||||||||||||
| 77 | This is an enum with the following values: | ||||||||||||||
| 78 | |||||||||||||||
| 79 | bot | ||||||||||||||
| 80 | service | ||||||||||||||
| 81 | |||||||||||||||
| 82 | =head2 EventLoop | ||||||||||||||
| 83 | |||||||||||||||
| 84 | This is just an object with a C<run> method. | ||||||||||||||
| 85 | |||||||||||||||
| 86 | =head2 PredicateList | ||||||||||||||
| 87 | |||||||||||||||
| 88 | This is an array of code references. | ||||||||||||||
| 89 | |||||||||||||||
| 90 | =head2 ServiceList | ||||||||||||||
| 91 | |||||||||||||||
| 92 | This is a hash of objects that implement L<Bot::Backbone::Service::Role::Service>. | ||||||||||||||
| 93 | |||||||||||||||
| 94 | =head2 VolumeLevel | ||||||||||||||
| 95 | |||||||||||||||
| 96 | This is an enumeration of possible volume levels for chats. It must be one of the following: | ||||||||||||||
| 97 | |||||||||||||||
| 98 | shout | ||||||||||||||
| 99 | spoken | ||||||||||||||
| 100 | whisper | ||||||||||||||
| 101 | |||||||||||||||
| 102 | =head1 AUTHOR | ||||||||||||||
| 103 | |||||||||||||||
| 104 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||||||||||||||
| 105 | |||||||||||||||
| 106 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||
| 107 | |||||||||||||||
| 108 | This software is copyright (c) 2016 by Qubling Software LLC. | ||||||||||||||
| 109 | |||||||||||||||
| 110 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||
| 111 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||
| 112 | |||||||||||||||
| 113 | =cut | ||||||||||||||