File Coverage

blib/lib/Seshat/Parallel.pm
Criterion Covered Total %
statement 9 34 26.4
branch 0 6 0.0
condition n/a
subroutine 3 7 42.8
pod n/a
total 12 47 25.5


line stmt bran cond sub pod time code
1             package Seshat::Parallel;
2              
3 1     1   1060 use strict;
  1         3  
  1         46  
4 1     1   5 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
  1         2  
  1         223  
5 1     1   1320 use Data::Dumper;
  1         22038  
  1         881  
6              
7             require Exporter;
8             require AutoLoader;
9             require Seshat;
10              
11              
12             @ISA = qw(Exporter AutoLoader);
13             # Items to export into callers namespace by default. Note: do not export
14             # names by default without a very good reason. Use EXPORT_OK instead.
15             # Do not simply export all your public functions/methods/constants.
16             @EXPORT = qw(
17            
18             );
19             $VERSION = '1.01';
20              
21             sub new {
22 0     0     my ($classname,$files) = @_;
23 0           my $self = {};
24 0           foreach (@$files) {
25 0           $self->{files}->{$_} = Seshat->new($_);
26             }
27 0           $self->{NAME} = "Seshat::Parallel";
28 0           bless ($self,$classname);
29 0           return $self;
30             }
31             sub write {
32 0     0     my ($self, $string, $flag) = @_;
33 0           foreach ( keys %{$self->{files}} ) {
  0            
34 0           my $lh = $self->{files}->{$_};
35 0           my $res = $lh->write($string,$flag);
36 0 0         warn "$@" unless $res;
37             }
38             }
39             sub register {
40 0     0     my ($self, $filename) = @_;
41 0 0         if (! exists $self->{files}->{$filename}) {
42 0           $self->{files}->{$filename} = Seshat->new($filename);
43             } else {
44 0           $@ = "The requested file is already in queue";
45 0           return undef;
46             }
47 0           return 1;
48             }
49             sub unregister {
50 0     0     my ($self, $filename) = @_;
51 0 0         if (exists $self->{files}->{$filename}) {
52 0           delete $self->{files}->{$filename};
53             } else {
54 0           $@ = "The requested file is not in queue";
55 0           return undef;
56             }
57 0           return 1;
58             }
59              
60             1;
61             __END__