summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2017-06-22 13:55:06 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2018-10-30 13:22:09 +0100
commitd88ab5e54acfdf4292445567d8d9d4e40cd5c865 (patch)
tree0a26a46f168e07ebca1c85c03cabec45f9b3a9b9 /lib
parent53cd7d8b7c0323dfa875ffb0b4cadc02c85da2dd (diff)
downloaddrakx-net-d88ab5e54acfdf4292445567d8d9d4e40cd5c865.tar
drakx-net-d88ab5e54acfdf4292445567d8d9d4e40cd5c865.tar.gz
drakx-net-d88ab5e54acfdf4292445567d8d9d4e40cd5c865.tar.bz2
drakx-net-d88ab5e54acfdf4292445567d8d9d4e40cd5c865.tar.xz
drakx-net-d88ab5e54acfdf4292445567d8d9d4e40cd5c865.zip
simplify: use //= where appropirate
Diffstat (limited to 'lib')
-rw-r--r--lib/network/connection/ethernet.pm8
-rw-r--r--lib/network/tools.pm2
2 files changed, 5 insertions, 5 deletions
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);