Subject: | Method returning current state as a string |
I find myself writing the equivalent of this in most projects:
sub status {
$_[0]->is_done
? 'done'
: $_[0]->is_failed
? 'failed'
: $_[0]->is_cancelled
? 'cancelled'
: 'pending'
}
sub describe { ($_[0]->label // 'Future') . '(' . $_[0]->status . ')' }
Would be nice to have something along these lines as a standard method.