| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# DESCRIPTION |
|
3
|
|
|
|
|
|
|
# PerlORM - Object relational mapper (ORM) for Perl. PerlORM is Perl |
|
4
|
|
|
|
|
|
|
# library that implements object-relational mapping. Its features are |
|
5
|
|
|
|
|
|
|
# much similar to those of Java's Hibernate library, but interface is |
|
6
|
|
|
|
|
|
|
# much different and easier to use. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# AUTHOR |
|
9
|
|
|
|
|
|
|
# Alexey V. Akimov |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# COPYRIGHT |
|
12
|
|
|
|
|
|
|
# Copyright (C) 2005-2006 Alexey V. Akimov |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
15
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
|
16
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
17
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
20
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
22
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
|
25
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
|
26
|
|
|
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package ORM::Base; |
|
30
|
|
|
|
|
|
|
|
|
31
|
3
|
|
|
3
|
|
62900
|
use Carp; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
1868
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$VERSION = 0.8; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my %require; |
|
36
|
|
|
|
|
|
|
my %loaded; |
|
37
|
|
|
|
|
|
|
my $active = 0; |
|
38
|
|
|
|
|
|
|
my $debug = 0; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub import |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
10
|
|
|
10
|
|
1341
|
my $class = shift; |
|
43
|
10
|
|
|
|
|
17
|
my $base = shift; |
|
44
|
10
|
|
|
|
|
28
|
my %arg = @_; |
|
45
|
10
|
|
|
|
|
21
|
my $derived = caller 0; |
|
46
|
10
|
|
|
|
|
15
|
my $i_am_active; |
|
47
|
|
|
|
|
|
|
|
|
48
|
10
|
100
|
|
|
|
33
|
unless( $active ) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
4
|
50
|
|
|
|
12
|
print STDERR "***** Start loading *****\n" if( $debug ); |
|
51
|
4
|
|
|
|
|
9
|
$active = 1; |
|
52
|
4
|
|
|
|
|
10
|
$i_am_active = 1; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
10
|
|
|
|
|
34
|
my $eval = "package $derived; use base $base; "; |
|
56
|
|
|
|
|
|
|
|
|
57
|
10
|
100
|
|
|
|
36
|
if( $arg{i_am_history} ) |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
2
|
|
|
|
|
5
|
$eval .= 'do \'ORM/History.pm\';'; |
|
60
|
2
|
|
|
|
|
6
|
$arg{history_is_enabled} = 0; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
3
|
|
|
3
|
|
20
|
eval $eval; |
|
|
3
|
|
|
3
|
|
5
|
|
|
|
3
|
|
|
2
|
|
1241
|
|
|
|
3
|
|
|
2
|
|
17
|
|
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
827
|
|
|
|
2
|
|
|
|
|
12
|
|
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
154
|
|
|
|
2
|
|
|
|
|
11
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
218
|
|
|
|
10
|
|
|
|
|
789
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
10
|
50
|
|
|
|
195
|
croak "Failed to load package $base\n$@" if( $@ ); |
|
66
|
10
|
|
|
|
|
31
|
$loaded{$base} = 1; |
|
67
|
10
|
|
|
|
|
28
|
$loaded{$derived} = 1; |
|
68
|
10
|
50
|
|
|
|
30
|
print STDERR " Loading class $derived\n" if( $debug ); |
|
69
|
|
|
|
|
|
|
|
|
70
|
10
|
|
|
|
|
91
|
my @require = $base->_derive( derived_class=>$derived, %arg ); |
|
71
|
9
|
100
|
66
|
|
|
98
|
if( $derived->_history_class && !$loaded{$derived->_history_class} ) |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
5
|
|
|
|
|
115
|
push @require, $derived->_history_class; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
9
|
|
|
|
|
120
|
for my $module ( @require ) |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
9
|
50
|
|
|
|
41
|
if( $loaded{$module} ) |
|
|
|
100
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
|
79
|
0
|
0
|
|
|
|
0
|
print STDERR " $derived requested $module (already loaded)\n" if( $debug ); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
elsif( $require{$module} ) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
1
|
50
|
|
|
|
5
|
print STDERR " $derived requested $module (already in queue)\n" if( $debug ); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
else |
|
86
|
|
|
|
|
|
|
{ |
|
87
|
8
|
50
|
|
|
|
26
|
print STDERR " $derived requested $module (queued)\n" if( $debug ); |
|
88
|
8
|
|
|
|
|
28
|
$require{$module} = 1; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
9
|
100
|
|
|
|
435
|
if( $i_am_active ) |
|
93
|
|
|
|
|
|
|
{ |
|
94
|
3
|
|
|
|
|
10
|
while( %require ) |
|
95
|
|
|
|
|
|
|
{ |
|
96
|
5
|
|
|
|
|
11
|
my $load; |
|
97
|
|
|
|
|
|
|
|
|
98
|
5
|
|
|
|
|
16
|
for my $module ( keys %require ) |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
7
|
|
|
|
|
14
|
$loaded{$module} = 1; |
|
101
|
7
|
|
|
|
|
27
|
$load .= "require $module; "; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
5
|
|
|
|
|
15
|
%require = (); |
|
105
|
5
|
50
|
|
|
|
16
|
print STDERR "Loading queued: $load\n" if( $debug ); |
|
106
|
5
|
|
|
|
|
1346
|
eval $load; |
|
107
|
5
|
50
|
|
|
|
71
|
croak "Failed to load packages: $load\n$@" if( $@ ); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
3
|
|
|
|
|
9
|
%loaded = (); |
|
110
|
3
|
|
|
|
|
6
|
$active = 0; |
|
111
|
3
|
50
|
|
|
|
252
|
print STDERR "***** Finish loading *****\n\n" if( $debug ); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |