| 1 | #!perl | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | #PODNAME: Raisin::Entity | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | #ABSTRACT: A simple facade to use with your API | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | package Raisin::Entity; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | $Raisin::Entity::VERSION = '0.94'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use parent 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Types::Standard qw/HashRef/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use Raisin::Entity::Object; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | our @EXPORT = qw(expose); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | my @SUBNAME; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | my $class = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 10 | ▶ | *{ "${class}::name" } = sub { $class }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # A kind of a workaround for OpenAPI | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # Every entity has a HashRef type even if it is not, so it could cause | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # issues for users in OpenAPI specification. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 10 | ▶ | *{ "${class}::type" } = sub { HashRef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 10 | ▶ | *{ "${class}::enclosed" } = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | \@{ "${class}::EXPOSE" }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 10 | Raisin::Entity->export_to_level(1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 34 | ▶ | sub expose { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expose: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 34 | my ($name, @params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 34 | my $class = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 34 | ▶ | if (scalar @SUBNAME) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 3 | $class = 'Raisin::Entity::Nested::' . join('', @SUBNAME); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 34 | push @{ "${class}::EXPOSE" }, Raisin::Entity::Object->new($name, @params); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 34 | ▶ | return $class if scalar @SUBNAME; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 26 | ▶ | sub compile { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile: called CC=14 SCAR=38.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 26 | my ($self, $entity, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 26 | my @expose = do { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 26 | @{ "${entity}::EXPOSE" }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 26 | ▶ | @expose = _make_exposition($data) unless @expose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 26 | ▶ | return $data unless @expose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 14 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # Rose::DB::Object::Iterator, DBIx::Class::ResultSet | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 14 | ▶ | if (blessed($data) && $data->can('next')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
builtin::blessed($data) and $data->can("next")
MC/DC0%0/2
builtin::blessed($data) and $data->can("next")
builtin::blessed($data)
$data->can("next")
Truth table33%1/3
A and B
A= builtin::blessed($data)B= $data->can("next")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | while (my $i = $data->next) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | push @$result, _compile_column($entity, $i, \@expose); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $result = [] unless $result; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Array | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | elsif (ref($data) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | for my $i (@$data) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | push @$result, _compile_column($entity, $i, \@expose); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $result = [] unless $result; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # Hash, Rose::DB::Object, DBIx::Class::Core | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ▶ | elsif (ref($data) eq 'HASH' | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition11%1/9
ref $data eq "HASH" or builtin::blessed($data) and $data->isa("Rose::DB::Object") || $data->isa("DBIx::Class::Core")
builtin::blessed($data) and $data->isa("Rose::DB::Object") || $data->isa("DBIx::Class::Core")
$data->isa("Rose::DB::Object") or $data->isa("DBIx::Class::Core")
MC/DC0%0/4
ref $data eq "HASH" or builtin::blessed($data) and $data->isa("Rose::DB::Object") || $data->isa("DBIx::Class::Core")
ref $data eq "HASH"
builtin::blessed($data)
$data->isa("Rose::DB::Object")
$data->isa("DBIx::Class::Core")
Truth table20%1/5
A or B and C or D
A= ref $data eq "HASH"B= builtin::blessed($data)C= $data->isa("Rose::DB::Object")D= $data->isa("DBIx::Class::Core")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | || (blessed($data) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | && ( $data->isa('Rose::DB::Object') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | || $data->isa('DBIx::Class::Core')))) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 14 | $result = _compile_column($entity, $data, \@expose); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # Scalar, everything else | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $result = $data; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 14 | $result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 23 | ▶ | sub _compile_column { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compile_column: called CC=16 SCAR=29.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 23 | my ($entity, $data, $settings) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 23 | my %result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 23 | for my $obj (@$settings) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 26 | ▶ | next if blessed($obj) && $obj->condition && !$obj->condition->($data); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
builtin::blessed($obj) and $obj->condition and not $obj->condition->($data)
builtin::blessed($obj) and $obj->condition
MC/DC0%0/3
builtin::blessed($obj) and $obj->condition and not $obj->condition->($data)
builtin::blessed($obj)
$obj->condition
not $obj->condition->($data)
Truth table50%2/4
A and B and not(C)
A= builtin::blessed($obj)B= $obj->conditionC= not $obj->condition->($data)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 26 | ▶ | my $column = blessed($obj) ? $obj->name : $obj->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 26 | ▶ | my $key = blessed($obj) ? $obj->display_name : $obj->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 26 | my $value = do { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 26 | ▶ | if (blessed($obj) and my $runtime = $obj->runtime) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
builtin::blessed($obj) and my $runtime = $obj->runtime
MC/DC50%1/2
builtin::blessed($obj) and my $runtime = $obj->runtime
builtin::blessed($obj)
my $runtime = $obj->runtime
Truth table66%2/3
A and B
A= builtin::blessed($obj)B= my $runtime = $obj->runtime
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 5 | push @SUBNAME, "${entity}::$column"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 5 | my $retval = $runtime->($data); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 5 | pop @SUBNAME; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 5 | ▶ | if ($retval && !ref($retval) && $retval =~ /^Raisin::Entity::Nested::/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$retval and not ref $retval and $retval =~ /^Raisin::Entity::Nested::/
$retval and not ref $retval
MC/DC33%1/3
$retval and not ref $retval and $retval =~ /^Raisin::Entity::Nested::/
$retval
not ref $retval
$retval =~ /^Raisin::Entity::Nested::/
Truth table50%2/4
A and not(B) and C
A= $retvalB= not ref $retvalC= $retval =~ /^Raisin::Entity::Nested::/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | $retval = __PACKAGE__->compile($retval, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ▶ | elsif (blessed($obj) and my $e = $obj->using) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
builtin::blessed($obj) and my $e = $obj->using
MC/DC50%1/2
builtin::blessed($obj) and my $e = $obj->using
builtin::blessed($obj)
my $e = $obj->using
Truth table66%2/3
A and B
A= builtin::blessed($obj)B= my $e = $obj->using
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 2 | ▶ | my $in = blessed($data) ? $data->$column : $data->{$column}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | __PACKAGE__->compile($e, $in); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 19 | ▶ | blessed($data) ? $data->$column : $data->{$column}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 26 | $result{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 23 | \%result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 21 | ▶ | sub _make_exposition { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_exposition: called CC=11 SCAR=41.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 21 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 21 | my @columns = do { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 21 | ▶ | if (blessed($data)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ($data->isa('DBIx::Class::ResultSet')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | keys %{ $data->result_class->columns_info }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | elsif ($data->isa('DBIx::Class::Core')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | keys %{ $data->columns_info }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | elsif ($data->isa('Rose::DB::Object')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $data->meta->column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | elsif ($data->isa('Rose::DB::Object::Iterator')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | croak 'Rose::DB::Object::Iterator isn\'t supported'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | elsif (ref($data) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if (blessed($data->[0]) && $data->[0]->isa('Rose::DB::Object')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($data->[0]) and $data->[0]->isa("Rose::DB::Object")
MC/DC0%0/2
builtin::blessed($data->[0]) and $data->[0]->isa("Rose::DB::Object")
builtin::blessed($data->[0])
$data->[0]->isa("Rose::DB::Object")
Truth table0%0/3
A and B
A= builtin::blessed($data->[0])B= $data->[0]->isa("Rose::DB::Object")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $data->[0]->meta->column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | elsif (ref($data) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 21 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 21 | ▶ | return if not @columns; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | map { { name => $_ } } @columns; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||