File Coverage

blib/lib/Bot/Backbone/Service/Role/Service.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod 1 1 100.0
total 6 6 100.0


line stmt bran cond sub pod time code
1             package Bot::Backbone::Service::Role::Service;
2             $Bot::Backbone::Service::Role::Service::VERSION = '0.160630';
3 4     4   873 use Moose::Role;
  4         5  
  4         27  
4              
5             # ABSTRACT: Role implemented by all bot services
6              
7              
8             has name => (
9                 is => 'ro',
10                 isa => 'Str',
11                 required => 1,
12             );
13              
14              
15             has bot => (
16                 is => 'ro',
17                 isa => 'Bot::Backbone::Bot',
18                 required => 1,
19                 weak_ref => 1,
20                 handles => {
21                     get_service => 'get_service',
22                 },
23             );
24              
25              
26             requires qw( initialize );
27              
28              
29       3 1   sub shutdown { }
30              
31             1;
32              
33             __END__
34            
35             =pod
36            
37             =encoding UTF-8
38            
39             =head1 NAME
40            
41             Bot::Backbone::Service::Role::Service - Role implemented by all bot services
42            
43             =head1 VERSION
44            
45             version 0.160630
46            
47             =head1 DESCRIPTION
48            
49             All bot services must implement this role.
50            
51             =head1 ATTRIBUTES
52            
53             =head2 name
54            
55             This is the name of the service configured for the bot. It will be unique for
56             that bot.
57            
58             =head2 bot
59            
60             This is a back link to the L<Bot::Backbone::Bot> that owns this service.
61            
62             =head1 REQUIRED METHODS
63            
64             =head2 initialize
65            
66             This method will be called after construction, but before the event loop starts.
67             This is where the service should initalize connections, prepare to receive
68             messages, etc.
69            
70             It will be passed no arguments.
71            
72             =head1 METHODS
73            
74             =head2 shutdown
75            
76             This method will be called just before the bot destroys the service and exits.
77             If called, your service is expected to terminate any pending jobs, kill any
78             child processes, and clean up so that the bot will exit cleanly.
79            
80             A default implementation is provided, which does nothing.
81            
82             =head1 AUTHOR
83            
84             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
85            
86             =head1 COPYRIGHT AND LICENSE
87            
88             This software is copyright (c) 2016 by Qubling Software LLC.
89            
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92            
93             =cut
94