| 1 | package Bot::Backbone::Types; | ||||||||||||||
| 2 | 4 | $Bot::Backbone::Types::VERSION = '0.161950'; | |||||||||||||
| 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( | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | DispatcherType | ||||||||||||||
| 10 | EventLoop | ||||||||||||||
| 11 | PredicateList | ||||||||||||||
| 12 | ServiceList | ||||||||||||||
| 13 | VolumeLevel | ||||||||||||||
| 14 | 4 | ) ]; | |||||||||||||
| 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 | 24 | ▶ | via { | ||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||
| 27 | 24 | ▶ | if ($_->name->isa('Bot::Backbone::Bot')) { 'bot' } | ||||||||||||
|
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 | 55 | ▶ | 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=1 SCAR=0.1
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__ | ||||||||||||||