File Coverage

lib/Sanger/CGP/Vcf/OutputGen/SequentialIdGenerator.pm
Criterion Covered Total %
branch n/a
subroutine 4 6 66.6
pod 0 3 0.0
total 4 9 44.4


line bran sub pod code
1       package Sanger::CGP::Vcf::OutputGen::SequentialIdGenerator;
2        
3       ##########LICENCE##########
4       # Copyright (c) 2014,2015 Genome Research Ltd.
5       #
6       # Author: Jon Hinton <cgpit@sanger.ac.uk>
7       #
8       # This file is part of cgpVcf.
9       #
10       # cgpVcf is free software: you can redistribute it and/or modify it under
11       # the terms of the GNU Affero General Public License as published by the Free
12       # Software Foundation; either version 3 of the License, or (at your option) any
13       # later version.
14       #
15       # This program is distributed in the hope that it will be useful, but WITHOUT
16       # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17       # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18       # details.
19       #
20       # You should have received a copy of the GNU Affero General Public License
21       # along with this program. If not, see <http://www.gnu.org/licenses/>.
22       #
23       # 1. The usage of a range of years within a copyright statement contained within
24       # this distribution should be interpreted as being equivalent to a list of years
25       # including the first and last year specified and all consecutive years between
26       # them. For example, a copyright statement that reads ‘Copyright (c) 2005, 2007-
27       # 2009, 2011-2012’ should be interpreted as being identical to a statement that
28       # reads ‘Copyright (c) 2005, 2007, 2008, 2009, 2011, 2012’ and a copyright
29       # statement that reads ‘Copyright (c) 2005-2012’ should be interpreted as being
30       # identical to a statement that reads ‘Copyright (c) 2005, 2006, 2007, 2008,
31       # 2009, 2010, 2011, 2012’."
32       ########## LICENCE ##########
33        
34   1   use Sanger::CGP::Vcf;
35        
36   1   use strict;
37   1   use warnings FATAL => 'all';
38        
39       1;
40        
41       sub new{
42   1 0 my $proto = shift;
43       my (%args) = @_;
44       my $class = ref($proto) || $proto;
45        
46       my $self = {
47       _counter => $args{'-start'} || 1,
48       };
49       bless $self, $class;
50       return $self;
51       }
52        
53       sub next{
54   0 0 return shift->{_counter}++;
55       }
56        
57       sub reset{
58   0 0 shift->{_counter} = shift;
59       }