| 1 | package Rose::DB::Object::Util; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 63 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 63 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 63 | ▶ | use Rose::DB::Object::Helpers(); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | use Rose::DB::Object::Constants | ||||||||||||||||||||||||||||
| 10 | 63 | ▶ | qw(PRIVATE_PREFIX STATE_IN_DB STATE_LOADING STATE_SAVING MODIFIED_COLUMNS | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 63 | ON_SAVE_ATTR_NAME); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 63 | require Exporter; | |||||||||||||||||||||||||||
| 14 | 63 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 63 | our @EXPORT_OK = | |||||||||||||||||||||||||||
| 17 | qw(is_in_db is_loading is_saving | ||||||||||||||||||||||||||||
| 18 | set_state_in_db set_state_loading set_state_saving | ||||||||||||||||||||||||||||
| 19 | unset_state_in_db unset_state_loading unset_state_saving | ||||||||||||||||||||||||||||
| 20 | row_id column_value_formatted_key column_value_is_inflated_key | ||||||||||||||||||||||||||||
| 21 | column_value_formatted_key_for_db | ||||||||||||||||||||||||||||
| 22 | lazy_column_values_loaded_key modified_column_names has_modified_columns | ||||||||||||||||||||||||||||
| 23 | has_modified_children has_loaded_related set_column_value_modified | ||||||||||||||||||||||||||||
| 24 | unset_column_value_modified get_column_value_modified | ||||||||||||||||||||||||||||
| 25 | post_save_set_related_objects_code post_save_add_related_objects_code | ||||||||||||||||||||||||||||
| 26 | pre_save_set_foreign_object_code); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 63 | our %EXPORT_TAGS = | |||||||||||||||||||||||||||
| 29 | ( | ||||||||||||||||||||||||||||
| 30 | all => \@EXPORT_OK, | ||||||||||||||||||||||||||||
| 31 | get_state => [ qw(is_in_db is_loading is_saving) ], | ||||||||||||||||||||||||||||
| 32 | set_state => [ qw(set_state_in_db set_state_loading set_state_saving) ], | ||||||||||||||||||||||||||||
| 33 | unset_state => [ qw(unset_state_in_db unset_state_loading unset_state_saving) ], | ||||||||||||||||||||||||||||
| 34 | columns => [ qw(set_column_value_modified get_column_value_modified | ||||||||||||||||||||||||||||
| 35 | unset_column_value_modified modified_column_names | ||||||||||||||||||||||||||||
| 36 | has_modified_columns) ], | ||||||||||||||||||||||||||||
| 37 | children => [ qw(has_modified_children has_loaded_related) ], | ||||||||||||||||||||||||||||
| 38 | on_save_code => [ qw(post_save_set_related_objects_code | ||||||||||||||||||||||||||||
| 39 | post_save_add_related_objects_code | ||||||||||||||||||||||||||||
| 40 | pre_save_set_foreign_object_code) ], | ||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 63 | $EXPORT_TAGS{'state'} = [ map { @$_ } @EXPORT_TAGS{qw(get_state set_state unset_state)} ]; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 63 | our $VERSION = '0.772'; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub is_in_db { shift->{STATE_IN_DB()} } | ||||||||||||||||||||||||||
|
Subroutine
is_in_db: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub is_loading { shift->{STATE_LOADING()} } | ||||||||||||||||||||||||||
|
Subroutine
is_loading: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub is_saving { shift->{STATE_SAVING()} } | ||||||||||||||||||||||||||
|
Subroutine
is_saving: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub set_state_in_db { shift->{STATE_IN_DB()} = 1 } | ||||||||||||||||||||||||||
|
Subroutine
set_state_in_db: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub set_state_loading { shift->{STATE_LOADING()} = 1 } | ||||||||||||||||||||||||||
|
Subroutine
set_state_loading: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub set_state_saving { shift->{STATE_SAVING()} = 1 } | ||||||||||||||||||||||||||
|
Subroutine
set_state_saving: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub unset_state_in_db { shift->{STATE_IN_DB()} = 0 } | ||||||||||||||||||||||||||
|
Subroutine
unset_state_in_db: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub unset_state_loading { shift->{STATE_LOADING()} = 0 } | ||||||||||||||||||||||||||
|
Subroutine
unset_state_loading: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub unset_state_saving { shift->{STATE_SAVING()} = 0 } | ||||||||||||||||||||||||||
|
Subroutine
unset_state_saving: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | sub get_column_value_modified | ||||||||||||||||||||||||||||
| 60 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_column_value_modified: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 0 | my($object, $name) = (shift, shift); | |||||||||||||||||||||||||||
| 62 | 0 | return $object->{MODIFIED_COLUMNS()}{$name}; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | sub set_column_value_modified | ||||||||||||||||||||||||||||
| 66 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_column_value_modified: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 67 | 0 | my($object, $name) = (shift, shift); | |||||||||||||||||||||||||||
| 68 | 0 | my $key = column_value_formatted_key_for_db($object->meta->column($name)->hash_key, $object->db); | |||||||||||||||||||||||||||
| 69 | 0 | delete $object->{$key}; | |||||||||||||||||||||||||||
| 70 | 0 | return $object->{MODIFIED_COLUMNS()}{$name} = 1; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | sub unset_column_value_modified | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
unset_column_value_modified: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | 0 | my($object, $name) = (shift, shift); | |||||||||||||||||||||||||||
| 76 | 0 | return delete $object->{MODIFIED_COLUMNS()}{$name}; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | sub modified_column_names | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
modified_column_names: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | keys(%{shift->{MODIFIED_COLUMNS()} || {}}); | ||||||||||||||||||||||||||
|
Condition0%0/2
+(shift())->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
+(shift())->{'__xrdbopriv_modified_columns'} || {}
+(shift())->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= +(shift())->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | sub has_modified_columns | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
has_modified_columns: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if(@_ > 1 && !$_[1]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ > 1 and not $_[1]
MC/DC0%0/2
@_ > 1 and not $_[1]
@_ > 1
not $_[1]
Truth table0%0/3
A and not(B)
A= @_ > 1B= not $_[1]
| |||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||
| 88 | 0 | shift->{MODIFIED_COLUMNS()} = {}; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | scalar %{shift->{MODIFIED_COLUMNS()} || {}} | ||||||||||||||||||||||||||
|
Condition0%0/2
+(shift())->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
+(shift())->{'__xrdbopriv_modified_columns'} || {}
+(shift())->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= +(shift())->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub has_loaded_related | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
has_loaded_related: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if(@_ == 2) # $object, $name | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 0 | return Rose::DB::Object::Helpers::has_loaded_related(@_); | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 102 | 0 | ▶ | my $object = delete $args{'object'} or croak "Missing object parameter"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | Rose::DB::Object::Helpers::has_loaded_related($object, %args); | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | sub has_modified_children | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
has_modified_children: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | my $meta = $self->meta; | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | foreach my $fk ($meta->foreign_keys) | |||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $foreign_object = $fk->object_has_foreign_object($self) || next; | ||||||||||||||||||||||||||
|
Condition0%0/2
$fk->object_has_foreign_object($self) || (next)
MC/DC0%0/1
$fk->object_has_foreign_object($self) || (next)
$fk->object_has_foreign_object($self)
Truth table0%0/2
A
A= $fk->object_has_foreign_object($self)
| |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if(has_modified_columns($foreign_object) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
has_modified_columns($foreign_object) or has_modified_children($foreign_object)
MC/DC0%0/2
has_modified_columns($foreign_object) or has_modified_children($foreign_object)
has_modified_columns($foreign_object)
has_modified_children($foreign_object)
Truth table0%0/3
A or B
A= has_modified_columns($foreign_object)B= has_modified_children($foreign_object)
| |||||||||||||||||||||||||||||
| 118 | has_modified_children($foreign_object)) | ||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||
| 120 | 0 | return 1; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | foreach my $rel ($meta->relationships) | |||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | my $related_objects = $rel->object_has_related_objects($self) || next; | ||||||||||||||||||||||||||
|
Condition0%0/2
$rel->object_has_related_objects($self) || (next)
MC/DC0%0/1
$rel->object_has_related_objects($self) || (next)
$rel->object_has_related_objects($self)
Truth table0%0/2
A
A= $rel->object_has_related_objects($self)
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | foreach my $rel_object (@$related_objects) | |||||||||||||||||||||||||||
| 129 | { | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if(has_modified_columns($rel_object) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
has_modified_columns($rel_object) or has_modified_children($rel_object)
MC/DC0%0/2
has_modified_columns($rel_object) or has_modified_children($rel_object)
has_modified_columns($rel_object)
has_modified_children($rel_object)
Truth table0%0/3
A or B
A= has_modified_columns($rel_object)B= has_modified_children($rel_object)
| |||||||||||||||||||||||||||||
| 131 | has_modified_children($rel_object)) | ||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||
| 133 | 0 | return 1; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | return 0; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # XXX: A value that is unlikely to exist in a primary key column value | ||||||||||||||||||||||||||||
| 142 | 63 | ▶ | use constant PK_JOIN => "\0\2,\3\0"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | sub row_id | ||||||||||||||||||||||||||||
| 145 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
row_id: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 146 | 0 | my($object) = shift; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $meta = $object->meta or croak "$object has no meta attribute"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | return | ||||||||||||||||||||||||||||
| 151 | join(PK_JOIN, | ||||||||||||||||||||||||||||
| 152 | 0 | map { $object->$_() } | |||||||||||||||||||||||||||
| 153 | 0 | map { $meta->column_accessor_method_name($_) } | |||||||||||||||||||||||||||
| 154 | $meta->primary_key_column_names); | ||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | sub column_value_formatted_key | ||||||||||||||||||||||||||||
| 158 | 342 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
column_value_formatted_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 159 | 342 | my($key) = shift; | |||||||||||||||||||||||||||
| 160 | 342 | return PRIVATE_PREFIX . "_${key}_formatted"; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | sub column_value_formatted_key_for_db | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
column_value_formatted_key_for_db: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 165 | 0 | my($key, $db) = @_; | |||||||||||||||||||||||||||
| 166 | 0 | ▶ | return join($;, column_value_formatted_key($key), $db->driver || 'unknown'); | ||||||||||||||||||||||||||
|
Condition0%0/2
$db->driver || 'unknown'
MC/DC0%0/1
$db->driver || 'unknown'
$db->driver
Truth table0%0/2
A
A= $db->driver
| |||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | sub column_value_is_inflated_key | ||||||||||||||||||||||||||||
| 170 | 297 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
column_value_is_inflated_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 171 | 297 | my($key) = shift; | |||||||||||||||||||||||||||
| 172 | 297 | return PRIVATE_PREFIX . "_${key}_is_inflated"; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | sub lazy_column_values_loaded_key | ||||||||||||||||||||||||||||
| 176 | 183 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
lazy_column_values_loaded_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 177 | 183 | my($key) = shift; | |||||||||||||||||||||||||||
| 178 | 183 | return PRIVATE_PREFIX . "_lazy_loaded"; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | sub post_save_set_related_objects_code | ||||||||||||||||||||||||||||
| 182 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
post_save_set_related_objects_code: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 183 | 0 | my($object, $rel_name, $code) = @_; | |||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if(@_ > 2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | { | ||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if(defined $code) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | { | ||||||||||||||||||||||||||||
| 189 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'set'} = $code; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | else | ||||||||||||||||||||||||||||
| 192 | { | ||||||||||||||||||||||||||||
| 193 | 0 | return delete $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'set'}; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'set'}; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | sub post_save_add_related_objects_code | ||||||||||||||||||||||||||||
| 201 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
post_save_add_related_objects_code: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 202 | 0 | my($object, $rel_name, $code) = @_; | |||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if(@_ > 2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | { | ||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if(defined $code) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | { | ||||||||||||||||||||||||||||
| 208 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'add'} = $code; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | else | ||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||
| 212 | 0 | return delete $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'add'}; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'post'}{'rel'}{$rel_name}{'add'}; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | sub pre_save_set_foreign_object_code | ||||||||||||||||||||||||||||
| 220 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
pre_save_set_foreign_object_code: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 221 | 0 | my($object, $fk_name, $code) = @_; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | if(@_ > 2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||
| 225 | 0 | ▶ | if(defined $code) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||
| 227 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'pre'}{'fk'}{$fk_name}{'set'} = $code; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | else | ||||||||||||||||||||||||||||
| 230 | { | ||||||||||||||||||||||||||||
| 231 | 0 | return delete $object->{ON_SAVE_ATTR_NAME()}{'pre'}{'fk'}{$fk_name}{'set'}; | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | return $object->{ON_SAVE_ATTR_NAME()}{'pre'}{'fk'}{$fk_name}{'set'}; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 63 | 1; | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | __END__ | ||||||||||||||||||||||||||||