Subject: | implement: find_or_empty |
This code
$DBIC->resultset('Name' )->find( $id )->get_columns
cause error:
Can't call method "get_columns" on an undefined value at /home/feelsafe/public_html/www/autohandler line 174.
To escape from constructions
if( my $row = $DBIC->resultset('Name' )->find( $id ) ) {
$result = $row->get_columns
}
else {
my @columns = $DBIC->resultset( $table )->result_source->columns;
@result{ @columns } = undef;
}
It will be good to have:
%result = $DBIC->resultset('Name' )->find_or_empty( $id )->get_columns