App-CELL
view release on metacpan or search on metacpan
lib/App/CELL/Guide.pm view on Meta::CPAN
In order to signify an error, subroutine C<foo_dis> could for example do
this:
return $CELL->status_err( code => 'Gidget displacement %s out of range',
args => [ $displacement ],
);
(Instead of having the error text in the C<code>, it could be placed in a
message file in the sitedir with a code like DISP_OUT_OF_RANGE.)
On success, C<foo_dis> could return an 'OK' status with the gidget
displacement value in the payload:
return $CELL->status_ok( payload => $displacement );
The calling function could check the return value like this:
my $status = foo_dis();
return $status if $status->not_ok;
my $displacement = $status->payload;
( run in 0.934 second using v1.01-cache-2.11-cpan-5735350b133 )