| 1 | package Bot::Backbone::Service::Role::BareMetalChat; | ||
| 2 | 4 | $Bot::Backbone::Service::Role::BareMetalChat::VERSION = '0.160630'; | |
| 3 | 4 | ▶ | use v5.10; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 4 | with 'Bot::Backbone::Service::Role::Chat'; | |
| 7 | |||
| 8 | # ABSTRACT: A chat service that is bolted on to bare metal | ||
| 9 | |||
| 10 | |||
| 11 | has _message_queue => ( | ||
| 12 | is => 'rw', | ||
| 13 | isa => 'ArrayRef', | ||
| 14 | required => 1, | ||
| 15 | 6 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 4 | traits => [ 'Array' ], | |
| 17 | handles => { | ||
| 18 | '_enqueue_message' => 'push', | ||
| 19 | #'_empty_message_queue' => [ map => sub { undef $_ } ], | ||
| 20 | '_empty_message_queue' => 'clear', | ||
| 21 | }, | ||
| 22 | ); | ||
| 23 | |||
| 24 | after shutdown => sub { | ||
| 25 | 3 | ▶ | my $self = shift; |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||
| 26 | 3 | for my $timer (@{ $self->_message_queue }) { | |
| 27 | 298 | undef $timer; | |
| 28 | } | ||
| 29 | 3 | $self->_message_queue([]); | |
| 30 | #$self->_empty_message_queue; | ||
| 31 | 4 | }; | |
| 32 | |||
| 33 | 4 | 1; | |
| 34 | |||
| 35 | __END__ | ||
| 36 | |||
| 37 | =pod | ||
| 38 | |||
| 39 | =encoding UTF-8 | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | Bot::Backbone::Service::Role::BareMetalChat - A chat service that is bolted on to bare metal | ||
| 44 | |||
| 45 | =head1 VERSION | ||
| 46 | |||
| 47 | version 0.160630 | ||
| 48 | |||
| 49 | =head1 DESCRIPTION | ||
| 50 | |||
| 51 | This role is nearly identical to L<Bot::Backbone::Service::Role::Chat>, but is | ||
| 52 | used to mark a chat service as one that will perform the final sending of a | ||
| 53 | message to an external service (e.g., L<Bot::Backbone::Service::JabberChat> or | ||
| 54 | L<Bot::Backbone::Service::ConsoleChat>) rather than one that just does some | ||
| 55 | internal routing (e.g., L<Bot::Backbone::Service::GroupChat> or | ||
| 56 | L<Bot::Backbone::Service::DirectChat>). | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Andrew Sterling Hanenkamp <hanenkamp@cpan.org> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is copyright (c) 2016 by Qubling Software LLC. | ||
| 65 | |||
| 66 | This is free software; you can redistribute it and/or modify it under | ||
| 67 | the same terms as the Perl 5 programming language system itself. | ||
| 68 | |||
| 69 | =cut | ||