On 05/21/2018 12:46 PM, Daniel P. Berrangé wrote:
Perl has started to forbid code from declaring "my $_",
because $_ is
implicitly always a local scope. Rewrite the code to avoid tickling this
warning.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
Reviewed-by: Laine Stump <laine(a)laine.org>
---
lib/Sys/Virt/TCK/Hooks.pm | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/Sys/Virt/TCK/Hooks.pm b/lib/Sys/Virt/TCK/Hooks.pm
index e7a8f76..7d35072 100644
--- a/lib/Sys/Virt/TCK/Hooks.pm
+++ b/lib/Sys/Virt/TCK/Hooks.pm
@@ -71,11 +71,10 @@ sub expect_result {
sub libvirtd_status {
my $self = shift;
my $status = `service libvirtd status`;
- my $_ = $status;
- if (/stopped|unused|inactive/) {
+ if ($status =~ /stopped|unused|inactive/) {
$self->{libvirtd_status} = 'stopped';
- } elsif (/running|active/) {
+ } elsif ($status =~ /running|active/) {
$self->{libvirtd_status} = 'running';
}