new backend status class
This commit is contained in:
39
lib/App/Netdisco/Backend/Status.pm
Normal file
39
lib/App/Netdisco/Backend/Status.pm
Normal 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;
|
||||
@@ -1,17 +0,0 @@
|
||||
package App::Netdisco::Backend::Util;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# support utilities for Backend Actions
|
||||
|
||||
use base 'Exporter';
|
||||
our @EXPORT = ();
|
||||
our @EXPORT_OK = qw/ job_done job_error job_defer /;
|
||||
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
||||
|
||||
sub job_done { return ('done', shift) }
|
||||
sub job_error { return ('error', shift) }
|
||||
sub job_defer { return ('defer', shift) }
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user