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

Laine Stump laine at laine.org
Sat Jun 2 01:15:21 UTC 2018


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 at redhat.com>

Reviewed-by: Laine Stump <laine at 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';
>      }
>  





More information about the libvir-list mailing list