File Coverage

blib/lib/Class/Prevayler/FileCounter.pm
Criterion Covered Total %
statement 23 33 69.7
branch 0 2 0.0
condition n/a
subroutine 7 10 70.0
pod 0 3 0.0
total 30 48 62.5


line stmt bran cond sub pod time code
1              
2             package Class::Prevayler::FileCounter;
3 1     1   5 use strict;
  1         1  
  1         33  
4 1     1   5 use warnings;
  1         2  
  1         26  
5 1     1   4 use Carp;
  1         2  
  1         55  
6              
7             BEGIN {
8 1     1   5 use Exporter ();
  1         2  
  1         21  
9 1     1   5 use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
  1         1  
  1         151  
10 1     1   1074 $VERSION = 0.02;
11 1         17 @ISA = qw (Exporter);
12              
13             #Give a hoot don't pollute, do not export more than needed by default
14 1         3 @EXPORT = qw ();
15 1         2 @EXPORT_OK = qw ();
16 1         341 %EXPORT_TAGS = ();
17             use Class::MethodMaker
18 1         9 new_with_init => 'new',
19             new_hash_init => 'hash_init',
20 1     1   6 get_set => [ 'next_logfile_number', ];
  1         1  
21             }
22              
23             ########################################### main pod documentation begin ##
24             # Below is the stub of documentation for your module. You better edit it!
25              
26             =head1 NAME
27              
28             Class::Prevayler::FileCounter - Prevayler implementation - www.prevayler.org
29              
30              
31             =head1 DESCRIPTION
32              
33             this class is an internal part of the Class::Prevayler module.
34              
35             =head1 AUTHOR
36              
37             Nathanael Obermayer
38             CPAN ID: nathanael
39             natom-pause@smi2le.net
40             http://a.galaxy.far.far.away/modules
41              
42             =head1 COPYRIGHT
43              
44             This program is free software; you can redistribute
45             it and/or modify it under the same terms as Perl itself.
46              
47             The full text of the license can be found in the
48             LICENSE file included with this module.
49              
50              
51             =head1 SEE ALSO
52              
53             Class::Prevayler
54              
55             =cut
56              
57             sub init {
58 0     0 0   my $self = shift;
59 0           my %values = (@_);
60 0           $self->hash_init(%values);
61 0 0         ( $self->next_logfile_number )
62             or croak "need the next number!";
63 0           return;
64             }
65              
66             sub reserve_number_for_command {
67 0     0 0   my ($self) = @_;
68              
69 0           return $self->next_logfile_number();
70             }
71              
72             sub reserve_number_for_snapshot {
73 0     0 0   my ($self) = @_;
74              
75 0           $self->next_logfile_number( $self->next_logfile_number + 2 );
76 0           return $self->next_logfile_number - 1;
77             }
78              
79             1; #this line is important and will help the module return a true value
80             __END__