[libvirt] [tck PATCH v2 12/13] lib: don't re-assign $_

Daniel P. Berrangé berrange at redhat.com
Mon May 21 16:46:30 UTC 2018


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 at redhat.com>
---
 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';
     }
 
-- 
2.17.0




More information about the libvir-list mailing list