line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package DBIx::DataModel; |
3
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
4
|
|
|
|
|
|
|
# see POD doc at end of file |
5
|
|
|
|
|
|
|
|
6
|
19
|
|
|
19
|
|
971774
|
use 5.008; |
|
19
|
|
|
|
|
182
|
|
7
|
19
|
|
|
19
|
|
112
|
use warnings; |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
561
|
|
8
|
19
|
|
|
19
|
|
124
|
use strict; |
|
19
|
|
|
|
|
32
|
|
|
19
|
|
|
|
|
462
|
|
9
|
19
|
|
|
19
|
|
8273
|
use version; |
|
19
|
|
|
|
|
36988
|
|
|
19
|
|
|
|
|
116
|
|
10
|
19
|
|
|
19
|
|
8882
|
use MRO::Compat; |
|
19
|
|
|
|
|
30960
|
|
|
19
|
|
|
|
|
613
|
|
11
|
19
|
|
|
19
|
|
9347
|
use DBIx::DataModel::Meta::Utils qw/does/; |
|
19
|
|
|
|
|
187
|
|
|
19
|
|
|
|
|
1586
|
|
12
|
19
|
|
|
19
|
|
134
|
use Carp::Clan qw[^(DBIx::DataModel::|SQL::Abstract)]; |
|
19
|
|
|
|
|
45
|
|
|
19
|
|
|
|
|
93
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '3.04'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# compatibility setting : see import() |
17
|
|
|
|
|
|
|
our $COMPATIBILITY = $VERSION; # from 2.20, no longer automatic compatibility |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
118
|
|
|
118
|
|
608
|
my ($class, %args) = @_; |
21
|
118
|
100
|
|
|
|
444
|
if (exists $args{-compatibility}) { |
22
|
|
|
|
|
|
|
$COMPATIBILITY = $args{-compatibility} # explicit number |
23
|
8
|
|
66
|
|
|
44
|
|| $VERSION; # undef : means no compatibility |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
require DBIx::DataModel::Compatibility::V1 |
27
|
118
|
100
|
|
|
|
7195
|
if version->parse($COMPATIBILITY) < version->parse("1.99"); |
28
|
|
|
|
|
|
|
require DBIx::DataModel::Compatibility::V0 |
29
|
118
|
50
|
|
|
|
4765
|
if version->parse($COMPATIBILITY) < version->parse("1.00"); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub define_schema { |
34
|
22
|
|
|
22
|
0
|
94
|
my ($class, %params) = @_; |
35
|
|
|
|
|
|
|
|
36
|
22
|
|
|
|
|
5815
|
require DBIx::DataModel::Meta::Schema; |
37
|
22
|
|
|
|
|
158
|
my $meta_schema = DBIx::DataModel::Meta::Schema->new(%params); |
38
|
20
|
|
|
|
|
83
|
return $meta_schema; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub Schema { # syntactic sugar for ->define_schema() |
42
|
13
|
|
|
13
|
1
|
1071494
|
my $class = shift; |
43
|
13
|
|
|
|
|
39
|
my $schema_class_name = shift; |
44
|
13
|
100
|
66
|
|
|
144
|
my %params = scalar(@_) == 1 && does($_[0], 'HASH') ? %{$_[0]} : @_; |
|
10
|
|
|
|
|
228
|
|
45
|
13
|
|
|
|
|
82
|
my $meta_schema = $class->define_schema(class => $schema_class_name, %params); |
46
|
12
|
|
|
|
|
65
|
return $meta_schema->class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; # End of DBIx::DataModel |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |