new backend status class

This commit is contained in:
Oliver Gorwits
2017-09-03 17:26:27 +01:00
parent 5f50dfadf1
commit ef1bb81f2b
2 changed files with 39 additions and 17 deletions

View File

@@ -0,0 +1,39 @@
package App::Netdisco::Backend::Status;
use strict;
use warnings;
use Moo;
use namespace::clean;
foreach my $slot (qw/
done
error
defer
message
/) {
has $slot => (
is => 'rw',
);
}
=head1 METHODS
=head2 ok
Returns true if C<done> is true and C<error> and C<defer> have not been set.
=cut
sub ok { return ($_[0]->done and not $_[0]->error and not $_[0]->defer) }
=head2 not_ok
Returns the logical inversion of C<ok>.
=cut
sub not_ok { return (not $_[0]->ok) }
1;