File Coverage

blib/lib/POE/Framework/MIDI.pm
Criterion Covered Total %
statement 31 34 91.1
branch 2 8 25.0
condition 0 3 0.0
subroutine 10 11 90.9
pod 0 3 0.0
total 43 59 72.8


line stmt bran cond sub pod time code
1             # MIDI.pm is a simplified front end to the
2             #
3             # load everything we'll need, and get ready to rock.
4              
5             package POE::Framework::MIDI;
6              
7 3     3   65245 use strict;
  3         6  
  3         109  
8 3     3   2294 use POE;
  3         145974  
  3         19  
9 3     3   244198 use POE::Framework::MIDI::POEConductor;
  3         10  
  3         313  
10 3     3   1866 use POE::Framework::MIDI::POEMusician;
  3         10  
  3         82  
11 3     3   2522 use POE::Framework::MIDI::Bar;
  3         9  
  3         192  
12 3     3   2161 use POE::Framework::MIDI::Note;
  3         9  
  3         92  
13 3     3   2527 use POE::Framework::MIDI::Rest;
  3         8  
  3         162  
14 3     3   4572 use Class::MethodMaker new_with_init => [ qw /new/] , get_set => qw/honk/;
  3         136337  
  3         29  
15             our $VERSION = 0.09;
16              
17             sub init {
18 2     2 0 107 my ( $self, %args ) = @_;
19 2         17 $self->{args} = \%args;
20 2 50       15 die "No filename set in data hashref" unless $args{data}->{filename};
21 2 50       69 die "No bar count set in data hashref" unless $args{data}->{bars};
22             }
23              
24             sub musicians {
25 0     0 0 0 my ($self,$new_musicians) = @_;
26 0 0 0     0 die "Non array-ref passed to musicians()" if (ref($new_musicians) and ref($new_musicians) ne 'ARRAY');
27 0 0       0 $new_musicians ? $self->{args}->{musicians} = $new_musicians
28             : return $self->{args}->{musicians};
29             }
30              
31             sub run {
32 2     2 0 2122 my $self = shift;
33 2         48 POE::Framework::MIDI::POEConductor->spawn({
34             debug => $self->{args}->{data}->{debug},
35             verbose => $self->{args}->{data}->{verbose},
36             bars => $self->{args}->{data}->{bars},
37             filename => $self->{args}->{data}->{filename},
38             musicians => $self->{args}->{musicians} });
39              
40             # $poe_kernel is exported by POE
41 2         12 $poe_kernel->run;
42              
43             }
44              
45             1;
46              
47              
48             __END__