File Coverage

blib/lib/App/SCM/Digest/SCM/Factory.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package App::SCM::Digest::SCM::Factory;
2              
3 7     7   46 use strict;
  7         14  
  7         200  
4 7     7   45 use warnings;
  7         15  
  7         277  
5              
6 7     7   1953 use App::SCM::Digest::SCM::Git;
  7         20  
  7         248  
7 7     7   3032 use App::SCM::Digest::SCM::Hg;
  7         23  
  7         508  
8              
9             sub new
10             {
11 12     12 1 44 my ($class, $name) = @_;
12              
13 12         80 my $pkg = 'App::SCM::Digest::SCM::'.(ucfirst (lc $name));
14 12         129 return $pkg->new();
15             }
16              
17             1;
18              
19             __END__
20              
21             =head1 NAME
22              
23             App::SCM::Digest::SCM::Factory
24              
25             =head1 DESCRIPTION
26              
27             Factory class for L<App::SCM::Digest::SCM> implementations.
28              
29             =head1 CONSTRUCTOR
30              
31             =over 4
32              
33             =item B<new>
34              
35             Takes an implementation name (e.g. 'git', 'hg') as its single
36             argument. Returns an instance of the specified implementation.
37              
38             =back
39              
40             =cut