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