| 1 | # CRUD.pm | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # by Bill Weinman -- Database CRUD | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (c) 1995-2008 The BearHeart Group, LLC | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # based upon the old bwDB.pm | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Note bene: CRUD is Create, Retrieve, Update, and Delete | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # See POD for History | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | package BW::DB::CRUD; | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Digest::MD5; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use BW::Constants; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use base qw( BW::DB BW::Base ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our $VERSION = "0.10"; | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # _setter_getter entry points | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub id_type { BW::Base::_setter_getter(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | ### main crud methods | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | # sub getrec( table, id, options ... ) | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # caching getrec | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # options: | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # refresh -- force refresh of cache from database | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||||||||||||||||||
| 32 | sub getrec | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getrec: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $sn = 'getrec'; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my $t = shift or return $self->_error("$sn: no table name"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $id = shift or return $self->_error("$sn: no id"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my $opt = shift || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $rc; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $cache = $self->{db_cache}{$t}{$id}; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ( $cache and @$cache and $opt ne 'refresh' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$cache and @$cache and $opt ne "refresh"
$cache and @$cache
MC/DC0%0/3
$cache and @$cache and $opt ne "refresh"
$cache
@$cache
$opt ne "refresh"
Truth table0%0/4
A and B and C
A= $cacheB= @$cacheC= $opt ne "refresh"
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $cache; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $rc = $self->get( $t, "${t}_id", $id ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | return $self->{db_cache}{$t}{$id} = $rc if $rc and @$rc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rc and @$rc
MC/DC0%0/2
$rc and @$rc
$rc
@$rc
Truth table0%0/3
A and B
A= $rcB= @$rc
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return VOID; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | # sub putrec( table, id, rechash ) | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # caching update and insert | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # old records will be updated based on id or rechash->{table_id} | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # new records will be inserted with id or a new id | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # | ||||||||||||||||||||||||||||||||||||||||||
| 59 | sub putrec | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putrec: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $sn = 'putrec'; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $t = shift or return $self->_error("$sn: no table name"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $id = shift || ''; # can be blank for new recs | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | my $rechash = shift or return $self->_error("$sn no rechash"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $table_id = $t . '_id'; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ( $rechash->{$table_id} and !$id ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rechash->{$table_id} and not $id
MC/DC0%0/2
$rechash->{$table_id} and not $id
$rechash->{$table_id}
not $id
Truth table0%0/3
A and not(B)
A= $rechash->{$table_id}B= not $id
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $id = $rechash->{$table_id}; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ( $id and $self->getrec( $t, $id ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$id and $self->getrec($t, $id)
MC/DC0%0/2
$id and $self->getrec($t, $id)
$id
$self->getrec($t, $id)
Truth table0%0/3
A and B
A= $idB= $self->getrec($t, $id)
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | $self->update( $t, $table_id, $id, $rechash ) or return FAILURE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $id = $rechash->{$table_id} = $self->gen_id unless $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $self->insert( $t, $rechash ) or return FAILURE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | return $self->{db_cache}{$t}{$id} = $rechash; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # sub delrec( table, id ) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # caching delete | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||||||||||||||||
| 86 | sub delrec | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delrec: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $sn = 'delrec'; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | my $t = shift or return $self->_error("$sn: no table name"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $id = shift || ''; # can be blank for new recs | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | # delete from cache | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | delete $self->{db_cache}{$t}{$id} if $self->{db_cache}{$t}{$id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | # delete from db | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $self->delete( $t, $t . '_id', $id ); | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | # delete ( table, key, value ) | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # returns TRUE or FALSE | ||||||||||||||||||||||||||||||||||||||||||
| 102 | sub delete | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | my $table = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my $key = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | my $value = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $self->sql_connect unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | return $self->_error("Database not connected.") unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $query = "DELETE FROM $table WHERE $key = ?"; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return $self->sql_do( $query, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # get ( table, key, value ) | ||||||||||||||||||||||||||||||||||||||||||
| 117 | # returns hashref (from DBI) or FALSE | ||||||||||||||||||||||||||||||||||||||||||
| 118 | sub get | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $sn = 'get'; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my ( $self, $table, $key, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $self->sql_connect unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | return $self->_error("Database not connected.") unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $query = "SELECT * FROM $table WHERE $key = ?"; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $self->sql_select( $query, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | # search | ||||||||||||||||||||||||||||||||||||||||||
| 131 | # alias for search_multi -- legacy support for a while | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub search { return search_multi(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | # search_multi ( table, key, value ) | ||||||||||||||||||||||||||||||||||||||||||
| 135 | # returns arrayref of hashes | ||||||||||||||||||||||||||||||||||||||||||
| 136 | # use for non-unique keys | ||||||||||||||||||||||||||||||||||||||||||
| 137 | sub search_multi | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search_multi: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my $table = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my $key = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $value = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $self->sql_connect unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | return $self->_error("Database not connected.") unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $query = "SELECT * FROM $table WHERE $key LIKE ? ORDER BY $key"; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return $self->sql_select( $query, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | # update ( table, key, value, { name => value, ... } ) | ||||||||||||||||||||||||||||||||||||||||||
| 152 | sub update | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $sn = 'update'; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my $table = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $key = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | my $value = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | my $nvpairs = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my @cols; | |||||||||||||||||||||||||||||||||||||||||
| 161 | my @vals; | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | $self->sql_connect unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | return $self->_error("Database not connected.") unless $self->{dbh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | foreach my $k ( keys %{$nvpairs} ) { | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | push @cols, "$k = ?"; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | push @vals, $nvpairs->{$k}; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | return undef unless ( @cols and @vals ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@cols and @vals
MC/DC0%0/2
@cols and @vals
@cols
@vals
Truth table0%0/3
A and B
A= @colsB= @vals
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $query = "UPDATE $table SET " . join( ', ', @cols ) . " WHERE $key = ?"; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | push @vals, $value; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | return $self->sql_do( $query, @vals ); | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | ### nv routines | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | # setnv ( object_type, object_id, name, value, attribute, flags, seq ) | ||||||||||||||||||||||||||||||||||||||||||
| 181 | # requires a table named "nv" | ||||||||||||||||||||||||||||||||||||||||||
| 182 | sub setnv | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setnv: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $sn = 'setnv'; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my ( $t, $id, $n, $v, $a, $f, $s ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | return $self->_error("$sn: missing object type") unless $t; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | return $self->_error("$sn: missing object id") unless $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | return $self->_error("$sn: missing name") unless $n; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | return $self->_error("$sn: missing value") unless $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $rec = { | |||||||||||||||||||||||||||||||||||||||||
| 193 | object_type => $t, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | object_id => $id, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | name => $n, | ||||||||||||||||||||||||||||||||||||||||||
| 196 | value => $v | ||||||||||||||||||||||||||||||||||||||||||
| 197 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $rec->{attribute} = $a if $a; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $rec->{flags} = $f if $f; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $rec->{seq} = $s if $s; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $rc = $self->putrec( 'nv', undef, $rec ); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if ( $rc->{nv_id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $rc->{nv_id}; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return $self->{FALSE}; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | # getnv ( t, id, n ) | ||||||||||||||||||||||||||||||||||||||||||
| 212 | # returns hash of first rec found | ||||||||||||||||||||||||||||||||||||||||||
| 213 | # if no n, error | ||||||||||||||||||||||||||||||||||||||||||
| 214 | sub getnv | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getnv: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $sn = 'getnv'; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my ( $t, $id, $n ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | return $self->_error("$sn: missing object type") unless $t; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | return $self->_error("$sn: missing object id") unless $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | return $self->_error("$sn: missing object name") unless $n; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return $self->sql_select( | |||||||||||||||||||||||||||||||||||||||||
| 224 | qq{ | ||||||||||||||||||||||||||||||||||||||||||
| 225 | SELECT * FROM nv WHERE object_type = ? AND object_id = ? AND name = ? | ||||||||||||||||||||||||||||||||||||||||||
| 226 | }, $t, $id, $n | ||||||||||||||||||||||||||||||||||||||||||
| 227 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | # searchnv ( t, id, name, value, attribute ) | ||||||||||||||||||||||||||||||||||||||||||
| 231 | # returns arrayref of hashes { keys: nv_id, object_type, object_id, name, value } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | # if no n, returns all nvs for t, id | ||||||||||||||||||||||||||||||||||||||||||
| 233 | sub searchnv | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
searchnv: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $sn = 'searchnv'; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my ( $t, $id, $n, $v, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | return $self->_error("$sn: missing object type") unless $t; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | return $self->_error("$sn: missing object id") unless $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | return $self->_error("$sn: missing nv name") unless $n; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $sql = qq{ SELECT * FROM nv WHERE object_type = ? AND object_id = ? AND name = ? }; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my @nvp = ( $t, $id, $n ); | |||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ($v) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $sql .= qq{ AND value = ? }; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | push( @nvp, $v ); | |||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ($a) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $sql .= qq{ AND attribute = ? }; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | push( @nvp, $a ); | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $sql .= qq{ ORDER BY seq }; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | return $self->sql_select( $sql, @nvp ); | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | # updnv ( nv_id, value, attribute ) | ||||||||||||||||||||||||||||||||||||||||||
| 262 | # updates rec with new v | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # returns TRUE (success) or FALSE (failure) | ||||||||||||||||||||||||||||||||||||||||||
| 264 | sub updnv | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updnv: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $sn = 'updnv'; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my ( $nv_id, $v, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $rec; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | return $self->_error("$sn: missing nv_id") unless $nv_id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | return $self->_error("$sn: missing value") unless $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | return $self->_error("$sn: nv $nv_id not found") unless $rec = $self->getrec( 'nv', $nv_id ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | $rec->{value} = $v if $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $rec->{attribute} = $a if $a; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | return $self->putrec( 'nv', $nv_id, $rec ); | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | # delnv ( nv_id ) | ||||||||||||||||||||||||||||||||||||||||||
| 282 | # deletes nv rec | ||||||||||||||||||||||||||||||||||||||||||
| 283 | sub delnv | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delnv: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $sn = 'delnv'; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | my $nv_id = shift or return $self->_error("$sn: no nv_id"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return $self->delrec( 'nv', $nv_id ); | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | ### utilty routines | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | # return a list of fields for a given table | ||||||||||||||||||||||||||||||||||||||||||
| 295 | sub fields_list | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fields_list: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | my $table_name = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $fields_list; | |||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | return $fields_list if ( $fields_list = $self->{fields_cache}{$table_name} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $query = " SHOW COLUMNS from $table_name "; # this is likely mysql-specific | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $fields_list = $self->{dbh}->selectcol_arrayref( $query, { Columns => [1] } ); | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->{fields_cache}{$table_name} = $fields_list; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | return $fields_list || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$fields_list || undef
MC/DC0%0/1
$fields_list || undef
$fields_list
Truth table0%0/2
A
A= $fields_list
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | sub gen_id | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_id: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | my $id_type = $self->id_type || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->id_type || ''
MC/DC0%0/1
$self->id_type || ''
$self->id_type
Truth table0%0/2
A
A= $self->id_type
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | if ( $id_type eq 'base64' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | return $self->gen_id_base64; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | return $self->gen_id_md5hash; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | sub gen_id_md5hash | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_id_md5hash: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | return $self->md5hash(); | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | sub gen_id_base64 | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_id_base64: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | my $self = shift or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | return $self->md5base64(); | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | sub md5base64 # returns a url-safe base-64 MD5 hash for use as an ID field | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
md5base64: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ( $self, $parm ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | $parm = 'unk' unless $parm; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my $r = Digest::MD5::md5_base64( $$, time, rand, $parm ); | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | $r =~ tr|+/|!-|; # '+' and '/' chars are nasty for URLs | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | sub md5hash | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
md5hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | return Digest::MD5::md5_hex( $$, time, rand ); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | BW::DB::CRUD - Database CRUD | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | Database CRUD: (C)reate, (R)etrieve, (U)pdate, (D)elete | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | use BW::DB::CRUD; | ||||||||||||||||||||||||||||||||||||||||||
| 357 | my $o = BW::DB::CRUD->new; | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | =item B<new>( ) | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | Constructs a new BW::DB::CRUD object. | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | Returns a blessed BW::DB::CRUD object reference. | ||||||||||||||||||||||||||||||||||||||||||
| 368 | Returns undef (VOID) if the object cannot be created. | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | =item B<error> | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | Returns and clears the object error message. | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | =head1 WARNING | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | This module is currently in an unfinished state. Do not use this | ||||||||||||||||||||||||||||||||||||||||||
| 379 | for new projects. The interface WILL change. | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | Written by Bill Weinman E<lt>http://bw.org/E<gt>. | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | Copyright (c) 1995-2010 The BearHeart Group, LLC | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | =head1 HISTORY | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 2010-02-17 bw -- first CPAN version - not ready for prime time! | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 2008-03-27 bw -- cleanup for publishing | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 2007-10-21 bw -- fixed a caching bug in getrec | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 2007-10-19 bw -- initial version. | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||