diff --git a/lib/App/Netdisco/Backend/Status.pm b/lib/App/Netdisco/Backend/Status.pm new file mode 100644 index 00000000..7e78251e --- /dev/null +++ b/lib/App/Netdisco/Backend/Status.pm @@ -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 is true and C and C 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. + +=cut + +sub not_ok { return (not $_[0]->ok) } + +1; diff --git a/lib/App/Netdisco/Backend/Util.pm b/lib/App/Netdisco/Backend/Util.pm deleted file mode 100644 index a957d5e6..00000000 --- a/lib/App/Netdisco/Backend/Util.pm +++ /dev/null @@ -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;