File Coverage

blib/lib/POE/Framework/MIDI/Rule.pm
Criterion Covered Total %
statement 14 21 66.6
branch 3 10 30.0
condition 2 3 66.6
subroutine 3 7 42.8
pod 4 5 80.0
total 26 46 56.5


line stmt bran cond sub pod time code
1             # $Id: Rule.pm,v 1.1.1.1 2004/11/22 17:52:11 root Exp $
2              
3             package POE::Framework::MIDI::Rule;
4 3     3   222582 use strict;
  3         6  
  3         126  
5 3     3   17 use vars qw($VERSION); $VERSION = '0.02';
  3         6  
  3         1207  
6              
7             sub new {
8 5     5 1 2758 my ($self, $class) = ({}, shift);
9 5         29 bless $self, $class;
10 5         20 my %params = @_;
11              
12 5 50       45 $self->{cfg} = \%params or die __PACKAGE__ . ' needs some config info';
13              
14 5 50       22 die "no context set" unless $self->{cfg}{context};
15 5 50 66     48 die "invalid context $self->{cfg}->{context}"
16             unless ($self->{cfg}->{context} eq 'bar' or $self->{cfg}->{context} eq 'event');
17              
18 5         14 $self->{params} = $self->{cfg}{params};
19              
20 5         24 return $self;
21             }
22              
23             sub usage {
24 0     0 1   return 'Oh dear. TODO: What does usage look like?';
25             }
26              
27             # just in case we want to support on the fly context changes...
28             sub context {
29 0     0 1   my ($self, $new_context) = @_;
30              
31 0 0         $new_context
32             ? $self->{cfg}{context} = $new_context
33             : return $self->{cfg}{context};
34             }
35              
36             sub type {
37 0     0 0   my ($self, $new_type) = @_;
38              
39 0 0         $new_type
40             ? $self->{cfg}{type} = $new_type
41             : return $self->{cfg}{type};
42             }
43              
44             sub params {
45 0     0 1   my $self = shift;
46 0           return $self->{cfg}{params};
47             }
48              
49             1;
50              
51             __END__