|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package DBIx::Class::ResultDDL::SchemaLoaderMixin;  | 
| 
2
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
660190
 | 
 use strict;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
    | 
| 
3
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
5
 | 
 use warnings;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
40
 | 
    | 
| 
4
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
7
 | 
 use List::Util 'max', 'all';  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
75
 | 
    | 
| 
5
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
596
 | 
 use DBIx::Class::ResultDDL;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
6
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
108
 | 
 use Carp;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
77
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub deparse; #local utilities to be cleaned from the namespace  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub deparse_hashkey;  | 
| 
9
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
10
 | 
 use namespace::clean;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: Modify Schema Loader to generate ResultDDL notation  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '2.04'; # VERSION  | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #sub _write_classfile {  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   my ($self, $class, $text, $is_schema)= @_;  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   main::explain($class);  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   main::explain($text);  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   main::explain($self->{_dump_storage}{$class});  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   $self->next::method($class, $text, $is_schema);  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #}  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub generate_resultddl_import_line {  | 
| 
24
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
  
1
  
 | 
39
 | 
 	qq|use DBIx::Class::ResultDDL qw/ -V2 /;\n|  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub generate_column_info_sugar {  | 
| 
29
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
  
1
  
 | 
260
 | 
 	my ($self, $class, $col_name, $orig_col_info)= @_;  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
68
 | 
 	my $checkpkg= $self->_get_class_check_namespace($class);  | 
| 
32
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
83
 | 
 	my $class_settings= DBIx::Class::ResultDDL::_settings_for_package($checkpkg);  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
34
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
114
 | 
 	my %col_info= %$orig_col_info;  | 
| 
35
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
64
 | 
 	my $stmt= _get_data_type_sugar(\%col_info, $class_settings);  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	$stmt .= ' null'  | 
| 
37
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
75
 | 
 		if delete $col_info{is_nullable};  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	$stmt .= ' default('.deparse(delete $col_info{default_value}).'),'  | 
| 
39
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
67
 | 
 		if exists $col_info{default_value};  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# add sugar for inflate_json if the serializer class is JSON, but not if the package feature inflate_json  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# was enabled and the column type is flagged as json.  | 
| 
42
 | 
20
 | 
  
 50
  
 | 
  
 50
  
 | 
 
 | 
 
 | 
135
 | 
 	$stmt .= ' inflate_json' if 'JSON' eq ($col_info{serializer_class}||'');  | 
| 
43
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
76
 | 
 	$stmt .= ' fk' if delete $col_info{is_foreign_key};  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# Test the syntax for equality to the original  | 
| 
46
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
 	my $out;  | 
| 
47
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1937
 | 
 	eval "package $checkpkg; \$out= DBIx::Class::ResultDDL::expand_col_options(\$checkpkg, $stmt);";  | 
| 
48
 | 
20
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
121
 | 
 	defined $out or croak "Error verifying generated ResultDDL for $class $col_name: $@";  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
50
 | 
20
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
60
 | 
 	if ($out->{'extra.unsigned'}) {  | 
| 
51
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		$out->{extra}{unsigned}= delete $out->{'extra.unsigned'};  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# Ignore the problem where 'integer' generates a default size for mysql that wasn't  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# in the Schema Loader spec.  TODO: add an option to skip generating this.  | 
| 
56
 | 
20
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
84
 | 
 	delete $out->{size} if $out->{size} && !$orig_col_info->{size};  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# Data::Dumper gets confused and thinks sizes need quoted  | 
| 
59
 | 
20
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
111
 | 
 	if (defined $orig_col_info->{size} && $orig_col_info->{size} =~ /^[0-9]+$/) {  | 
| 
60
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
 		$orig_col_info->{size}= 0 + $orig_col_info->{size};  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
63
 | 
20
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
116
 | 
 	if (deparse({ %col_info, %$out }) eq deparse({ %$orig_col_info })) {  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# Any field in %$out removes the need to have it in $col_info.  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# This happens with implied options like serializer_class => 'JSON'  | 
| 
66
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
94
 | 
 		for (keys %col_info) {  | 
| 
67
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
24
 | 
 			delete $col_info{$_} if exists $out->{$_};  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# remove trailing comma  | 
| 
70
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
67
 | 
 		$stmt =~ s/,\s*$//;  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# dump the rest, and done.  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$stmt .= ', '.&_deparse_hashkey.' => '.deparse($col_info{$_})  | 
| 
73
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
62
 | 
 			for sort keys %col_info;  | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
75
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	else {  | 
| 
76
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		warn "Unable to use ResultDDL sugar '$stmt'\n  "  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			.deparse({ %col_info, %$out })." ne ".deparse($orig_col_info)."\n";  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$stmt= join(', ',  | 
| 
79
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			map &_deparse_hashkey.' => '.deparse($orig_col_info->{$_}),  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			sort keys %$orig_col_info  | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		);  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
83
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
170
 | 
 	return $stmt;  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub generate_relationship_sugar {  | 
| 
88
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
15
 | 
 	my ($self, $class, $method, $relname, $foreignclass, $colmap, $options)= @_;  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	#use DDP; &p(['before', @_[1..$#_]]);  | 
| 
90
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 	my $expr= '';  | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# The $foreignclass $colmap arguments can be combined into a simpler  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	#  hashref of { local_col => 'ForeignClass.colname' } as long as some expectations hold:  | 
| 
93
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
37
 | 
 	my ($parent_ns)= ($class =~ /^(.*?::)([^:]+)$/);  | 
| 
94
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
46
 | 
 	if (defined $parent_ns and !ref $foreignclass and (!ref $colmap || ref $colmap eq 'HASH')) {  | 
| 
 
 | 
 
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# Can we use a shortened class name for the foreign table?  | 
| 
96
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
44
 | 
 		if ($foreignclass =~ /^(.*?::)([^:]+)$/ and $1 eq $parent_ns) {  | 
| 
97
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
 			$foreignclass= $2;  | 
| 
98
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
99
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
24
 | 
 		my %newmap= ref $colmap eq 'HASH'? (%$colmap) : ($colmap => $colmap);  | 
| 
100
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# Just in case SchemaLoader prefixed them with 'self.' or 'foreign.'...  | 
| 
101
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
 		s/^self[.]// for values %newmap;  | 
| 
102
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
 		%newmap= reverse %newmap;  | 
| 
103
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
 		s/^foreign[.]// for values %newmap;  | 
| 
104
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# Apply the foreign class name to the first column in the map  | 
| 
105
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
 		my ($first_key)= sort keys %newmap;  | 
| 
106
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
 		$newmap{$first_key}= $foreignclass . '.' . $newmap{$first_key};  | 
| 
107
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
17
 | 
 		$expr .= deparse(\%newmap);  | 
| 
108
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	} else {  | 
| 
109
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		$expr .= deparse($foreignclass, $colmap);  | 
| 
110
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
111
 | 
4
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
30
 | 
 	if ($options && keys %$options) {  | 
| 
112
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
 		$expr .= ', ' . $self->generate_relationship_attr_sugar($options);  | 
| 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
115
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# Test the syntax for equality to the original  | 
| 
116
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
 	my $checkpkg= $self->_get_class_check_namespace($class);  | 
| 
117
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
 	my @out;  | 
| 
118
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
485
 | 
 	eval "package $checkpkg; \@out= DBIx::Class::ResultDDL::expand_relationship_params(\$class, \$method, \$relname, $expr);";  | 
| 
119
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
32
 | 
 	@out or croak "Error verifying generated ResultDDL for $class $method $relname: $@";  | 
| 
120
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
121
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	#use DDP; &p(['after', @out, $expr]);  | 
| 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
123
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
 	return $method . ' ' . deparse_hashkey($relname) . ' => ' . $expr . ';';  | 
| 
124
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
125
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
126
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
127
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub generate_relationship_attr_sugar {  | 
| 
128
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
16
 | 
 	my ($self, $orig_options)= @_;  | 
| 
129
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
 	my %options= %$orig_options;  | 
| 
130
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 	my @expr;  | 
| 
131
 | 
4
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
49
 | 
 	if (defined $options{on_update} && defined $options{on_delete}  | 
| 
 
 | 
 
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
132
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		&& $options{on_update} eq $options{on_delete}  | 
| 
133
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	) {  | 
| 
134
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
 		my $val= delete $options{on_update};  | 
| 
135
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
 		delete $options{on_delete};  | 
| 
136
 | 
2
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
14
 | 
 		push @expr, $val eq 'CASCADE'? 'ddl_cascade'  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			: $val eq 'RESTRICT'? 'ddl_cascade(0)'  | 
| 
138
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			: 'ddl_cascade('.deparse($val).')'  | 
| 
139
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
140
 | 
4
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
48
 | 
 	if (defined $options{cascade_copy} && defined $options{cascade_delete}  | 
| 
 
 | 
 
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
141
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		&& $options{cascade_copy} eq $options{cascade_delete}  | 
| 
142
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	) {  | 
| 
143
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
 		my $val= delete $options{cascade_copy};  | 
| 
144
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
 		delete $options{cascade_delete};  | 
| 
145
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
18
 | 
 		push @expr, $val eq '1'? 'dbic_cascade'  | 
| 
146
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			: 'dbic_cascade('.deparse($val).')'  | 
| 
147
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
148
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
22
 | 
 	push @expr, substr(deparse(\%options),2,-2) if keys %options;  | 
| 
149
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
22
 | 
 	return join ', ', @expr  | 
| 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
151
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
152
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my %rel_methods= map +($_ => 1), qw( belongs_to might_have has_one has_many );  | 
| 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _dbic_stmt {  | 
| 
154
 | 
22
 | 
 
 | 
 
 | 
  
22
  
 | 
 
 | 
639807
 | 
 	my ($self, $class, $method)= splice(@_, 0, 3);  | 
| 
155
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# The first time we generate anything for each class, inject the 'use' line.  | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	$self->_raw_stmt($class, $self->generate_resultddl_import_line($class))  | 
| 
157
 | 
22
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
218
 | 
 		unless $self->{_ResultDDL_SchemaLoader}{$class}{use_line}++;  | 
| 
158
 | 
22
 | 
  
100
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
185
 | 
 	if ($method eq 'table') {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
159
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
 		$self->_raw_stmt($class, q|table |.deparse(@_).';');  | 
| 
160
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
161
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	elsif ($method eq 'add_columns') {  | 
| 
162
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
 		my @col_defs;  | 
| 
163
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
 		while (@_) {  | 
| 
164
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
59
 | 
 			my ($col_name, $col_info)= splice(@_, 0, 2);  | 
| 
165
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
55
 | 
 			push @col_defs, [  | 
| 
166
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				deparse_hashkey($col_name),  | 
| 
167
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				$self->generate_column_info_sugar($class, $col_name, $col_info)  | 
| 
168
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			];  | 
| 
169
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
170
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# align the definitions, but round up to help avoid unnecessary diffs  | 
| 
171
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# when new columns get added.  | 
| 
172
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
54
 | 
 		my $widest= max map length($_->[0]), @col_defs;  | 
| 
173
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
 		$widest= ($widest + 3) & ~3;  | 
| 
174
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$self->_raw_stmt($class, sprintf("col %-*s => %s;", $widest, @$_))  | 
| 
175
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
65
 | 
 			for @col_defs;  | 
| 
176
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	elsif ($method eq 'set_primary_key') {  | 
| 
178
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
 		$self->_raw_stmt($class, q|primary_key |.deparse(@_).";");  | 
| 
179
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
180
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	elsif ($rel_methods{$method} && @_ == 4) {  | 
| 
181
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		# Add a linebreak before the relationships, for readability.  | 
| 
182
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$self->_raw_stmt($class, "\n")  | 
| 
183
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
38
 | 
 			unless $self->{_ResultDDL_SchemaLoader}{$class}{relation_linebreak}++;  | 
| 
184
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
49
 | 
 		$self->_raw_stmt($class, $self->generate_relationship_sugar($class, $method, @_));  | 
| 
185
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
186
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	else {  | 
| 
187
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		$self->next::method($class, $method, @_);  | 
| 
188
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
189
 | 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
309
 | 
 	return;  | 
| 
190
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
191
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
192
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my %data_type_sugar= (  | 
| 
193
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	(map {  | 
| 
194
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		my $type= $_;  | 
| 
195
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$type => sub { my ($col_info)= @_;  | 
| 
196
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			if ($col_info->{size} && $col_info->{size} =~ /^[0-9]+$/) {  | 
| 
197
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				return "$type(".delete($col_info->{size})."),";  | 
| 
198
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			} elsif ($col_info->{size} && ref $col_info->{size} eq 'ARRAY'  | 
| 
199
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				&& ($#{$col_info->{size}} == 0 || $#{$col_info->{size}} == 1)  | 
| 
200
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				&& (all { /^[0-9]+$/ } @{$col_info->{size}})  | 
| 
201
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			) {  | 
| 
202
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				return "$type(".join(',', @{delete($col_info->{size})})."),";  | 
| 
203
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			} else {  | 
| 
204
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				return $type;  | 
| 
205
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			}  | 
| 
206
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
207
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	} qw( integer float real numeric decimal varchar nvarchar char nchar binary varbinary )),  | 
| 
208
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	(map {  | 
| 
209
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		my $type= $_;  | 
| 
210
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$type => sub { my ($col_info, $class_settings)= @_;  | 
| 
211
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			# include timezone in type sugar, if known.  | 
| 
212
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			if ($col_info->{timezone} && !ref $col_info->{timezone}) {  | 
| 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				return "$type(".deparse(delete $col_info->{timezone})."),";  | 
| 
214
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			} else {  | 
| 
215
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				return $type;  | 
| 
216
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			}  | 
| 
217
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
218
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	} qw( datetime timestamp )),  | 
| 
219
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	(map {  | 
| 
220
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		my $type= $_;  | 
| 
221
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		$type => sub { my ($col_info, $class_settings)= @_;  | 
| 
222
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			# Remove serializer_class => 'JSON' if inflate_json is enabled package-wide  | 
| 
223
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			delete $col_info->{serializer_class}  | 
| 
224
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 				if $class_settings->{inflate_json} && ($col_info->{serializer_class}||'') eq 'JSON';  | 
| 
225
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 			return $type;  | 
| 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
227
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	} qw( json jsonb )),  | 
| 
228
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 );  | 
| 
229
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
230
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _get_data_type_sugar {  | 
| 
231
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
45
 | 
 	my ($col_info, $class_settings)= @_;  | 
| 
232
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
233
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	my $t= delete $col_info->{data_type}  | 
| 
234
 | 
20
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
66
 | 
 		or return ();  | 
| 
235
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
236
 | 
20
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
153
 | 
 	my $pl= ($data_type_sugar{$t} //= do {  | 
| 
237
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
 		my $sugar= DBIx::Class::ResultDDL->can($t);  | 
| 
238
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
7
 | 
 		my @out= $sugar? $sugar->() : ();  | 
| 
239
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
 
 | 
6
 | 
 		@out >= 2 && $out[0] eq 'data_type' && $out[1] eq $t? sub { $t }  | 
| 
240
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
0
 | 
 		: sub { 'data_type => '.deparse($t).',' }  | 
| 
241
 | 
1
 | 
  
 50
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
39
 | 
 	})->($col_info, $class_settings);  | 
| 
242
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
243
 | 
20
 | 
  
  0
  
 | 
  
 33
  
 | 
 
 | 
 
 | 
63
 | 
 	if ($col_info->{extra} && $col_info->{extra}{unsigned}) {  | 
| 
244
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		$pl =~ s/,?$/,/ unless $pl =~ /\w$/;  | 
| 
245
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		$pl .= ' unsigned';  | 
| 
246
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		if (1 == keys %{ $col_info->{extra} }) {  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
247
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			delete $col_info->{extra};  | 
| 
248
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		} else {  | 
| 
249
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			$col_info->{extra}= { %{ $col_info->{extra} } };  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
250
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 			delete $col_info->{extra}{unsigned};  | 
| 
251
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		}  | 
| 
252
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
253
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
42
 | 
 	return $pl;  | 
| 
254
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
255
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
256
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse_scalar {  | 
| 
257
 | 
143
 | 
  
 50
  
 | 
 
 | 
  
143
  
 | 
 
 | 
312
 | 
 	return 'undef' unless defined;  | 
| 
258
 | 
143
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
863
 | 
 	return $_ if /^(0|[1-9][0-9]*)$/;  | 
| 
259
 | 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
118
 | 
 	my $x= $_;  | 
| 
260
 | 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
135
 | 
 	$x =~ s/\\/\\\\/g;  | 
| 
261
 | 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
142
 | 
 	$x =~ s/'/\\'/g;  | 
| 
262
 | 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
405
 | 
 	return "'$x'";  | 
| 
263
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse_scalarref {  | 
| 
265
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
25
 | 
 	"\\" . (map &_deparse_scalar, $$_)[0]  | 
| 
266
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
267
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub deparse_hashkey { local $_= $_[0]; &_deparse_hashkey }  | 
| 
268
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse_hashkey {  | 
| 
269
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	# TODO: complete support for perl's left-hand of => operator parsing rule  | 
| 
270
 | 
148
 | 
  
 50
  
 | 
 
 | 
  
148
  
 | 
 
 | 
767
 | 
 	/^[A-Za-z_][A-Za-z0-9_]*$/? $_ : &_deparse_scalar;  | 
| 
271
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
272
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse_hashref {  | 
| 
273
 | 
46
 | 
 
 | 
 
 | 
  
46
  
 | 
 
 | 
91
 | 
 	my $h= $_;  | 
| 
274
 | 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
183
 | 
 	return '{ '.join(', ', map +(&_deparse_hashkey.' => '.deparse($h->{$_})), sort keys %$h).' }'  | 
| 
275
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
276
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse_arrayref {  | 
| 
277
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
0
 | 
 	return '[ '.join(', ', map &_deparse, @$_).' ]'  | 
| 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
279
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _deparse {  | 
| 
280
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	!ref()? &_deparse_scalar  | 
| 
281
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	: ref() eq 'SCALAR'? &_deparse_scalarref  | 
| 
282
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	: ref() eq 'ARRAY'? &_deparse_arrayref  | 
| 
283
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	: ref() eq 'HASH'? &_deparse_hashref  | 
| 
284
 | 
189
 | 
  
 50
  
 | 
 
 | 
  
189
  
 | 
 
 | 
526
 | 
 	: do {  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
285
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		require Data::Dumper;  | 
| 
286
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
 		Data::Dumper->new([$_])->Terse(1)->Quotekeys(0)->Sortkeys(1)->Indent(0)->Dump;  | 
| 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
288
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
289
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub deparse {  | 
| 
290
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	join(', ', map &_deparse, @_);  | 
| 
291
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
292
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
293
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our %per_class_check_namespace;  | 
| 
294
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _get_class_check_namespace {  | 
| 
295
 | 
24
 | 
 
 | 
 
 | 
  
24
  
 | 
 
 | 
61
 | 
 	my ($self, $class)= @_;  | 
| 
296
 | 
24
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
93
 | 
 	return ($per_class_check_namespace{$class} ||= do {  | 
| 
297
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
 		my $use_line= $self->generate_resultddl_import_line($class);  | 
| 
298
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
 		local $DBIx::Class::ResultDDL::DISABLE_AUTOCLEAN= 1;  | 
| 
299
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
 		my $pkg= 'DBIx::Class::ResultDDL_check' . scalar keys %per_class_check_namespace;  | 
| 
300
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
 		my $perl= "package $pkg; $use_line 1";  | 
| 
301
 | 
1
 | 
  
 50
  
 | 
 
 | 
  
1
  
 | 
 
 | 
17
 | 
 		eval $perl or croak "Error setting up package to verify generated ResultDDL: $@\nFor code:\n$perl";  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
17
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
661
 | 
    | 
| 
302
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
62
 | 
 		$pkg;  | 
| 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	});  | 
| 
304
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
305
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
306
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
307
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
308
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
309
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |