summaryrefslogtreecommitdiffstats
path: root/common/IFCFG.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-01-22 20:24:49 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-01-22 20:24:49 +0000
commitc39ce7aa14f2424c874cc58b5ce5249a05fabe66 (patch)
tree8893b894f4ac7fc7b2fe4dc116654b3830e88668 /common/IFCFG.pm
parent568cc7c168e09ca61e6a6652ad0ab597fa5b6421 (diff)
downloaddrakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar
drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.gz
drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.bz2
drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.tar.xz
drakwizard-c39ce7aa14f2424c874cc58b5ce5249a05fabe66.zip
perl_checker fixes
Diffstat (limited to 'common/IFCFG.pm')
-rw-r--r--common/IFCFG.pm20
1 files changed, 8 insertions, 12 deletions
diff --git a/common/IFCFG.pm b/common/IFCFG.pm
index 24441494..f6d793e6 100644
--- a/common/IFCFG.pm
+++ b/common/IFCFG.pm
@@ -34,15 +34,14 @@ sub new {
my $ifconfig = `LC_ALL=C /sbin/ifconfig -a`;
my $device = 'NONE';
- my @interfaces;
foreach (split('\n', $ifconfig)) {
- my ($temp) = /(^eth[0-9]*:?[0-9]*).*/;
+ my ($temp) = /(^eth[0-9]*:?[0-9]*)/;
$device = $temp if defined $temp;
- my ($ip, $bcast, $netmask) = /\s*inet addr:([0-9\.]*)\s*Bcast:([0-9\.]*)\s*Mask:([0-9\.]*).*/;
+ my ($ip, $bcast, $netmask) = /\s*inet addr:([0-9\.]*)\s*Bcast:([0-9\.]*)\s*Mask:([0-9\.]*)/;
if (defined $ip && defined $bcast && defined $netmask) {
- $self->{itf}{$device} = {IPADDR => $ip, BROADCAST => $bcast, NETMASK => $netmask};
+ $self->{itf}{$device} = { IPADDR => $ip, BROADCAST => $bcast, NETMASK => $netmask };
my %conf = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-$device");
- $self->{itf}{$device}{$_} = $conf{$_} foreach ('BOOTPROTO');
+ $self->{itf}{$device}{$_} = $conf{$_} foreach 'BOOTPROTO';
}
}
%{$self->{network}} = getVarsFromSh("/etc/sysconfig/network");
@@ -57,8 +56,7 @@ sub new {
}
sub is_dhcp {
- my $self = shift;
- my ($itf) = @_;
+ my ($self, $itf) = @_;
$itf ||= default_itf();
$self->{itf}{$itf}{BOOTPROTO} eq 'dhcp';
@@ -70,17 +68,15 @@ sub default_itf {
}
sub itf_get {
- my $self = shift;
- my ($key, $itf) = @_;
+ my ($self, $key, $itf) = @_;
- $itf ||= default_itf;
+ $itf ||= default_itf();
exists $self->{itf}{$itf}{$key} or print "ERROR: no $key field in $itf hash\n";
$self->{itf}{$itf}{$key}
}
sub network_get {
- my $self = shift;
- my ($key) = @_;
+ my ($self, $key) = @_;
exists $self->{network}{$key} or print "ERROR: no $key field in network hash\n";
$self->{network}{$key}