line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
2
|
|
|
|
|
|
|
# modify it under the terms of the GNU General Public License as |
3
|
|
|
|
|
|
|
# published by the Free Software Foundation. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DBR::Record::Base; |
6
|
18
|
|
|
18
|
|
113
|
use strict; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
797
|
|
7
|
18
|
|
|
18
|
|
111
|
use Carp; |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
12609
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
################### |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# This package serves as a base class for all dynamically created record objects |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
################### |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This version of get is less efficient for fields that aren't prefetched, but much faster overall I think |
17
|
|
|
|
|
|
|
sub get{ |
18
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
19
|
0
|
0
|
|
|
|
|
wantarray?(map { $self->$_ } map { split(/\s+/,$_) } @_) : [ map { $self->$_ } map { split(/\s+/,$_) } @_ ]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub gethash{ |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my @fields = map { split(/\s+/,$_) } @_; |
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my %ret; |
27
|
0
|
|
|
|
|
|
@ret{@fields} = map { ($self->$_) } @fields; |
|
0
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
wantarray?( %ret ) : \%ret; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# sub set { |
32
|
|
|
|
|
|
|
# # helper $self, args |
33
|
|
|
|
|
|
|
# $_[0][1]->set($_[0],@_); |
34
|
|
|
|
|
|
|
# } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
0
|
|
sub next { croak "Can not call next on a record" } |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
0
|
|
sub TO_JSON { die "This part doesn't work yet" } #HERE - this needs work |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#sub DESTROY { print STDERR "RECORD DESTROY $_[0]\n"} |
41
|
|
|
|
|
|
|
1; |