summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry.Vignaud <thierry.vignaud@gmail.com>2014-05-28 22:37:23 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-05-28 22:37:23 +0200
commitdf74e103d8de6d7cc45cc3e2a99f4b9c8fff6085 (patch)
tree3ce05fa2bbad4d01d0df7a268abab40315b72e22 /perl-install
parentac656a1c73103b06962ab6199da16a8607528c19 (diff)
downloaddrakx-df74e103d8de6d7cc45cc3e2a99f4b9c8fff6085.tar
drakx-df74e103d8de6d7cc45cc3e2a99f4b9c8fff6085.tar.gz
drakx-df74e103d8de6d7cc45cc3e2a99f4b9c8fff6085.tar.bz2
drakx-df74e103d8de6d7cc45cc3e2a99f4b9c8fff6085.tar.xz
drakx-df74e103d8de6d7cc45cc3e2a99f4b9c8fff6085.zip
simplify using member()
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/common.pm2
-rw-r--r--perl-install/fs.pm2
-rw-r--r--perl-install/fs/mount_options.pm2
-rw-r--r--perl-install/fs/wild_device.pm2
-rw-r--r--perl-install/install/any.pm2
-rw-r--r--perl-install/install/media.pm4
-rw-r--r--perl-install/interactive/curses.pm6
-rw-r--r--perl-install/interactive/gtk.pm6
-rw-r--r--perl-install/mirror.pm2
-rw-r--r--perl-install/mygtk2.pm4
-rw-r--r--perl-install/mygtk3.pm4
-rwxr-xr-xperl-install/standalone/drakhelp2
-rwxr-xr-xperl-install/standalone/fileshareset2
-rw-r--r--perl-install/ugtk2.pm6
-rw-r--r--perl-install/ugtk3.pm4
15 files changed, 25 insertions, 25 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 226bc0440..4437f9e7a 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -90,7 +90,7 @@ sub translate_real {
}
# when utf8 pragma is in use, Locale::gettext() returns an utf8 string not tagged as such:
c::set_tagged_utf8($s2) if !utf8::is_utf8($s2) && utf8::is_utf8($s);
- return $s2 if $s ne $s2 && $s2 ne $o_plural;
+ return $s2 if !member($s2, $s, $o_plural);
}
# didn't lookup anything or locale is "C":
$s2;
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index f8b02c9c7..a36027e48 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -298,7 +298,7 @@ sub set_removable_mntpoints {
my %names;
foreach (@{$all_hds->{raw_hds}}) {
my $name = detect_devices::suggest_mount_point($_) or next;
- $name eq 'zip' || $name eq 'cdrom' and next;
+ member($name, qw(zip cdrom)) and next;
my $s = ++$names{$name};
$_->{mntpoint} ||= "/media/$name" . ($s == 1 ? '' : $s);
diff --git a/perl-install/fs/mount_options.pm b/perl-install/fs/mount_options.pm
index 04362fb8c..4fd778b62 100644
--- a/perl-install/fs/mount_options.pm
+++ b/perl-install/fs/mount_options.pm
@@ -38,7 +38,7 @@ sub unpack {
push @{$per_fs{$_}}, 'acl' foreach 'ext2', 'ext3', 'ext4', 'reiserfs';
while (my ($fs, $l) = each %per_fs) {
- $part->{fs_type} eq $fs || $part->{fs_type} eq 'auto' && member($fs, @auto_fs) or next;
+ member($part->{fs_type}, $fs, 'auto') && member($fs, @auto_fs) or next;
$non_defaults->{$_} = 1 foreach @$l;
}
diff --git a/perl-install/fs/wild_device.pm b/perl-install/fs/wild_device.pm
index a886fc0dc..8b18432dd 100644
--- a/perl-install/fs/wild_device.pm
+++ b/perl-install/fs/wild_device.pm
@@ -17,7 +17,7 @@ sub analyze {
'label', $1;
} elsif ($dev =~ /^UUID=(.*)/) {
'uuid', $1;
- } elsif ($dev eq 'none' || $dev eq 'rootfs') {
+ } elsif (member($dev, qw(none rootfs))) {
'virtual';
} elsif ($dev =~ m!^(\S+):/(\w|$)!) {
'nfs';
diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm
index 09f55f200..5187ebc78 100644
--- a/perl-install/install/any.pm
+++ b/perl-install/install/any.pm
@@ -225,7 +225,7 @@ sub ask_mirror {
sub ask_suppl_media_url {
my ($o, $method, $o_url) = @_;
- if ($method eq 'ftp' || $method eq 'http') {
+ if (member($method, qw(ftp http)) {
install::any::ask_mirror($o, 'distrib', $o_url);
} elsif ($method eq 'cdrom') {
'cdrom://';
diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm
index 5857710a8..65cc1403e 100644
--- a/perl-install/install/media.pm
+++ b/perl-install/install/media.pm
@@ -167,7 +167,7 @@ sub stage2_phys_medium {
my $user = $ENV{LOGIN} && ($ENV{LOGIN} . ($ENV{PASSWORD} && ":$ENV{PASSWORD}") . '@');
$ENV{URLPREFIX} = "ftp://$user$ENV{HOST}/$ENV{PREFIX}";
}
- if ($method eq 'http' || $method eq 'ftp') {
+ if (member($method, qw(http ftp))) {
{ method => $method, url => $ENV{URLPREFIX} };
} elsif ($method =~ /(.*)-iso$/) {
my $dir_method = $1;
@@ -834,7 +834,7 @@ sub copy_rpms_on_disk {
sub _get_medium_dir {
my ($phys_m) = @_;
- if ($phys_m->{method} eq 'ftp' || $phys_m->{method} eq 'http' || $phys_m->{method} eq 'cdrom') {
+ if (member($phys_m->{method}, qw(ftp http cdrom))) {
$phys_m->{url};
} else {
"$phys_m->{mntpoint}$phys_m->{rel_path}";
diff --git a/perl-install/interactive/curses.pm b/perl-install/interactive/curses.pm
index 7b81e9e09..b2dc94bc4 100644
--- a/perl-install/interactive/curses.pm
+++ b/perl-install/interactive/curses.pm
@@ -177,7 +177,7 @@ sub compute_size {
$e->{curses}{'-width'} ||= length($s);
} elsif ($e->{type} eq 'expander') {
$e->{curses}{'-width'} ||= length("<+> $e->{text}");
- } elsif ($e->{type} eq 'text' || $e->{type} eq 'label' || $e->{type} eq 'only_label') {
+ } elsif (member($e->{type}, qw(text label only_label))) {
my @text = _messages(min(80, $width_avail - 1), ${$e->{val}}); #- -1 because of the scrollbar
$e->{curses}{'-focusable'} = 0;
$e->{curses}{'-height'} ||= heights(int(@text), 10, 4);
@@ -352,7 +352,7 @@ sub create_widget {
$w->set_binding('focus-up', Curses::KEY_LEFT());
$w->set_binding('focus-down', Curses::KEY_RIGHT());
$set = sub { $w->set_label(0, sprintf('< %s >', may_apply($e->{format}, $_[0]))) };
- } elsif ($e->{type} eq 'list' || $e->{type} eq 'combo') {
+ } elsif (member($e->{type}, qw(list combo))) {
$w = $win->add(undef, $e->{type} eq 'combo' ? 'Popupmenu' : 'Listbox',
'-values' => $e->{formatted_list},
'-onchange' => $onchange->(sub { $e->{list}[$w->id] }),
@@ -405,7 +405,7 @@ sub create_widget {
} elsif ($e->{type} eq 'label' && $e->{curses}{'-height'} == 1) {
$w = $win->add(undef, 'Label', %options);
$set = sub { $w->text($_[0] || '') };
- } elsif ($e->{type} eq 'label' || $e->{type} eq 'only_label' || $e->{type} eq 'text') {
+ } elsif (member($e->{type}, qw(label only_label text))) {
$w = $win->add(undef, 'TextViewer', %options);
$set = sub {
my ($text) = @_;
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index 9b989b84f..98f1eb2a7 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -112,7 +112,7 @@ sub create_treeview_list {
} else {
$e->{may_go_to_next}(), return 1 if $c eq ' ';
- $curr++ if $starting_word eq '' || $starting_word eq $c;
+ $curr++ if member($starting_word, '', $c);
$starting_word .= $c unless $starting_word eq $c;
}
my @l = @{$e->{formatted_list}};
@@ -276,7 +276,7 @@ sub create_treeview_tree {
$next = 1;
} else {
&$toggle and return 1 if $c eq ' ';
- $next = 1 if $starting_word eq '' || $starting_word eq $c;
+ $next = 1 if member($starting_word, '', $c);
$starting_word .= $c unless $starting_word eq $c;
}
my $word = quotemeta $starting_word;
@@ -561,7 +561,7 @@ sub create_widget {
$w->set_active_iter($model->get_iter_from_string($path_str));
};
} else {
- $w->set_text($s) if $s ne $w->get_text && $_[0] ne $w->get_text;
+ $w->set_text($s) if !member($w->get_text, $s, $_[0]);
}
};
} else {
diff --git a/perl-install/mirror.pm b/perl-install/mirror.pm
index f0a54f4d1..1e959f9ac 100644
--- a/perl-install/mirror.pm
+++ b/perl-install/mirror.pm
@@ -106,7 +106,7 @@ sub list {
my @mirrors = grep {
($_->{method}, $_->{host}, $_->{dir}) = $_->{url} =~ m!^(ftp|http)://(.*?)(/.*)!;
- $_->{method} && ($type eq 'all' || $_->{type} eq $type);
+ $_->{method} && (member($type, 'all', $_->{type}));
} @mirrors_raw or log::explanations("no mirrors of type $type"), return;
@mirrors && \@mirrors;
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm
index 779e77e8f..6633decf3 100644
--- a/perl-install/mygtk2.pm
+++ b/perl-install/mygtk2.pm
@@ -1177,7 +1177,7 @@ sub _gtknew_handle_children {
foreach (@child) {
my ($fill, $child) = @$_;
- $fill eq '0' || $fill eq '1' || $fill eq 'fill' || $fill eq 'expand' or internal_error("odd {children} parameter must be 0 or 1 (got $fill)");
+ member($fill, qw(0 1 fill expand)) or internal_error("odd {children} parameter must be 0 or 1 (got $fill)");
ref $child or $child = Gtk2::WrappedLabel->new($child);
my $expand = $fill && $fill ne 'fill' ? 1 : 0;
$w->pack_start($child, $expand, $fill, $padding || 0);
@@ -1198,7 +1198,7 @@ sub mygtk2::MagicWindow::AUTOLOAD {
my ($s1, @s2) = $meth eq 'show'
? ('real_window', 'banner', 'child') :
- $meth eq 'destroy' || $meth eq 'hide' ?
+ member($meth, qw(destroy hide)) ?
($w->{pop_it} ? 'real_window' : ('child', 'banner')) :
$meth eq 'get' && $args[0] eq 'window-position' ||
$for_real_window{$meth} ||
diff --git a/perl-install/mygtk3.pm b/perl-install/mygtk3.pm
index 226427e58..973880d0b 100644
--- a/perl-install/mygtk3.pm
+++ b/perl-install/mygtk3.pm
@@ -1226,7 +1226,7 @@ sub _gtknew_handle_children {
foreach (@child) {
my ($fill, $child) = @$_;
- $fill eq '0' || $fill eq '1' || $fill eq 'fill' || $fill eq 'expand' or internal_error("odd {children} parameter must be 0 or 1 (got $fill)");
+ member($fill, qw(0 1 fill expand)) or internal_error("odd {children} parameter must be 0 or 1 (got $fill)");
ref $child or $child = Gtk3::WrappedLabel->new($child);
my $expand = $fill && $fill ne 'fill' ? 1 : 0;
$w->pack_start($child, $expand, $fill, $padding || 0);
@@ -1261,7 +1261,7 @@ sub mygtk3::MagicWindow::AUTOLOAD {
my ($s1, @s2) = $meth eq 'show'
? ('real_window', 'banner', 'child') :
- $meth eq 'destroy' || $meth eq 'hide' ?
+ member($meth, qw(destroy hide)) ?
($w->{pop_it} ? 'real_window' : ('child', 'banner')) :
$meth eq 'get' && $args[0] eq 'window-position' ||
$for_real_window{$meth} ||
diff --git a/perl-install/standalone/drakhelp b/perl-install/standalone/drakhelp
index cc7aa434c..c2b46979a 100755
--- a/perl-install/standalone/drakhelp
+++ b/perl-install/standalone/drakhelp
@@ -27,7 +27,7 @@ Usage:
exit(0);
}
my ($opt, $idlabel) = @ARGV;
-@ARGV == 2 && ($opt eq '--id' || $opt eq '--doc' || $opt eq '--help') or usage();
+@ARGV == 2 && member($opt, qw(--id --doc --help)) or usage();
diff --git a/perl-install/standalone/fileshareset b/perl-install/standalone/fileshareset
index 9d0cb11ee..167d28165 100755
--- a/perl-install/standalone/fileshareset
+++ b/perl-install/standalone/fileshareset
@@ -93,7 +93,7 @@ my @exports = (
if ($modify) {
my ($cmd, $dir) = @ARGV;
$< = $>;
- @ARGV == 2 && ($cmd eq '--add' || $cmd eq '--remove') or error($usage);
+ @ARGV == 2 && (member($cmd, qw(--add --remove))) or error($usage);
verify_mntpoint($dir);
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 931f377a7..a8e50d319 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -212,7 +212,7 @@ sub gtkpowerpack {
#- attr value directly in the arg list (avoiding confusion between value 0 and Gtk::Label("0"). That can simplify some writings but
#- this arg(s) MUST then be present...
my (%attr, $attrs);
- ref($_[0]) eq 'HASH' || ref($_[0]) eq 'ARRAY' and $attrs = shift;
+ member(ref($_[0]), qw(HASH ARRAY)) and $attrs = shift;
foreach (@attributes_list) {
if (($default_attrs->{$_} || '') eq 'arg') {
ref($_[0]) and internal_error "error in packing definition\n";
@@ -527,7 +527,7 @@ sub create_okcancel {
if (!defined $wm_is_kde) {
require any;
my $wm = any::running_window_manager();
- $wm_is_kde = !$::isInstall && ($wm eq "kwin" || $wm eq "compiz" && fuzzy_pidofs(qr/\bkde-window-decorator\b/)) || 0;
+ $wm_is_kde = !$::isInstall && (member($wm, qw(kwin compiz)) && fuzzy_pidofs(qr/\bkde-window-decorator\b/)) || 0;
}
my $f = sub { $w->{buttons}{$_[0][0]} = ref($_[0][0]) =~ /Gtk2::Button/ ?
$_[0][0] :
@@ -1145,7 +1145,7 @@ sub ask_browse_tree_info_given_widgets {
$w->{tree}->signal_connect(key_press_event => sub {
my $c = chr($_[1]->keyval & 0xff);
- if ($_[1]->keyval >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' ') {
+ if ($_[1]->keyval >= 0x100 ? member($c, "\r", "\x8d") : $c eq ' ') {
$toggle->(0);
}
0;
diff --git a/perl-install/ugtk3.pm b/perl-install/ugtk3.pm
index cd0b45142..4a393ac66 100644
--- a/perl-install/ugtk3.pm
+++ b/perl-install/ugtk3.pm
@@ -290,7 +290,7 @@ That can simplify some writings but this arg(s) MUST then be present...
=cut
my (%attr, $attrs);
- ref($_[0]) eq 'HASH' || ref($_[0]) eq 'ARRAY' and $attrs = shift;
+ member(ref($_[0]), qw(HASH ARRAY)) and $attrs = shift;
foreach (@attributes_list) {
if (($default_attrs->{$_} || '') eq 'arg') {
ref($_[0]) and internal_error "error in packing definition\n";
@@ -602,7 +602,7 @@ sub create_okcancel {
if (!defined $wm_is_kde) {
require any;
my $wm = any::running_window_manager();
- $wm_is_kde = !$::isInstall && ($wm eq "kwin" || $wm eq "compiz" && fuzzy_pidofs(qr/\bkde-window-decorator\b/)) || 0;
+ $wm_is_kde = !$::isInstall && (member($wm, qw(kwin compiz)) && fuzzy_pidofs(qr/\bkde-window-decorator\b/)) || 0;
}
my $f = sub { $w->{buttons}{$_[0][0]} = ref($_[0][0]) =~ /Gtk3::Button/ ?
$_[0][0] :