File Coverage

blib/lib/X10/EventList.pm
Criterion Covered Total %
statement 9 38 23.6
branch 0 8 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 12 57 21.0


line stmt bran cond sub pod time code
1              
2             # Copyright (c) 1999-2017 Rob Fugina
3             # Distributed under the terms of the GNU Public License, Version 3.0
4              
5             package X10::EventList;
6              
7 1     1   5 use vars qw(@ISA);
  1         2  
  1         74  
8              
9 1     1   6 use Storable;
  1         1  
  1         71  
10              
11             @ISA = qw(Storable);
12              
13 1     1   7 use strict;
  1         2  
  1         349  
14              
15             sub new
16             {
17 0     0 0   my $type = shift;
18              
19 0           my $self = bless { list => [] }, $type;
20              
21 0           foreach (@_)
22             {
23 0 0         if (ref $_ eq 'X10::Event')
    0          
    0          
24             {
25 0           push @{$self->{list}}, $_;
  0            
26             }
27             elsif (ref $_ eq 'X10::EventList')
28             {
29 0           push @{$self->{list}}, $_->list;
  0            
30             }
31             elsif (ref $_ eq '')
32             {
33 0           push @{$self->{list}}, new X10::Event($_);
  0            
34             }
35             else
36             {
37 0           warn "Can't deal with a ", ref $_;
38             }
39             }
40              
41 0           @{$self->{list}} = grep { $_ } @{$self->{list}};
  0            
  0            
  0            
42              
43 0 0         return undef unless @{$self->{list}};
  0            
44              
45 0           return $self;
46             }
47              
48             sub as_string
49             {
50 0     0 0   my $self = shift;
51              
52 0           join(', ', map { $_->as_string } @{$self->{list}});
  0            
  0            
53             }
54              
55             sub list
56             {
57 0     0 0   my $self = shift;
58 0           @{$self->{list}};
  0            
59             }
60              
61             ###
62              
63             # build a string of words that implement this event
64             sub compile
65             {
66 0     0 0   my $self = shift;
67              
68 0           map { $_->compile } @{$self->{list}};
  0            
  0            
69             }
70              
71              
72             ###
73              
74              
75             1;
76