App/Chart/Series/Derived/Prev.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 51 CC 1 SCAR 6.9
CC
1
Cov
0%
longname
2.0
new
2.0
fill_part
2.0
CRAP 2.0
1 # Copyright 2008, 2009, 2010 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17 package App::Chart::Series::Derived::Prev;
18 use 5.008;
19 use strict;
20 use warnings;
21 use Locale::TextDomain ('App-Chart');
22  
23 use App::Chart::Database;
24 use App::Chart::TZ;
25 use base 'App::Chart::Series::Indicator';
26  
27 sub longname { __('Prev') }
28 *shortname = \&longname;
29  
30 use constant
31 { manual => undef,
32 type => 'special', # for programming mainly
33 priority => -1000,
34 parameter_info => [ { name => __('Days'),
35 key => 'prev_days',
36 type => 'integer',
37 minimum => 1,
38 default => 20 } ],
39 };
40  
41 sub new {
42 my ($class, $parent, $N) = @_;
43 my $p_timebase = $parent->timebase;
44 my $timebase = bless { %$p_timebase }, ref $p_timebase;
45 $timebase->{'base'} -= $N;
46  
47 return $class->SUPER::new
48 (timebase => $timebase,
49 N => $N,
50 parent => $parent,
51 arrays => $parent->{'arrays'},
52 array_aliases => $parent->{'array_aliases'});
53 }
54  
55 sub fill_part {
56 my ($self, $lo, $hi) = @_;
57 my $parent = $self->{'parent'};
58 $parent->fill ($lo, $hi);
59 }
60  
61 1;
62 __END__