summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-01-07 13:22:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-01-07 13:22:28 +0000
commitc2f200920f04dba0874c054038770a91a71fbba5 (patch)
tree7448485cea94afcd511535b592b1f061c543f3b9 /perl-install/Xconfig
parent0a813b0ea3c7c30ca81e79b6303f5141e95fee4b (diff)
downloaddrakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar
drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.gz
drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.bz2
drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.tar.xz
drakx-backup-do-not-use-c2f200920f04dba0874c054038770a91a71fbba5.zip
use "if any" instead of "if grep", and various other occurences of "any", "every", "partition"
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/card.pm8
-rw-r--r--perl-install/Xconfig/monitor.pm4
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm10
-rw-r--r--perl-install/Xconfig/xfreeX.pm7
4 files changed, 14 insertions, 15 deletions
diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm
index ece4ef2cb..f90e1cf3a 100644
--- a/perl-install/Xconfig/card.pm
+++ b/perl-install/Xconfig/card.pm
@@ -84,8 +84,8 @@ sub from_raw_X {
my ($xfree3_server) = readlink("$::prefix/etc/X11/X") =~ /XF86_(.*)/;
my $card = {
- use_UTAH_GLX => int(grep { /glx/ } $raw_X->{xfree3}->get_modules),
- use_DRI_GLX => int(grep { /dri/ } $raw_X->{xfree4}->get_modules),
+ use_UTAH_GLX => any { /glx/ } $raw_X->{xfree3}->get_modules,
+ use_DRI_GLX => any { /dri/ } $raw_X->{xfree4}->get_modules),
server => $xfree3_server,
prefer_xf3 => $xfree3_server && !$force_xf4,
%$device,
@@ -284,7 +284,7 @@ sub configure {
$card->{prog} = install_server($card, $options, $do_pkgs);
if ($card->{needVideoRam} && !$card->{VideoRam}) {
- $card->{VideoRam} = first(grep { $_ <= $options->{VideoRam_probed} } reverse ikeys %VideoRams) || 4096;
+ $card->{VideoRam} = (find { $_ <= $options->{VideoRam_probed} } reverse ikeys %VideoRams) || 4096;
$in->ask_from('', N("Select the memory size of your graphics card"),
[ { val => \$card->{VideoRam},
type => 'list',
@@ -361,7 +361,7 @@ sub multi_head_choices {
my @choices;
my $has_multi_head = @cards > 1 || $cards[0]{MULTI_HEAD} > 1;
- my $disable_multi_head = grep {
+ my $disable_multi_head = any {
$_->{Driver} or log::l("found card $_->{description} not supported by XF4, disabling multi-head support");
!$_->{Driver};
} @cards;
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm
index 3d9415dff..8ca3ba935 100644
--- a/perl-install/Xconfig/monitor.pm
+++ b/perl-install/Xconfig/monitor.pm
@@ -133,7 +133,7 @@ sub configure_automatic {
if ($monitor->{EISA_ID}) {
log::l("EISA_ID: $monitor->{EISA_ID}");
- if (my ($mon) = grep { lc($_->{EISA_ID}) eq $monitor->{EISA_ID} } @$monitors) {
+ if (my $mon = find { lc($_->{EISA_ID}) eq $monitor->{EISA_ID} } @$monitors) {
add2hash($monitor, $mon);
log::l("EISA_ID corresponds to: $monitor->{ModelName}");
} elsif (!$monitor->{HorizSync} || !$monitor->{VertRefresh}) {
@@ -141,7 +141,7 @@ sub configure_automatic {
delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'};
}
} else {
- if (my ($mon) = grep { $_->{VendorName} eq $monitor->{VendorName} && $_->{ModelName} eq $monitor->{ModelName} } @$monitors) {
+ if (my $mon = find { $_->{VendorName} eq $monitor->{VendorName} && $_->{ModelName} eq $monitor->{ModelName} } @$monitors) {
put_in_hash($monitor, $mon);
}
}
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
index 1461f64be..ea859b5c7 100644
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ b/perl-install/Xconfig/resolution_and_depth.pm
@@ -163,7 +163,7 @@ sub choices {
#- finding it in @resolutions (well @matching)
#- (that way, we check it exists, and we get field "bios" for fbdev)
my @default_resolutions = sort { $b->{Y} <=> $a->{Y} } grep { $_->{Depth} eq $Depth } @matching;
- my $default_resolution = first(grep { $resolution_wanted->{Y} eq $_->{Y} } @default_resolutions) || $default_resolutions[0];
+ my $default_resolution = (find { $resolution_wanted->{Y} eq $_->{Y} } @default_resolutions) || $default_resolutions[0];
$default_resolution, @resolutions;
}
@@ -243,7 +243,7 @@ sub choose_gtk {
$chosen_y_res = $_[1];
} else {
#- take one
- my ($one) = grep { $_->{X} eq $chosen_x_res } @resolutions;
+ my $one = find { $_->{X} eq $chosen_x_res } @resolutions;
$chosen_y_res = $one->{Y};
}
my $image = $monitor_images_x_res{$chosen_x_res} or internal_error("no image for resolution $chosen_x_res");
@@ -303,9 +303,9 @@ sub choose_gtk {
$x_res_combo->entry->set_text($chosen_x_res . "x" . $chosen_y_res);
$W->main or return;
- first(grep { $_->{X} == $chosen_x_res &&
- $_->{Y} == $chosen_y_res &&
- $_->{Depth} == $chosen_Depth } @resolutions);
+ find { $_->{X} == $chosen_x_res &&
+ $_->{Y} == $chosen_y_res &&
+ $_->{Depth} == $chosen_Depth } @resolutions);
}
1;
diff --git a/perl-install/Xconfig/xfreeX.pm b/perl-install/Xconfig/xfreeX.pm
index 5853342f9..8351c5685 100644
--- a/perl-install/Xconfig/xfreeX.pm
+++ b/perl-install/Xconfig/xfreeX.pm
@@ -118,9 +118,8 @@ sub get_screens {
sub get_default_screen {
my ($raw_X) = @_;
my @l = get_screens($raw_X);
- my @m = grep { $_->{Identifier} && val($_->{Identifier}) eq 'screen1' ||
- $_->{Driver} && val($_->{Driver}) =~ /svga|accel/ } @l;
- first(@m ? @m : @l);
+ (find { $_->{Identifier} && val($_->{Identifier}) eq 'screen1' ||
+ $_->{Driver} && val($_->{Driver}) =~ /svga|accel/ } @l) || $l[0];
}
sub set_screens {
my ($raw_X, @screens) = @_;
@@ -172,7 +171,7 @@ sub get_resolution {
$Screen ||= $raw_X->get_default_screen or return {};
my $depth = val($Screen->{DefaultColorDepth});
- my ($Display) = grep { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return {};
+ my $Display = find { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return {};
val($Display->{l}{Modes}) =~ /(\d+)x(\d+)/ or return {};
{ X => $1, Y => $2, Depth => val($Display->{l}{Depth}) };
}