File Coverage

blib/lib/Bot/Backbone/Meta/Class/Bot.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Bot::Backbone::Meta::Class::Bot;
2             $Bot::Backbone::Meta::Class::Bot::VERSION = '0.161950';
3 4     4   16 use Moose;
  4         6  
  4         20  
4              
5             extends 'Moose::Meta::Class';
6             with 'Bot::Backbone::Meta::Class::DispatchBuilder';
7              
8             # ABSTRACT: Metaclass attached to backbone bots
9              
10              
11             has send_policies => (
12             is => 'ro',
13             isa => 'HashRef',
14             required => 1,
15             default => sub { +{} },
16             traits => [ 'Hash' ],
17             handles => {
18             add_send_policy => 'set',
19             list_send_policies => 'keys',
20             },
21             );
22              
23              
24             has services => (
25             is => 'ro',
26             isa => 'HashRef',
27             required => 1,
28             default => sub { +{} },
29             traits => [ 'Hash' ],
30             handles => {
31             add_service => 'set',
32             list_services => 'keys',
33             services_kv => 'kv',
34             },
35             );
36              
37              
38             has dispatchers => (
39             is => 'ro',
40             isa => 'HashRef',
41             required => 1,
42             default => sub { +{} },
43             traits => [ 'Hash' ],
44             handles => {
45             add_dispatcher => 'set',
46             },
47             );
48              
49             __PACKAGE__->meta->make_immutable;
50              
51             __END__
52              
53             =pod
54              
55             =encoding UTF-8
56              
57             =head1 NAME
58              
59             Bot::Backbone::Meta::Class::Bot - Metaclass attached to backbone bots
60              
61             =head1 VERSION
62              
63             version 0.161950
64              
65             =head1 SYNOPSIS
66              
67             my $bot = My::Bot->new;
68              
69             # Introspect send policies
70             for my $name ($bot->meta->list_send_policies) {
71             my $policy = $bot->meta->send_policies->{$name};
72             say Dumper($policy);
73             }
74              
75             # Introspect services
76             for my $name ($bot->meta->list_services) {
77             my $service = $bot->meta->services->{$name};
78             say Dumper($service);
79             }
80              
81             # Introspect a dispatcher
82             say Dumper($bot->meta->dispatcher->{default});
83              
84             =head1 DESCRIPTION
85              
86             This provides the metaclass features needed for each bot and allow some introspection of the bot's structure.
87              
88             =head1 EXTENDS
89              
90             L<Moose::Meta::Class>
91              
92             =head1 ATTRIBUTES
93              
94             =head2 send_policies
95              
96             This is a has of send policy configurations.
97              
98             =head2 services
99              
100             This is a hash of service configurations.
101              
102             =head2 dispatcher
103              
104             This is a hash of dispatchers.
105              
106             =head1 AUTHOR
107              
108             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
109              
110             =head1 COPYRIGHT AND LICENSE
111              
112             This software is copyright (c) 2016 by Qubling Software LLC.
113              
114             This is free software; you can redistribute it and/or modify it under
115             the same terms as the Perl 5 programming language system itself.
116              
117             =cut