line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UR::Object::Command::CrudUtil; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
2768
|
use strict; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
410
|
|
4
|
12
|
|
|
12
|
|
70
|
use warnings 'FATAL'; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
2033
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
class UR::Object::Command::CrudUtil { |
7
|
|
|
|
|
|
|
doc => 'Utils for CRUD commands', |
8
|
|
|
|
|
|
|
}; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub display_id_for_value { |
11
|
24
|
|
|
24
|
0
|
17406
|
my ($class, $value) = @_; |
12
|
|
|
|
|
|
|
|
13
|
24
|
100
|
100
|
|
|
279
|
if ( not defined $value ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
14
|
4
|
|
|
|
|
21
|
'NULL'; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
elsif ( ref($value) eq 'HASH' or ref($value) eq 'ARRAY' ) { |
17
|
2
|
|
|
|
|
34
|
die 'Do not pass HASH or ARRAY to display_id_for_value!'; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
elsif ( not Scalar::Util::blessed($value) ) { |
20
|
6
|
|
|
|
|
25
|
$value; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
elsif ( $value->can('id') ) { |
23
|
12
|
|
|
|
|
138
|
$value->id; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { # stringify |
26
|
0
|
|
|
|
|
|
"$value"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |