File Coverage

blib/lib/FAQ/OMatic/Versions.pm
Criterion Covered Total %
statement 9 18 50.0
branch n/a
condition 0 5 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 30 40.0


line stmt bran cond sub pod time code
1             ##############################################################################
2             # The Faq-O-Matic is Copyright 1997 by Jon Howell, all rights reserved. #
3             # #
4             # This program is free software; you can redistribute it and/or #
5             # modify it under the terms of the GNU General Public License #
6             # as published by the Free Software Foundation; either version 2 #
7             # of the License, or (at your option) any later version. #
8             # #
9             # This program is distributed in the hope that it will be useful, #
10             # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12             # GNU General Public License for more details. #
13             # #
14             # You should have received a copy of the GNU General Public License #
15             # along with this program; if not, write to the Free Software #
16             # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#
17             # #
18             # Jon Howell can be contacted at: #
19             # 6211 Sudikoff Lab, Dartmouth College #
20             # Hanover, NH 03755-3510 #
21             # jonh@cs.dartmouth.edu #
22             # #
23             # An electronic copy of the GPL is available at: #
24             # http://www.gnu.org/copyleft/gpl.html #
25             # #
26             ##############################################################################
27              
28 1     1   6 use strict;
  1         2  
  1         39  
29              
30             ###
31             ### The Versions module is used by the installer and maintenance modules
32             ### to keep track of upgrade status.
33             ###
34              
35             package FAQ::OMatic::Versions;
36              
37 1     1   6206 use FAQ::OMatic;
  1         4  
  1         46  
38 1     1   7 use FAQ::OMatic::Item;
  1         2  
  1         255  
39              
40             sub getVersion {
41 0     0 0   my $property = shift;
42              
43 0           my $versionItem = new FAQ::OMatic::Item('versionFile',
44             $FAQ::OMatic::Config::metaDir);
45 0   0       return $versionItem->{$property} || '';
46             }
47              
48             sub setVersion {
49 0     0 0   my $property = shift;
50 0   0       my $version = shift || $FAQ::OMatic::VERSION;
51              
52 0           my $versionItem = new FAQ::OMatic::Item('versionFile',
53             $FAQ::OMatic::Config::metaDir);
54 0           $versionItem->setProperty('Title', "Versions Data File");
55 0           $versionItem->setProperty($property, $version);
56 0           $versionItem->saveToFile('versionFile',
57             $FAQ::OMatic::Config::metaDir);
58             }
59              
60             1;