package System::Introspector::Packages::Apt;
use Moo;
+use System::Introspector::Util qw(
+ handle_from_command
+ transform_exceptions
+);
+
sub gather {
my ($self) = @_;
return {
- installed => $self->_gather_installed,
+ installed => transform_exceptions {
+ return { packages => $self->_gather_installed };
+ },
};
}
sub _open_dpkg_query_pipe {
my ($self) = @_;
- my $command = 'dpkg-query --show';
- open my $pipe, '-|', $command
- or die "Unable to open pipe to '$command': $!\n";
- return $pipe;
+ return handle_from_command 'dpkg-query --show';
}
sub _gather_installed {