From b3111e7e9c262d8c71e23a6dc78d5d7a888dacc3 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 20 Mar 2012 19:52:33 +0000 Subject: perl_checker cleanups --- lib/network/connection/cellular.pm | 4 ++-- lib/network/connection/cellular_card.pm | 12 ++++++------ lib/network/connection/ethernet.pm | 9 ++++----- lib/network/connection/isdn.pm | 1 + lib/network/connection/ppp.pm | 9 --------- lib/network/connection/wireless.pm | 4 ++-- 6 files changed, 15 insertions(+), 24 deletions(-) (limited to 'lib/network/connection') diff --git a/lib/network/connection/cellular.pm b/lib/network/connection/cellular.pm index 5bb2259..3084480 100644 --- a/lib/network/connection/cellular.pm +++ b/lib/network/connection/cellular.pm @@ -16,7 +16,7 @@ sub get_providers { # filtering out CDMA-only providers which we do not support for now my %providers = ( %network::connection::providers::cellular::data, - grep_each{!$::b->{cdma} } %network::connection::providers::cellular_extra::data + grep_each { !$::b->{cdma} } %network::connection::providers::cellular_extra::data ); (\%providers, '|'); } @@ -48,7 +48,7 @@ sub write_cellular_settings { sub guess_apn_from_chat { my ($self) = @_; my $chat = cat_($::prefix . $self->get_chat_file); - my $chat_apn = $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1; + $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1; } sub guess_provider_settings { diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm index 0fc3fbf..c68b3a2 100644 --- a/lib/network/connection/cellular_card.pm +++ b/lib/network/connection/cellular_card.pm @@ -68,11 +68,11 @@ sub get_tty_device { my %udev_env = map { if_(/^([^=]*)=(.*)$/, $1 => $2) } chomp_(run_program::get_stdout("udevadm info --query=property --path=$self->{device}{sysfs_device}")); if ($udev_env{USB_MODEM_INTERFACE}) { - my $dev_sys_path = $self->{device}->{sysfs_device}; + my $dev_sys_path = $self->{device}{sysfs_device}; my $cfg = chomp_(cat_($dev_sys_path . "/bConfigurationValue")); my $tty_usb = basename(glob_("$dev_sys_path/" . - $self->{device}->{pci_bus} . "-" . - ($self->{device}->{usb_port} + 1) . ":$cfg." . + $self->{device}{pci_bus} . "-" . + ($self->{device}{usb_port} + 1) . ":$cfg." . $udev_env{USB_MODEM_INTERFACE} . "/ttyUSB*")); if ($tty_usb) { $tty_usb =~ s/ttyUSB//; @@ -81,8 +81,8 @@ sub get_tty_device { } else { # if no usb interface for tty port given, use first one my @intfs = glob_("$self->{device}->{sysfs_device}/" . - $self->{device}->{pci_bus} . "-" . - ($self->{device}->{usb_port} + 1) . ":*"); + $self->{device}{pci_bus} . "-" . + ($self->{device}{usb_port} + 1) . ":*"); foreach (@intfs) { my $tty_usb = basename(glob_("$_/tty*")); if ($tty_usb) { @@ -108,7 +108,7 @@ sub get_control_device { my ($self) = @_; my $tty_device = $self->get_tty_device; if ($tty_device eq "/dev/ttyUSB0") { - for my $id (2, 1) { + foreach my $id (2, 1) { my $usb_control_device = "/dev/ttyUSB" . $id; return $usb_control_device if -e $usb_control_device; } diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index 7b76396..c2f9718 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -188,7 +188,7 @@ sub check_address_settings { return 0; } #- test if IP address is already used - if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}} ) { + if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}}) { # find out what connection we are conflicting with my $conflict_device = $conflict->{DEVICE}; @@ -216,14 +216,14 @@ sub get_hostname_settings { my ($self) = @_; my $auto_hostname = sub { $self->{protocol} eq 'dhcp' && $self->{address}{needhostname} }; # configure the default hostname so the hostname setting should be more obvious to the users - $self->{address}{hostname} = 'localhost.localdomain' unless $self->{address}{hostname}; + $self->{address}{hostname} ||= 'localhost.localdomain'; [ if_($self->{protocol} eq 'dhcp', { text => N("Assign host name from DHCP server (or generate a unique one)"), val => \$self->{address}{needhostname}, type => "bool", - help => N("This will allow the server to attribute a name for this machine. If the server does not provides a valid host name, it will be generated automatically.")}, + help => N("This will allow the server to attribute a name for this machine. If the server does not provides a valid host name, it will be generated automatically.") }, ), { label => N("Host name"), val => \$self->{address}{hostname}, disabled => $auto_hostname, - help => N("You should define a hostname for this machine, which will identify this PC. Note that this hostname will be shared among all network connections. If left blank, 'localhost.localdomain' will be used.")}, + help => N("You should define a hostname for this machine, which will identify this PC. Note that this hostname will be shared among all network connections. If left blank, 'localhost.localdomain' will be used.") }, ]; } @@ -508,7 +508,6 @@ sub update_iftab() { } sub update_udev_net_config() { - my $lib = arch() =~ /x86_64/ ? "lib64" : "lib"; my $net_name_helper = "/lib/udev/write_net_rules"; my $udev_net_config = "$::prefix/etc/udev/rules.d/70-persistent-net.rules"; my @old_config = cat_($udev_net_config); diff --git a/lib/network/connection/isdn.pm b/lib/network/connection/isdn.pm index 1b8debc..7187aed 100644 --- a/lib/network/connection/isdn.pm +++ b/lib/network/connection/isdn.pm @@ -23,6 +23,7 @@ use run_program; use log; use network::tools; use services; +use network::connection::isdn::consts; # for @isdndata sub apply_config { my ($in, $isdn) = @_; diff --git a/lib/network/connection/ppp.pm b/lib/network/connection/ppp.pm index 287d7bb..277971f 100644 --- a/lib/network/connection/ppp.pm +++ b/lib/network/connection/ppp.pm @@ -5,15 +5,6 @@ use common; use base qw(network::connection); -my %authentication_methods = ( - script => N_("Script-based"), - pap => N_("PAP"), - terminal_ => N_("Terminal-based"), - chap => N_("CHAP"), - pap_chap => N_("PAP/CHAP"), -); - -my @kppp_authentication_methods = qw(script pap terminal chap pap_chap); my @secrets_files = qw(pap-secrets chap-secrets); sub get_access_settings { diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm index 4f86f17..89d57dd 100644 --- a/lib/network/connection/wireless.pm +++ b/lib/network/connection/wireless.pm @@ -388,7 +388,7 @@ sub load_interface_settings { $self->{hide_passwords} = 1; # override ifcfg with network-specific settings if available my $network = $self->get_selected_network; - $self->{ifcfg}= $network ? + $self->{ifcfg} = $network ? get_network_ifcfg($network->{ap}) || get_network_ifcfg($network->{essid}) : $self->{ifcfg}; @@ -970,7 +970,7 @@ sub wpa_supplicant_read_conf() { if ($network) { #- in a "network = {}" block # value is either the string with "quotes" - or a full-length string - if (/^\s*(\w+)=\s*(?|([^"].*)|("[^"]*")).*$/) { + if (/^\s*(\w+)=\s*(?|([^"].*)|("[^"]*"))/) { $network->{$1} = $2; } elsif (/^\}/) { #- end of network block -- cgit v1.2.1