File Coverage

blib/lib/POE/Framework/MIDI/Bar.pm
Criterion Covered Total %
statement 25 25 100.0
branch 3 4 75.0
condition n/a
subroutine 8 8 100.0
pod 0 5 0.0
total 36 42 85.7


line stmt bran cond sub pod time code
1             # $Id: Bar.pm,v 1.2 2004/12/04 18:08:17 stv Exp $
2              
3             package POE::Framework::MIDI::Bar;
4              
5 6     6   408206 use strict;
  6         13  
  6         285  
6 6     6   34 use vars '$VERSION'; $VERSION = '0.02';
  6         10  
  6         316  
7 6     6   3492 use POE::Framework::MIDI::Utility;
  6         14  
  6         2801  
8              
9             sub new {
10              
11 60     60 0 867 my ( $self, $class ) = ( {}, shift );
12 60         150 bless $self, $class;
13 60         141 my %params = @_;
14 60         149 $self->{cfg} = \%params;
15 60 100       192 warn 'please provide a value for the number => $n parameter when generating bars'
16             unless $self->{cfg}->{number};
17 60         174 return $self;
18             }
19              
20             sub number {
21 265     265 0 265 my $self = shift;
22 265         572 return $self->{cfg}->{number};
23             }
24              
25              
26             # return the stack of notes/rests/intervals
27             sub events {
28 58     58 0 73 my ( $self, $new_events ) = @_;
29 58 50       207 $new_events ? $self->{events} = $new_events : return $self->{events}
30             }
31              
32             sub add_event {
33 17     17 0 57 my ( $self, $event ) = @_;
34 17         29 push @{$self->{events}}, $event;
  17         61  
35             }
36              
37             sub add_events {
38 43     43 0 290 my ( $self, @events ) = @_;
39 43         48 push @{$self->{events}}, @events;
  43         271  
40             }
41              
42             1;
43              
44             __END__