File Coverage

blib/lib/Lingua/YaTeA/FileSet.pm
Criterion Covered Total %
statement 30 31 96.7
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod 6 6 100.0
total 46 48 95.8


line stmt bran cond sub pod time code
1             package Lingua::YaTeA::FileSet;
2 5     5   1555 use Lingua::YaTeA::File;
  5         10  
  5         49  
3 5     5   110 use strict;
  5         10  
  5         75  
4 5     5   20 use warnings;
  5         8  
  5         1409  
5              
6             our $VERSION=$Lingua::YaTeA::VERSION;
7              
8             sub new
9             {
10 11     11 1 37 my ($class,$repository) = @_;
11 11         23 my $this = {};
12 11         16 bless ($this,$class);
13 11         38 $this->{REPOSITORY} = $repository;
14 11         19 $this->{FILES} = ();
15 11         37 return $this;
16             }
17              
18              
19             sub checkRepositoryExists
20             {
21 8     8 1 16 my ($this) = @_;
22 8 50       16 if (! -d $this->getRepository)
23             {
24 0         0 die "No such repository :" . $this->getRepository . "\n";
25             }
26             else
27             {
28 8         31 print STDERR "Data will be loaded from: ". $this->getRepository . "\n";
29             }
30             }
31              
32             sub addFile
33             {
34 70     70 1 119 my ($this,$repository,$name) = @_;
35 70         83 my $file;
36             my $option;
37            
38 70         163 $file = Lingua::YaTeA::File->new($repository,$name);
39            
40 70         138 $this->{FILES}->{$file->getInternalName} = $file;
41             }
42              
43             sub getFile
44             {
45 52     52 1 103 my ($this,$name) = @_;
46 52         198 return $this->{FILES}->{$name};
47             }
48              
49             sub addFiles
50             {
51 4     4 1 10 my ($this,$repository,$file_name_a) = @_;
52 4         7 my $name;
53 4         11 foreach $name (@$file_name_a)
54             {
55 36         53 $this->addFile($repository,$name);
56             }
57             }
58              
59             sub getRepository
60             {
61 24     24 1 37 my ($this) = @_;
62 24         485 return $this->{REPOSITORY} ;
63             }
64              
65             1;
66              
67             __END__