From d88ab5e54acfdf4292445567d8d9d4e40cd5c865 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 22 Jun 2017 13:55:06 +0200 Subject: simplify: use //= where appropirate --- lib/network/connection/ethernet.pm | 8 ++++---- lib/network/tools.pm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index 47056bb..87c4e69 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -112,8 +112,8 @@ sub guess_protocol { sub guess_address_settings { my ($self) = @_; $self->{address}{dhcp_client} ||= find { -x "$::prefix/sbin/$_" } @dhcp_clients; - $self->{address}{peerdns} = 1 if !defined $self->{address}{peerdns}; - $self->{address}{peeryp} = 1 if !defined $self->{address}{peeryp}; + $self->{address}{peerdns} //= 1; + $self->{address}{peeryp} //= 1; $self->supplement_address_settings; } @@ -204,7 +204,7 @@ sub check_address_settings { sub guess_hostname_settings { my ($self) = @_; - $self->{address}{needhostname} = 0 if !defined $self->{address}{needhostname}; + $self->{address}{needhostname} //= 0; if (!defined $self->{address}{hostname}) { require network::network; my $network = network::network::read_conf($::prefix . $network::network::network_file); @@ -233,7 +233,7 @@ sub guess_control_settings { $self->network::connection::guess_control_settings($self); - $self->{control}{onboot} = 1 if !defined $self->{control}{onboot}; + $self->{control}{onboot} //= 1; $self->{control}{use_ifplugd} = !is_ifplugd_blacklisted($self->get_driver) if !defined $self->{control}{use_ifplugd}; } diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 92e4765..0f21fdd 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -96,7 +96,7 @@ sub test_connected { local $| = 1; my ($cmd) = @_; - $current_connection_status = -1 if !defined $current_connection_status; + $current_connection_status //= -1; if ($cmd == 0) { connected_bg__raw(\$kid_pipe_connect, \$current_connection_status); -- cgit v1.2.1