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
|
|
968824
|
use 5.008; |
|
19
|
|
|
|
|
168
|
|
7
|
19
|
|
|
19
|
|
99
|
use warnings; |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
531
|
|
8
|
19
|
|
|
19
|
|
97
|
use strict; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
484
|
|
9
|
19
|
|
|
19
|
|
8385
|
use version; |
|
19
|
|
|
|
|
36559
|
|
|
19
|
|
|
|
|
112
|
|
10
|
19
|
|
|
19
|
|
9047
|
use MRO::Compat; |
|
19
|
|
|
|
|
30397
|
|
|
19
|
|
|
|
|
658
|
|
11
|
19
|
|
|
19
|
|
9589
|
use DBIx::DataModel::Meta::Utils qw/does/; |
|
19
|
|
|
|
|
153
|
|
|
19
|
|
|
|
|
1544
|
|
12
|
19
|
|
|
19
|
|
138
|
use Carp::Clan qw[^(DBIx::DataModel::|SQL::Abstract)]; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
87
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '3.05'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# compatibility setting : see import() |
17
|
|
|
|
|
|
|
our $COMPATIBILITY = $VERSION; # from 2.20, no longer automatic compatibility |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
118
|
|
|
118
|
|
563
|
my ($class, %args) = @_; |
21
|
118
|
100
|
|
|
|
471
|
if (exists $args{-compatibility}) { |
22
|
|
|
|
|
|
|
$COMPATIBILITY = $args{-compatibility} # explicit number |
23
|
8
|
|
66
|
|
|
46
|
|| $VERSION; # undef : means no compatibility |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
require DBIx::DataModel::Compatibility::V1 |
27
|
118
|
100
|
|
|
|
7279
|
if version->parse($COMPATIBILITY) < version->parse("1.99"); |
28
|
|
|
|
|
|
|
require DBIx::DataModel::Compatibility::V0 |
29
|
118
|
50
|
|
|
|
4809
|
if version->parse($COMPATIBILITY) < version->parse("1.00"); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub define_schema { |
34
|
22
|
|
|
22
|
0
|
1210
|
my ($class, %params) = @_; |
35
|
|
|
|
|
|
|
|
36
|
22
|
|
|
|
|
5867
|
require DBIx::DataModel::Meta::Schema; |
37
|
22
|
|
|
|
|
161
|
my $meta_schema = DBIx::DataModel::Meta::Schema->new(%params); |
38
|
20
|
|
|
|
|
81
|
return $meta_schema; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub Schema { # syntactic sugar for ->define_schema() |
42
|
13
|
|
|
13
|
1
|
1071080
|
my $class = shift; |
43
|
13
|
|
|
|
|
35
|
my $schema_class_name = shift; |
44
|
13
|
100
|
66
|
|
|
147
|
my %params = scalar(@_) == 1 && does($_[0], 'HASH') ? %{$_[0]} : @_; |
|
10
|
|
|
|
|
227
|
|
45
|
13
|
|
|
|
|
85
|
my $meta_schema = $class->define_schema(class => $schema_class_name, %params); |
46
|
12
|
|
|
|
|
74
|
return $meta_schema->class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; # End of DBIx::DataModel |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |