| 1 | package Message::Passing::Role::Input; | ||||||||||
| 2 | 14 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 14 | ▶ | use Scalar::Util qw/ blessed /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 14 | ▶ | use Module::Runtime qw/ require_module /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 14 | ▶ | use namespace::clean -except => 'meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | has output_to => ( | ||||||||||
| 8 | is => 'ro', | ||||||||||
| 9 | required => 1, | ||||||||||
| 10 | 37 | ▶ | isa => sub { blessed($_[0]) && $_[0]->can('consume') }, | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||
| 11 | coerce => sub { | ||||||||||
| 12 | 37 | ▶ | my $val = shift; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 13 | 37 | ▶ | if (ref($val) eq 'HASH') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 1 | my %stuff = %$val; | |||||||||
| 15 | 1 | my $class = delete($stuff{class}); | |||||||||
| 16 | 1 | require_module($class); | |||||||||
| 17 | 1 | $val = $class->new(%stuff); | |||||||||
| 18 | } | ||||||||||
| 19 | 37 | $val; | |||||||||
| 20 | }, | ||||||||||
| 21 | 14 | ); | |||||||||
| 22 | |||||||||||
| 23 | 14 | 1; | |||||||||
| 24 | |||||||||||
| 25 | =head1 NAME | ||||||||||
| 26 | |||||||||||
| 27 | Message::Passing::Role::Input | ||||||||||
| 28 | |||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||
| 30 | |||||||||||
| 31 | Produces messages. | ||||||||||
| 32 | |||||||||||
| 33 | =head1 ATTRIBUTES | ||||||||||
| 34 | |||||||||||
| 35 | =head2 output_to | ||||||||||
| 36 | |||||||||||
| 37 | Required, must perform the L<Message::Passing::Role::Output> role. | ||||||||||
| 38 | |||||||||||
| 39 | =head1 SEE ALSO | ||||||||||
| 40 | |||||||||||
| 41 | =over | ||||||||||
| 42 | |||||||||||
| 43 | =item L<Message::Passing> | ||||||||||
| 44 | |||||||||||
| 45 | =item L<Message::Passing::Manual::Concepts> | ||||||||||
| 46 | |||||||||||
| 47 | =back | ||||||||||
| 48 | |||||||||||
| 49 | =head1 SPONSORSHIP | ||||||||||
| 50 | |||||||||||
| 51 | This module exists due to the wonderful people at Suretec Systems Ltd. | ||||||||||
| 52 | <http://www.suretecsystems.com/> who sponsored its development for its | ||||||||||
| 53 | VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with | ||||||||||
| 54 | the SureVoIP API - | ||||||||||
| 55 | <http://www.surevoip.co.uk/support/wiki/api_documentation> | ||||||||||
| 56 | |||||||||||
| 57 | =head1 AUTHOR, COPYRIGHT AND LICENSE | ||||||||||
| 58 | |||||||||||
| 59 | See L<Message::Passing>. | ||||||||||
| 60 | |||||||||||
| 61 | =cut | ||||||||||