]> git.donarmstrong.com Git - biopieces.git/blob - code_perl/Maasha/DB.pm
fixed seq qual length check
[biopieces.git] / code_perl / Maasha / DB.pm
1 package Maasha::DB;
2
3 # Copyright (C) 2009 Martin A. Hansen.
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 # http://www.gnu.org/copyleft/gpl.html
20
21
22 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
23
24
25 # Routines for manipulating DBM files.
26
27
28 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
29
30
31 use warnings;
32 use strict;
33 use Data::Dumper;
34 use Maasha::Common;
35 use DB_File;
36 use vars qw( @ISA @EXPORT );
37
38 @ISA = qw( Exporter );
39
40
41 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
42
43
44 sub db_open
45 {
46     # Martin A. Hansen, December 2009.
47
48     # Ties a hash to a DBM file and returns the hash.
49
50     my ( $path,   # path to DBM file
51        ) = @_;
52
53     # Returns a hash.
54
55     my ( %hash );
56
57     tie( %hash, 'DB_File', $path ) or Maasha::Common::error( qq(Could not tie-open file: "$path": $!) );
58
59     return wantarray ? %hash : \%hash;
60 }
61
62
63 sub db_close
64 {
65     # Martin A. Hansen, December 2009.
66
67     # Unties a hash tied to a DBM file.
68
69     my ( $db,   # hashref
70        ) = @_;
71
72     # Returns nothing.
73
74     untie %{ $db };
75 }
76
77
78 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
79
80
81 1;
82