From 30d441e3847eb11c5de781503af64d38358f5408 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 23 Mar 2012 19:50:35 +0000 Subject: perl_checker cleanups --- perl-install/any.pm | 1 + perl-install/authentication.pm | 12 ++-- perl-install/cpufreq.pm | 4 +- perl-install/devices.pm | 6 +- perl-install/diskdrake/dav.pm | 2 +- perl-install/diskdrake/hd_gtk.pm | 14 ++--- perl-install/diskdrake/smbnfs_gtk.pm | 4 +- perl-install/do_pkgs.pm | 4 +- perl-install/fs/any.pm | 4 +- perl-install/fs/dmcrypt.pm | 4 +- perl-install/fs/dmraid.pm | 6 +- perl-install/fs/format.pm | 4 +- perl-install/fs/mount_options.pm | 2 +- perl-install/fs/mount_point.pm | 2 +- perl-install/fs/partitioning_wizard.pm | 6 +- perl-install/fs/remote/davfs.pm | 12 ++-- perl-install/fs/type.pm | 4 +- perl-install/fs/wild_device.pm | 4 +- perl-install/harddrake/check_snd.pl | 2 +- perl-install/harddrake/data.pm | 4 +- perl-install/install/any.pm | 1 + perl-install/install/commands.pm | 2 +- perl-install/install/media.pm | 8 +-- perl-install/install/pkgs.pm | 4 +- perl-install/install/steps.pm | 3 +- perl-install/install/steps_gtk.pm | 1 + perl-install/install/steps_interactive.pm | 13 +++-- perl-install/interactive/curses.pm | 14 ++--- perl-install/interactive/gtk.pm | 8 +-- perl-install/interactive/stdio.pm | 4 +- perl-install/messages.pm | 2 +- perl-install/mygtk2.pm | 34 +++++------ perl-install/partition_table.pm | 4 +- perl-install/partition_table/bsd.pm | 1 - perl-install/partition_table/dos.pm | 6 +- perl-install/partition_table/raw.pm | 2 +- perl-install/raid.pm | 2 +- perl-install/scanner.pm | 12 ++-- perl-install/services.pm | 4 +- perl-install/standalone.pm | 4 +- perl-install/standalone/drakautoinst | 14 ++--- perl-install/standalone/drakbug | 10 ++-- perl-install/standalone/drakclock | 4 +- perl-install/standalone/drakfont | 4 +- perl-install/standalone/draksec | 12 ++-- perl-install/standalone/draksound | 2 +- perl-install/standalone/drakups | 12 +--- perl-install/standalone/fileshareset | 4 +- .../interactive_http/interactive_http.cgi | 23 ++++---- .../standalone/notify-x11-free-driver-switch | 2 +- perl-install/standalone/scannerdrake | 67 +++++++++++----------- perl-install/standalone/service_harddrake | 2 +- perl-install/timezone.pm | 10 ++-- perl-install/ugtk2.pm | 2 +- 54 files changed, 191 insertions(+), 207 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index ea493cc29..d477d3def 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -969,6 +969,7 @@ sub urpmi_add_all_media { my $log_file = '/root/drakx/updates.log'; run_program::rooted($::prefix, $binary, '>>', $log_file, '2>>', $log_file, @options); + undef $wait; } sub autologin { diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm index 7c7157ce9..bb26d230c 100644 --- a/perl-install/authentication.pm +++ b/perl-install/authentication.pm @@ -113,10 +113,10 @@ sub ask_parameters { {}, { label => N("LDAP Server"), val => \$authentication->{LDAP_server} }, { label => N("Base dn"), val => \$authentication->{LDAPDOMAIN} }, - { val => N("Fetch base Dn "), type => button , clicked_may_quit => sub { $authentication->{LDAPDOMAIN} = fetch_dn($authentication->{LDAP_server}); 0 } }, + { val => N("Fetch base Dn "), type => 'button' , clicked_may_quit => sub { $authentication->{LDAPDOMAIN} = fetch_dn($authentication->{LDAP_server}); 0 } }, {}, { text => N("Use encrypt connection with TLS "), val => \$authentication->{cafile}, type => 'bool' }, - { val => N("Download CA Certificate "), type => button , disabled => sub { !$authentication->{cafile} }, clicked_may_quit => sub { $authentication->{file} = add_cafile(); 0 } }, + { val => N("Download CA Certificate "), type => 'button' , disabled => sub { !$authentication->{cafile} }, clicked_may_quit => sub { $authentication->{file} = add_cafile(); 0 } }, { text => N("Use Disconnect mode "), val => \$authentication->{ccreds}, type => 'bool' }, { text => N("Use anonymous BIND "), val => \$authentication->{anonymous}, type => 'bool' , advanced => 1 }, @@ -168,10 +168,10 @@ my %level = ( {}, { label => N("LDAP Server"), val => \$authentication->{LDAP_server}, disabled => sub { $authentication->{nsskrb} eq "1" } }, { label => N("Base dn"), val => \$authentication->{LDAPDOMAIN} , disabled => sub { $authentication->{nsskrb} eq "1" } }, - { val => N("Fecth base Dn "), type => button , clicked_may_quit => sub { $authentication->{LDAPDOMAIN} = fetch_dn($authentication->{LDAP_server}); 0 }, disabled => sub { $authentication->{nsskrb} eq "1" } }, + { val => N("Fecth base Dn "), type => 'button' , clicked_may_quit => sub { $authentication->{LDAPDOMAIN} = fetch_dn($authentication->{LDAP_server}); 0 }, disabled => sub { $authentication->{nsskrb} eq "1" } }, {}, { text => N("Use encrypt connection with TLS "), val => \$authentication->{cafile}, type => 'bool',, disabled => sub { $authentication->{nsskrb} eq "1" } }, - { val => N("Download CA Certificate "), type => button , disabled => sub { !$authentication->{cafile} }, clicked_may_quit => sub { $authentication->{file} = add_cafile(); 0 } }, + { val => N("Download CA Certificate "), type => 'button' , disabled => sub { !$authentication->{cafile} }, clicked_may_quit => sub { $authentication->{file} = add_cafile(); 0 } }, { text => N("Use anonymous BIND "), val => \$authentication->{anonymous}, type => 'bool', disabled => sub { $authentication->{nsskrb} eq "1" } }, { label => N("Bind DN "), val => \$authentication->{LDAP_binddn}, disabled => sub { !$authentication->{anonymous} } }, { label => N("Bind Password "), val => \$authentication->{LDAP_bindpwd}, disabled => sub { !$authentication->{anonymous} } }, @@ -888,9 +888,8 @@ sub pack_passwd { } sub add_cafile() { - my $file; my $in = interactive->vnew; - $file = $in->ask_filename({ title => N("Select file") }) or return; + $in->ask_filename({ title => N("Select file") }) or return; } sub auth() { @@ -915,7 +914,6 @@ sub list_domains() { } sub get_server_for_domain { my $smb = fs::remote::smb->new; - my %domains; foreach my $server ($smb->find_servers) { return $server->{name} if $server->{group} == $_[0]; } diff --git a/perl-install/cpufreq.pm b/perl-install/cpufreq.pm index 17a39b25e..91fb06d3f 100644 --- a/perl-install/cpufreq.pm +++ b/perl-install/cpufreq.pm @@ -110,9 +110,9 @@ sub probe_powernow_k7() { sub probe_powernow_k8() { any { get_vendor($_) eq "AMD" && ( - ( $_->{'cpu family'} == 15 && ($_->{'power management'} =~ /\bfid\b/ || has_flag($_, 'fid')) ) # frequency ID control) + ($_->{'cpu family'} == 15 && ($_->{'power management'} =~ /\bfid\b/ || has_flag($_, 'fid'))) # frequency ID control) || - ( $_->{'cpu family'} == 16 && ($_->{'power management'} =~ /\bhwpstate\b/ )) # support for Athlon/Phenom II processors (#58477)) + ($_->{'cpu family'} == 16 && ($_->{'power management'} =~ /\bhwpstate\b/)) # support for Athlon/Phenom II processors (#58477)) ); } get_cpus(); } diff --git a/perl-install/devices.pm b/perl-install/devices.pm index ecfb47275..3810f1f05 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -28,7 +28,7 @@ sub set_loop { my $dev = find_free_loop(); if ($o_encrypt_key && $o_encryption) { - eval { modules::load('cryptoloop', 'cbc', if_(arch() =~ /i.86/, 'aes-i586'), if_( arch() =~ /x86_64/, 'aes-x86_64'), 'aes_generic') }; + eval { modules::load('cryptoloop', 'cbc', if_(arch() =~ /i.86/, 'aes-i586'), if_(arch() =~ /x86_64/, 'aes-x86_64'), 'aes_generic') }; my $cmd = "losetup -p 0 -e $o_encryption $dev $file"; log::l("calling $cmd"); open(my $F, "|$cmd"); @@ -111,7 +111,7 @@ sub entry { "ubd/" => sub { c::S_IFBLK(), 98, 0 }, "dm-" => sub { c::S_IFBLK(), get_dynamic_major('device-mapper'), 0 }, }}{$prefix}; - if($f) { + if ($f) { ($type, $major, $minor) = $f->(); $minor += $nb; } @@ -177,7 +177,7 @@ sub entry { # Now device mapper devices are links and do not appear in /proc or /sys unless ($type) { if (-e "/dev/$_") { - my (undef,undef,$mode,undef,undef,undef,$rdev,undef) = stat("/dev/$_"); + my (undef, undef, $mode, undef, undef, undef, $rdev, undef) = stat("/dev/$_"); ($major, $minor) = unmakedev($rdev); $type = $mode & c::S_IFMT(); } diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm index 2760a199a..8ad2421c7 100644 --- a/perl-install/diskdrake/dav.pm +++ b/perl-install/diskdrake/dav.pm @@ -104,7 +104,7 @@ sub options { sub remove { my ($in, $dav, $all_hds) = @_; if ($in->ask_yesorno(N("Warning"), N("Are you sure you want to delete this mount point?"))) { - @{$all_hds->{davs}} = grep($_->{mntpoint} ne $dav->{mntpoint}, @{$all_hds->{davs}}); + @{$all_hds->{davs}} = grep { $_->{mntpoint} ne $dav->{mntpoint} } @{$all_hds->{davs}}; return 1; } return; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 977c32ab7..cb1d5b06a 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -44,7 +44,7 @@ notebook current_kind[] =cut -sub load_theme { +sub load_theme() { my $rc = "/usr/share/libDrakX/diskdrake.rc"; -r $rc or $rc = dirname(__FILE__) . "/../diskdrake.rc"; -r $rc or $rc = dirname(__FILE__) . "/../share/diskdrake.rc"; @@ -149,7 +149,7 @@ sub add_kind2notebook { die if $kind->{main_box}; $kind->{display_box} = gtkset_size_request(Gtk2::HBox->new(0,0), $width, $height); - $kind->{action_box} = gtkset_size_request(Gtk2::VBox->new(), get_action_box_size()); + $kind->{action_box} = gtkset_size_request(Gtk2::VBox->new, get_action_box_size()); $kind->{info_box} = Gtk2::VBox->new(0,0); my $box = gtkpack_(Gtk2::VBox->new(0,7), @@ -222,7 +222,7 @@ sub per_entry_action_box { $w; } diskdrake::interactive::part_possible_actions($in, kind2hd($kind), $entry, $all_hds); - gtkadd($box, create_scrolled_window(gtkpack__(Gtk2::VBox->new(), @buttons), undef, 'none')) if @buttons; + gtkadd($box, create_scrolled_window(gtkpack__(Gtk2::VBox->new, @buttons), undef, 'none')) if @buttons; } else { my $txt = !$::isStandalone && fsedit::is_one_big_fat_or_NT($all_hds->{hds}) ? N("You have one big Microsoft Windows partition. @@ -315,7 +315,7 @@ sub create_buttons4partitions { }; foreach my $entry (@parts) { - if(isRawLUKS($entry) && $entry->{dm_active}) { + if (isRawLUKS($entry) && $entry->{dm_active}) { my $p = find { $entry->{dm_name} eq $_->{dmcrypt_name} } @{$all_hds->{dmcrypts}}; $entry = $p if $p; } @@ -345,7 +345,7 @@ sub create_buttons4partitions { last; } }); - if(isLUKS($entry) || isRawLUKS($entry)) { + if (isLUKS($entry) || isRawLUKS($entry)) { $w->set_image(gtknew("Image", file => "security-strong")); } my @colorized_fs_types = qw(ext3 ext4 xfs swap vfat ntfs ntfs-3g); @@ -366,7 +366,7 @@ sub create_buttons4partitions { # disks: helpers ################################################################################ sub current_hd() { - $current_kind->{type} =~ /hd|lvm/ or die 'current_hd called but $current_kind is not an hd ('.$current_kind->{type}.')'; + $current_kind->{type} =~ /hd|lvm/ or die 'current_hd called but $current_kind is not an hd (' . $current_kind->{type} . ')'; $current_kind->{val}; } sub current_part() { @@ -389,7 +389,7 @@ sub filesystems_button_box() { N_("Other"), N_("Empty")); my %name2fs_type = (Ext3 => 'ext3', Ext4 => 'ext4', 'XFS' => 'xfs', Swap => 'swap', Other => 'other', "Windows" => 'vfat', HFS => 'hfs'); - gtkpack(Gtk2::HBox->new(), + gtkpack(Gtk2::HBox->new, map { my $t = $name2fs_type{$_}; my $w = gtknew('Button', text => translate($_), widget_name => 'PART_' . ($t || 'empty'), diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index d260ce12b..28fc9f2ea 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -87,7 +87,7 @@ sub per_entry_action_box { : gtknew('Label', text => ""); } group_by2(@l); - gtkadd($box, gtknew('HBox', children_loose => [ @buttons])); + gtkadd($box, gtknew('HBox', children_loose => \@buttons)); } sub done { @@ -249,7 +249,7 @@ sub add_smbnfs { gtknew('VBox', spacing => 7, children => [ 1, gtknew('HBox', spacing => 7, children_loose => [ gtkset($kind->{display_box}, width => 200), - $kind->{info_box}]), + $kind->{info_box} ]), 0, $kind->{action_box}, ]); diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index 2e9ac6de0..02761ebcb 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -72,7 +72,7 @@ sub ensure_binary_is_installed { sub ensure_files_are_installed { my ($do, $pkgs, $b_auto) = @_; - my @not_installed = map { my ($package, $file) = @{$_}; -e "$::prefix$file"?():$package } @{$pkgs}; + my @not_installed = map { my ($package, $file) = @$_; -e "$::prefix$file" ? () : $package } @$pkgs; $do->in->ask_okcancel(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @not_installed), 1) or return if !$b_auto && $do->in; @@ -119,7 +119,7 @@ sub check_kernel_module_packages { 'dkms-' . $base_name, map { $base_name . '-kernel-' . bootloader::vmlinuz2version($_) } bootloader::installed_vmlinuz() ); - @rpms = $do->are_available(@test_rpms); + my @rpms = $do->are_available(@test_rpms); @rpms = $do->are_installed(@test_rpms) if !@rpms; @rpms or return; diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm index 65ca02403..c84dc6a38 100644 --- a/perl-install/fs/any.pm +++ b/perl-install/fs/any.pm @@ -89,7 +89,7 @@ sub create_minimal_files() { } sub prepare_minimal_root { - my ($all_hds) = @_; + my ($_all_hds) = @_; fs::any::create_minimal_files(); @@ -98,7 +98,7 @@ sub prepare_minimal_root { eval { fs::mount::usbfs($::prefix) }; # copy all needed devices, for bootloader install and mkinitrd - cp_af("/dev", "$::prefix"); + cp_af('/dev', $::prefix); } sub getAvailableSpace { diff --git a/perl-install/fs/dmcrypt.pm b/perl-install/fs/dmcrypt.pm index a226bcbc7..ae0f71714 100644 --- a/perl-install/fs/dmcrypt.pm +++ b/perl-install/fs/dmcrypt.pm @@ -16,7 +16,7 @@ sub _crypttab() { "$::prefix/etc/crypttab" } sub init() { whereis_binary('cryptsetup') or die "cryptsetup not installed"; - eval { modules::load('dm-crypt', 'xts', 'cbc', 'sha256_generic', if_(arch() =~ /i.86/, 'aes-i586'), if_( arch() =~ /x86_64/, 'aes-x86_64'), 'aes_generic') }; + eval { modules::load('dm-crypt', 'xts', 'cbc', 'sha256_generic', if_(arch() =~ /i.86/, 'aes-i586'), if_(arch() =~ /x86_64/, 'aes-x86_64'), 'aes_generic') }; devices::init_device_mapper(); 1; } @@ -67,7 +67,7 @@ sub format_part { common::with_private_tmp_file($tmp_key_file, $part->{dmcrypt_key}, sub { _run_or_die('--cipher=aes-xts-benbi', '--key-size=512', 'luksFormat', '--batch-mode', devices::make($part->{device}), $_[0]); }); - fs::format::after_formatting($part, 1); + fs::format::after_formatting($part); } sub open_part { diff --git a/perl-install/fs/dmraid.pm b/perl-install/fs/dmraid.pm index a744f01af..80ba3de39 100644 --- a/perl-install/fs/dmraid.pm +++ b/perl-install/fs/dmraid.pm @@ -47,16 +47,16 @@ sub _raid_devices_raw() { log::l("got: $_"); my %l; @l{qw(name size stride level status subsets devs spares)} = split(':'); $vgs{$l{name}} = 1 if defined $l{spares}; - if(/freeing device "(.*)", path "(.*)"/ && defined $vgs{$1}) { + if (/freeing device "(.*)", path "(.*)"/ && defined $vgs{$1}) { log::l("$2 => $1"); - { $2 => $1 }; + { $2 => $1 } } } call_dmraid('-d', '-s', '-c', '-c'); map { chomp; log::l("got: $_"); my %l; @l{qw(pv format vg level status size)} = split(':'); - if(defined $l{size} && defined $l{vg} && defined $pv2vg{$l{pv}} && !defined $vgs{$l{vg}}) { + if (defined $l{size} && defined $l{vg} && defined $pv2vg{$l{pv}} && !defined $vgs{$l{vg}}) { log::l("using $pv2vg{$l{pv}} instead of $l{vg}"); $l{vg} = $pv2vg{$l{pv}}; } diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index de444c694..6e4568da7 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -196,7 +196,7 @@ sub part_raw { delete $part->{device_LABEL_changed}; # Preserve UUID on fs where we couldn't enforce it while formatting - my ($_pkg, $cmd) = @{$preserve_UUID{$fs_type}}; + (undef, $cmd) = @{$preserve_UUID{$fs_type}}; run_program::raw($cmd, '-U', devices::make($dev)) if $cmd; if (member($fs_type, qw(ext3 ext4))) { @@ -241,7 +241,7 @@ sub clean_label { if ($part->{device_LABEL}) { my $fs_type = $part->{fs_type}; if ($LABELs{$fs_type}) { - my ($option, $length, $handled_by_mount) = @{$LABELs{$fs_type}}; + my ($_option, $length, $handled_by_mount) = @{$LABELs{$fs_type}}; if (length $part->{device_LABEL} > $length) { my $short = substr($part->{device_LABEL}, 0, $length); log::l("shortening LABEL $part->{device_LABEL} to $short"); diff --git a/perl-install/fs/mount_options.pm b/perl-install/fs/mount_options.pm index bae101679..29c09ae79 100644 --- a/perl-install/fs/mount_options.pm +++ b/perl-install/fs/mount_options.pm @@ -207,7 +207,7 @@ sub set_default { #- filesystem (e.g, for faster access on the #- news spool to speed up news servers). $options->{relatime} = $options->{noatime} = 0; - $options->{detect_devices::isLaptop() ? 'noatime': 'relatime'} = 1 if !$opts{force_atime}; + $options->{ detect_devices::isLaptop() ? 'noatime' : 'relatime' } = 1 if !$opts{force_atime}; } if ($part->{fs_type} eq 'nfs') { put_in_hash($options, { diff --git a/perl-install/fs/mount_point.pm b/perl-install/fs/mount_point.pm index 8dc4521ae..282b28ab6 100644 --- a/perl-install/fs/mount_point.pm +++ b/perl-install/fs/mount_point.pm @@ -49,7 +49,7 @@ sub suggest_mount_points { sub suggest_mount_points_always { my ($fstab) = @_; - my @win = grep { isFat_or_NTFS($_) && !$_->{isMounted} && maybeFormatted($_) && !$_->{is_removable} && $_->{pt_type} != 0x12 && !isRecovery($_)} @$fstab; + my @win = grep { isFat_or_NTFS($_) && !$_->{isMounted} && maybeFormatted($_) && !$_->{is_removable} && $_->{pt_type} != 0x12 && !isRecovery($_) } @$fstab; log::l("win parts: ", join ",", map { $_->{device} } @win) if @win; if (@win == 1) { #- Suggest /boot/efi on ia64. diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm index 97e7472f5..a275d2774 100644 --- a/perl-install/fs/partitioning_wizard.pm +++ b/perl-install/fs/partitioning_wizard.pm @@ -30,7 +30,7 @@ sub to_Mb { } sub partition_with_diskdrake { - my ($in, $all_hds, $fstab, $manual_fstab, $partitions, $partitioning_flags, $skip_mtab) = @_; + my ($in, $all_hds, $fstab, $manual_fstab, $_partitions, $partitioning_flags, $skip_mtab) = @_; my $ok; do { @@ -48,7 +48,7 @@ sub partition_with_diskdrake { } my @fstab = fs::get::fstab($all_hds); - unless ($root = fs::get::root_(\@fstab)) { + unless (fs::get::root_(\@fstab)) { $ok = 0; $in->ask_okcancel(N("Partitioning"), N("You must have a root partition. To accomplish this, create a partition (or click on an existing one). @@ -501,7 +501,7 @@ sub main { my $mainbox = Gtk2::VBox->new; - my @kinds = map { diskdrake::hd_gtk::hd2kind($_) } sort { $a->{is_removable} <=> $b->{is_removable} } @{$all_hds->{hds} }; + my @kinds = map { diskdrake::hd_gtk::hd2kind($_) } sort { $a->{is_removable} <=> $b->{is_removable} } @{ $all_hds->{hds} }; push @kinds, map { diskdrake::hd_gtk::raid2kind($_) } @{$all_hds->{raids}}; push @kinds, map { diskdrake::hd_gtk::lvm2kind($_) } @{$all_hds->{lvms}}; diff --git a/perl-install/fs/remote/davfs.pm b/perl-install/fs/remote/davfs.pm index 5df0fe771..6c31b9ea6 100644 --- a/perl-install/fs/remote/davfs.pm +++ b/perl-install/fs/remote/davfs.pm @@ -6,7 +6,7 @@ use diagnostics; use common; use fs::mount_options; -sub secrets_file { "$::prefix/etc/davfs2/secrets" } +sub secrets_file() { "$::prefix/etc/davfs2/secrets" } sub fstab_entry_to_credentials { my ($part) = @_; @@ -14,7 +14,7 @@ sub fstab_entry_to_credentials { my ($options, $unknown) = fs::mount_options::unpack($part); my %h = map { $_ => delete $options->{"$_="} } qw(username password); foreach (qw(username password)) { - $h{$_} = 'nobody' if !$h{$_}; + $h{$_} ||= 'nobody'; } $h{mntpoint} = $part->{mntpoint} or return; fs::mount_options::pack_($part, $options, $unknown), \%h; @@ -45,7 +45,7 @@ sub mountpoint_credentials_save { } -sub read_credentials_raw { +sub read_credentials_raw() { from_double_quoted(cat_(secrets_file())); } @@ -66,12 +66,12 @@ sub from_double_quoted { my ($file) = @_; my @l; my @lines = split("\n",$file); - foreach (@lines){ + foreach (@lines) { my ($mnt, $user, $pass, $comment); if (/^\s*(#.*)?$/) { $comment = $1; } else { - if(/^(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))(?:\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+)))?(?:\s*|\s*(#.*))?$/) { + if (/^(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))(?:\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+)))?(?:\s*|\s*(#.*))?$/) { $mnt = "$1$2"; $mnt =~ s/\\(.)/$1/g; $user = "$3$4"; @@ -83,7 +83,7 @@ sub from_double_quoted { die "bad entry $_"; } } - push @l, {'mntpoint'=>$mnt, 'username'=>$user, 'password'=>$pass, 'comment'=>$comment}; + push @l, { 'mntpoint' => $mnt, 'username' => $user, 'password' => $pass, 'comment' => $comment }; } @l; } diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm index 12db643bc..74c4a5a0b 100644 --- a/perl-install/fs/type.pm +++ b/perl-install/fs/type.pm @@ -310,7 +310,7 @@ sub type_subpart_from_magic { $p; } -sub defaultFS { 'ext4' } +sub defaultFS() { 'ext4' } sub true_local_fs_types() { qw(btrfs ext3 ext2 ext4 reiserfs reiser4 xfs jfs) } @@ -332,7 +332,7 @@ sub isRecovery { # Extracted from /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi # Hopefuly we'll ask to hal/udev someday 'RECOVERY', 'PQSERVICE', 'HP_RECOVERY', 'Recovery Partition', 'DellUtility', 'DellRestore', 'IBM_SERVICE', 'SERVICEV001', 'SERVICEV002') - ) + ); } sub isTrueFS { isTrueLocalFS($_[0]) || member($_[0]{fs_type}, qw(nfs)) } diff --git a/perl-install/fs/wild_device.pm b/perl-install/fs/wild_device.pm index efb48d9d7..a1bf98c50 100644 --- a/perl-install/fs/wild_device.pm +++ b/perl-install/fs/wild_device.pm @@ -2,7 +2,7 @@ package fs::wild_device; # $Id: wild_device.pm 268572 2010-05-11 16:42:46Z pterj use diagnostics; use strict; - +use devices; use common; @@ -44,7 +44,7 @@ sub to_subpart { ($part{major}, $part{minor}) = unmakedev($rdev); } - my $symlink = readlink("$::prefix$dev") unless $dev =~ m!mapper/!; + my $symlink = $dev =~ m!mapper/! ? readlink("$::prefix$dev") : undef; $dev =~ s!/u?dev/!!; if ($symlink && $symlink !~ m!^/!) { diff --git a/perl-install/harddrake/check_snd.pl b/perl-install/harddrake/check_snd.pl index dfa007b80..4721bed40 100755 --- a/perl-install/harddrake/check_snd.pl +++ b/perl-install/harddrake/check_snd.pl @@ -10,7 +10,7 @@ use list_modules; my @listed_modules = @{$list_modules::l{multimedia}{sound}}; my @drivers = (keys %harddrake::sound::oss2alsa, keys %harddrake::sound::alsa2oss); -my @alternatives = uniq map { @{$_} } values %harddrake::sound::oss2alsa, values %harddrake::sound::alsa2oss; +my @alternatives = uniq map { @$_ } values %harddrake::sound::oss2alsa, values %harddrake::sound::alsa2oss; # check harddrake::sound's data structures're coherent print "unknown alternative drivers : [", join(', ', difference2(\@alternatives, \@drivers)), "]\n"; diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm index afad37117..cbc43d8be 100644 --- a/perl-install/harddrake/data.pm +++ b/perl-install/harddrake/data.pm @@ -570,9 +570,7 @@ sub custom_id { N("cpu # ") . $device->{processor} . ": " . $device->{'model name'} : $device->{"Socket Designation"} ? "$device->{name} (" . $device->{"Socket Designation"} . ")" : - $device->{name} ? $device->{name} : - (($device->{description}) ? $device->{description} : - (($device->{Vendor}) ? $device->{Vendor} : $str))); + $device->{name} || $device->{description} || $device->{Vendor} || $str); } 1; diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm index d1e4fc847..8cd9159d5 100644 --- a/perl-install/install/any.pm +++ b/perl-install/install/any.pm @@ -906,6 +906,7 @@ sub generate_automatic_stage1_params { $method = $1; #- in stage1, FTP via HTTP proxy is available through FTP config, not HTTP @ks = (server => $2, directory => $3); } elsif ($o->{method} eq 'ftp') { + require install::ftp; my @l = install::ftp::parse_ftp_url($ENV{URLPREFIX}); @ks = (server => $l[0], directory => $l[1], user => $l[2], pass => $l[3]); } elsif ($o->{method} eq 'nfs') { diff --git a/perl-install/install/commands.pm b/perl-install/install/commands.pm index 55e1f103e..154a9cfb1 100644 --- a/perl-install/install/commands.pm +++ b/perl-install/install/commands.pm @@ -412,7 +412,7 @@ sub bug { require install::any; $part = $in->ask_from_listf('', "Which device?", \&partition_table::description, - [ install::any::removable_media__early_in_install() ] ) or return; + [ install::any::removable_media__early_in_install() ]) or return; } warn "putting file report.bug on $part->{device}\n"; diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm index 95a5728ff..27b931266 100644 --- a/perl-install/install/media.pm +++ b/perl-install/install/media.pm @@ -486,11 +486,11 @@ sub _parse_media_cfg { sub select_only_some_media { my ($media_list, $selected_names) = @_; my @names = split(',', $selected_names); - foreach my $m (@{$media_list}) { + foreach my $m (@$media_list) { my $bool = !member($m->{name}, @names); # workaround urpmi transforming "ignore => ''" or "ignore => 0" into "ignore => 1": undef $bool if !$bool; - log::l "disabling '$m->{name}' medium: " . to_bool($bool); + log::l("disabling '$m->{name}' medium: " . to_bool($bool)); urpm::media::_tempignore($m, $bool); # make sure we update un-ignored media (eg: */Testing and the like): $m->{modified} = 1 if !$bool; @@ -715,13 +715,13 @@ sub get_standalone_medium { } sub _get_medium { - my ($in_wait, $phys_m, $packages, $m) = @_; + my ($_in_wait, $phys_m, $packages, $m) = @_; !$m->{ignore} or log::l("ignoring packages in $m->{rel_hdlist}"), return; my $url = _get_media_url({}, $phys_m); log::l("trying '$url'\n"); - urpm::media::add_medium($packages, $m->{name} || 'Supplementary medium', $url) or $packages->{fatal}(10, N("unable to add medium")); + urpm::media::add_medium($packages, $m->{name} || 'Supplementary medium', $url, 0) or $packages->{fatal}(10, N("unable to add medium")); } diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index 63e33021d..9ce16831f 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -528,7 +528,7 @@ sub computeGroupSize { if (find { $_->flag_available } @choices_pkgs) { @choices = (); #- one package is already selected (?) } else { - @choices = map { $_->id } packageCallbackChoices($packages, undef, undef, \@choices_pkgs, $virtual); + @choices = map { $_->id } packageCallbackChoices($packages, undef, undef, \@choices_pkgs, $virtual, undef); } } push @l2, @choices; @@ -761,7 +761,7 @@ sub is_package_installed { } sub _install_raw { - my ($packages, $isUpgrade, $callback, $LOG, $noscripts) = @_; + my ($packages, $_isUpgrade, $callback, $LOG, $noscripts) = @_; # prevent warnings in install's logs: local $ENV{LC_ALL} = 'C'; diff --git a/perl-install/install/steps.pm b/perl-install/install/steps.pm index 2d9d15200..c9d2dde5c 100644 --- a/perl-install/install/steps.pm +++ b/perl-install/install/steps.pm @@ -753,8 +753,9 @@ sub read_bootloader_config { sub setupBootloaderBefore { my ($o) = @_; + my $bool = $o->{meta_class} ne 'server'; any::setupBootloaderBefore($o->do_pkgs, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{keyboard}, - $o->{allowFB}, $o->{vga}, ($o->{meta_class} ne 'server') x 2); + $o->{allowFB}, $o->{vga}, $bool, $bool); } sub setupBootloader { diff --git a/perl-install/install/steps_gtk.pm b/perl-install/install/steps_gtk.pm index 49f68e9b8..9893d1c75 100644 --- a/perl-install/install/steps_gtk.pm +++ b/perl-install/install/steps_gtk.pm @@ -497,6 +497,7 @@ sub choosePackagesTree { interactive_help => sub { interactive::gtk::display_help($o, { interactive_help_id => + # FIXME: missing ref to upper window: 'choosePackages#choosePackagesTree' }, my $w) }, ok => N("Install"), diff --git a/perl-install/install/steps_interactive.pm b/perl-install/install/steps_interactive.pm index d89885fba..9ce558f64 100644 --- a/perl-install/install/steps_interactive.pm +++ b/perl-install/install/steps_interactive.pm @@ -53,7 +53,7 @@ sub acceptLicense { my ($o) = @_; return if $o->{useless_thing_accepted}; - any::acceptLicense($o, $o->{meta_class} eq 'powerpack'); + any::acceptLicense($o); } sub selectLanguage { @@ -484,6 +484,7 @@ sub _chooseDesktop { my $default_choice = (find { $rpmsrate_flags_chosen->{"CAT_" . $_->[0]} } @l) || $l[0]; my $choice = $default_choice; if ($o->isa('interactive::gtk')) { + # perl_checker: require install::steps_gtk $choice = install::steps_gtk::reallyChooseDesktop($o, $title, $message, \@l, $default_choice); } else { $o->ask_from_({ title => $title, message => $message }, [ @@ -582,7 +583,7 @@ sub chooseGroups { my $suggests; $o->ask_from_({ title => N("Type of install"), - message =>N("You have not selected any group of packages. + message => N("You have not selected any group of packages. Please choose the minimal installation you want:"), interactive_help_id => 'choosePackages#minimal-install' }, @@ -732,7 +733,7 @@ sub configureNetwork { #------------------------------------------------------------------------------ sub installUpdates { my ($o) = @_; - my $u = $o->{updates} ||= {}; + $o->{updates} ||= {}; $o->hasNetwork or return; @@ -850,8 +851,10 @@ sub summary { group => N("System"), label => N("Bootloader"), val => sub { - #-PO: example: lilo-graphic on /dev/hda1 - $o->{bootloader}{boot} ? N("%s on %s", $o->{bootloader}{method}, $o->{bootloader}{boot}) : N("None"); + + $o->{bootloader}{boot} ? + #-PO: example: lilo-graphic on /dev/hda1 + N("%s on %s", $o->{bootloader}{method}, $o->{bootloader}{boot}) : N("None"); }, clicked => sub { any::setupBootloader($o, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{security}) or return; diff --git a/perl-install/interactive/curses.pm b/perl-install/interactive/curses.pm index 9a50522aa..81e0f0459 100644 --- a/perl-install/interactive/curses.pm +++ b/perl-install/interactive/curses.pm @@ -34,9 +34,9 @@ sub new { $cui ||= Curses::UI->new('-color_support' => 1); # Set some default terminal size, for serial install - unless ($cui->{-width}) { - $cui->{-width} = $cui->{-w} = $cui->{-bw} = 80; - $cui->{-height} = $cui->{-h} = $cui->{-bh} = 25; + unless ($cui->{'-width'}) { + $cui->{'-width'} = $cui->{'-w'} = $cui->{'-bw'} = 80; + $cui->{'-height'} = $cui->{'-h'} = $cui->{'-bh'} = 25; } bless { cui => $cui }, $class; @@ -552,7 +552,7 @@ sub ask_fileW { $dir = $opts->{directory} || $opts->{file} && dirname($opts->{file}); - if($opts->{save}) { + if ($opts->{save}) { $file = $o->{cui}->savefilebrowser('-title' => $opts->{title}, '-path' => $dir, '-file' => basename($file)); } else { $file = $o->{cui}->loadfilebrowser('-title' => $opts->{title}, '-path' => $dir, '-file' => basename($file)); @@ -561,13 +561,13 @@ sub ask_fileW { my $err; if (!$file) { $err = N("No file chosen"); - } elsif(-f $file && $opts->{want_a_dir}) { + } elsif (-f $file && $opts->{want_a_dir}) { $file = dirname($file); - } elsif(-d $file && !$opts->{want_a_dir}) { + } elsif (-d $file && !$opts->{want_a_dir}) { $err = N("You have chosen a directory, not a file"); } elsif (!-e $file && !$opts->{save}) { $err = $opts->{want_a_dir} ? N("No such directory") : N("No such file"); - }; + } $err and $o->ask_warn('', $err) or $file; } diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 4648c2d6b..9ca5b3b72 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -452,9 +452,7 @@ sub create_widget { if (my $actions = $e->{add_modify_remove}) { my @buttons = (N_("Add"), N_("Modify"), N_("Remove")); # Add Up/Down buttons if their actions are defined - foreach (qw(Up Down)) { - push @buttons, 'gtk-go-' . $_ if $actions->{$_}; - } + push @buttons, map { if_($actions->{$_}, 'gtk-go-' . $_) } qw(Up Down); @buttons = map { my $button = /^gtk-/ ? gtknew('Button', image => gtknew('Image', stock => lc($_))) : Gtk2::Button->new(translate($_)); @@ -485,7 +483,7 @@ sub create_widget { if_($images, gtknew('HButtonBox', layout => 'spread', - children_loose => [ map { $_->{button} } @$images] + children_loose => [ map { $_->{button} } @$images ] ) ), ), @@ -664,7 +662,7 @@ sub create_widgets_block { ]); } - my $eater = gtknew('Label') if $e->{alignment} eq 'right' && !$label_w; + my $eater = if_($e->{alignment} eq 'right' && !$label_w, gtknew('Label')); $e->{real_w} = gtkpack_(Gtk2::HBox->new, if_($e->{icon}, 0, eval { gtkcreate_img($e->{icon}) }), diff --git a/perl-install/interactive/stdio.pm b/perl-install/interactive/stdio.pm index 3d4370c2a..9c72f45db 100644 --- a/perl-install/interactive/stdio.pm +++ b/perl-install/interactive/stdio.pm @@ -63,7 +63,7 @@ ask_fromW_begin: my @labels; my $format_label = sub { my ($e) = @_; return sprintf("`%s' %s %s\n", ${$e->{val}}, $e->{label}, $e->{text}) }; my $do_widget = sub { - my ($e, $ind) = @_; + my ($e, $_ind) = @_; if ($e->{type} eq 'bool') { print "$e->{text} $e->{label}\n"; @@ -170,7 +170,7 @@ sub wait_messageW { print join "\n", $message, $message_modifiable; } sub wait_message_nextW { - my $m = join "\n", $_[1]; + my $m = $_[1]; print "\r$m", ' ' x (60 - length $m); } sub wait_message_endW { print "\nDone\n" } diff --git a/perl-install/messages.pm b/perl-install/messages.pm index 6047b4729..1b04d55cb 100644 --- a/perl-install/messages.pm +++ b/perl-install/messages.pm @@ -5,7 +5,7 @@ use strict; use common; -sub main_license { +sub main_license() { #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N("Introduction diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 73f223f0e..f6f80949c 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -146,7 +146,7 @@ sub _gtk { } sub _gtk__Install_Button { - my ($w, $opts, $class) = @_; + my ($w, $opts, $_class) = @_; $opts->{child} = gtknew('HBox', spacing => 5, children_tight => [ # FIXME: not RTL compliant (lang::text_direction_rtl() ? ...) @@ -296,7 +296,7 @@ sub _gtk__HSeparator { &_gtk_any_simple } sub _gtk__Calendar { &_gtk_any_simple } sub _gtk__DrawingArea { - my ($w, $opts) = @_; + my ($w, $_opts) = @_; if (!$w) { $w = Gtk2::DrawingArea->new; @@ -358,7 +358,7 @@ sub _gtk__Image { 0, 0, $w->{x}, $w->{y}, $width, $height, 'max', 0, 0); return; } - foreach my $rect($event->region->get_rectangles) { + foreach my $rect ($event->region->get_rectangles) { my @values = $rect->values; $pixbuf->render_to_drawable($w->window, $w->style->fg_gc('normal'), @values[0..1], $w->{x}+$values[0], $w->{y}+$values[1], @values[2..3], 'max', 0, 0); @@ -388,7 +388,7 @@ sub _gtk__Image { sub _gtk__WrappedLabel { my ($w, $opts) = @_; - $opts->{line_wrap} = 1 if not defined $opts->{line_wrap}; + $opts->{line_wrap} = 1 if !defined $opts->{line_wrap}; _gtk__Label($w, $opts); } @@ -441,7 +441,7 @@ sub _gtk__Label { sub _gtk__Alignment { - my ($w, $opts) = @_; + my ($w, $_opts) = @_; if (!$w) { $w = Gtk2::Alignment->new(0, 0, 0, 0); @@ -584,7 +584,7 @@ sub _gtk__TextView { } sub _gtk__WebKit_View { - my ($w, $opts, $_class, $action) = @_; + my ($w, $opts, $_class, $_action) = @_; if (!$w) { $w = Gtk2::WebKit::WebView->new; } @@ -666,7 +666,7 @@ sub _gtk__ScrolledWindow { $w->add_with_viewport($child); } $child->set_focus_vadjustment($w->get_vadjustment) if $child->can('set_focus_vadjustment'); - $child->set_left_margin(6) if ref($child) =~ /Gtk2::TextView/ && $child->get_left_margin() <= 6; + $child->set_left_margin(6) if ref($child) =~ /Gtk2::TextView/ && $child->get_left_margin <= 6; $child->show; $w->child->set_shadow_type(delete $opts->{shadow_type}) if exists $opts->{shadow_type}; @@ -721,14 +721,14 @@ sub _gtk__Expander { sub _gtk__MDV_Notebook { - my ($w, $opts, $_class, $action) = @_; + my ($w, $opts, $_class, $_action) = @_; if (!$w) { import_style_ressources(); my ($layout, $selection_arrow, $selection_bar); my $parent_window = delete $opts->{parent_window} || root_window(); - my $root_height = first($parent_window->get_size()); - my $suffix = $root_height eq 800 && !$::isStandalone ? '_600' : '_768'; + my $root_height = first($parent_window->get_size); + my $suffix = $root_height == 800 && !$::isStandalone ? '_600' : '_768'; # the white square is a little bit above the actual left sidepanel: my $offset = 20; my $is_flip_needed = text_direction_rtl(); @@ -739,11 +739,11 @@ sub _gtk__MDV_Notebook { my @right_background = $::isInstall ? gtknew('Image', file => "right-white-background_left_part$suffix", flip => $is_flip_needed) : map { - gtknew('Image', file => "right-white-background_left_part-$_", flip => $is_flip_needed) + gtknew('Image', file => "right-white-background_left_part-$_", flip => $is_flip_needed); } 1, 2, 2, 3; my $width1 = $left_background->{pixbuf}->get_width; my $total_width = $width1 + $right_background[0]->get_pixbuf->get_width; - my $arrow_x = text_direction_rtl() ? $offset/2 -4 : $width1 - $offset -3; + my $arrow_x = text_direction_rtl() ? $offset/2 - 4 : $width1 - $offset - 3; $w = gtknew('HBox', spacing => 0, children => [ 0, $layout = gtknew('Layout', width => $total_width - $offset, children => [ #Layout Fixed # stacking order is important for "Z-buffer": @@ -789,7 +789,7 @@ sub _gtk__MDV_Notebook { sub _gtk__Fixed { - my ($w, $opts, $_class, $action) = @_; + my ($w, $opts, $_class, $_action) = @_; if (!$w) { $w = Gtk2::Fixed->new; @@ -819,7 +819,7 @@ sub _gtknew_handle_layout_children { delete $opts->{children}; if ($opts->{pixbuf_file}) { - my $pixbuf = gtknew('Pixbuf', file => delete $opts->{pixbuf_file}) if $opts->{pixbuf_file}; + my $pixbuf = if_($opts->{pixbuf_file}, gtknew('Pixbuf', file => delete $opts->{pixbuf_file})); $w->signal_connect( realize => sub { ugtk2::set_back_pixbuf($w, $pixbuf); @@ -1269,7 +1269,7 @@ sub _create_Window { }) if $special_center; } - $w->present() if $no_Window_Manager; + $w->present if $no_Window_Manager; $w; } @@ -1395,7 +1395,7 @@ sub asteriskize { } sub get_main_window_size() { - my ($width, $height) = $::real_windowwidth ? ($::real_windowwidth, $::real_windowheight) : $::isWizard ? (540, 360) : (600, 400); + $::real_windowwidth ? ($::real_windowwidth, $::real_windowheight) : $::isWizard ? (540, 360) : (600, 400); } # in order to workaround infamous 6 years old gnome bug #101968: @@ -1519,7 +1519,7 @@ sub import_style_ressources() { } sub text_direction_rtl() { - Gtk2::Widget->get_default_direction() eq 'rtl'; + Gtk2::Widget->get_default_direction eq 'rtl'; } sub _get_weakness_icon { diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 1e594ddf5..d6c6b60fc 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -405,9 +405,9 @@ sub tell_kernel { my ($action, $part_number, $o_start, $o_size) = @$_; if ($action eq 'add') { - $force_reboot ||= !c::add_partition(fileno $F, $part_number, $o_start, $o_size); + $force_reboot ||= !c::add_partition(fileno($F), $part_number, $o_start, $o_size); } elsif ($action eq 'del') { - $force_reboot ||= !c::del_partition(fileno $F, $part_number); + $force_reboot ||= !c::del_partition(fileno($F), $part_number); } log::l("tell kernel $action ($hd->{device} $part_number $o_start $o_size) force_reboot=$force_reboot rebootNeeded=$hd->{rebootNeeded}"); } diff --git a/perl-install/partition_table/bsd.pm b/perl-install/partition_table/bsd.pm index f69cae97c..55e598e42 100644 --- a/perl-install/partition_table/bsd.pm +++ b/perl-install/partition_table/bsd.pm @@ -144,7 +144,6 @@ sub initialize { my ($class, $hd) = @_; $hd->{primary} = { raw => [ ({}) x $nb_primary ], info => info($hd) }; bless $hd, $class; -; } sub first_usable_sector { 2048 } diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm index 2cd6fe311..59439e1d4 100644 --- a/perl-install/partition_table/dos.pm +++ b/perl-install/partition_table/dos.pm @@ -220,14 +220,14 @@ sub read_one { sysread $F, $tmp, length $magic or die "error reading magic number on disk $hd->{device}"; $tmp eq $magic or die "bad magic number on disk $hd->{device}"; - if(c::get_disk_type($hd->{file}) ne "msdos") { + if (c::get_disk_type($hd->{file}) ne "msdos") { # libparted may have ignored it because of overlapping partitions or other error # while it is actually a partition table. $hd->{fs_type_from_magic} and die "unpartitionned disk"; my $primary = partition_table::raw::pt_info_to_primary($hd, [ @pt ]); foreach my $i (@{$primary->{normal}}) { - if (($i->{active} && $i->{active} != 0x80) || - ($hd->{totalsectors} && $i->{start} > $hd->{totalsectors})) { + if ($i->{active} && $i->{active} != 0x80 || + $hd->{totalsectors} && $i->{start} > $hd->{totalsectors}) { die "Invalid DOS partition table"; } } diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index ed89595b3..0438fda5a 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -122,7 +122,7 @@ sub get_geometries { $geom{start} = 1; compute_nb_cylinders(\%geom, $total); $geom{totalcylinders} = $geom{cylinders}; - log::l("Fake geometry on ".$_->{file}.": heads=$geom{heads} sectors=$geom{sectors} cylinders=$geom{cylinders} start=$geom{start}"); + log::l("Fake geometry on " . $_->{file} . ": heads=$geom{heads} sectors=$geom{sectors} cylinders=$geom{cylinders} start=$geom{start}"); add2hash_($_, { totalsectors => $total, geom => \%geom }); 1; } elsif (my $h = get_geometry($_->{file})) { diff --git a/perl-install/raid.pm b/perl-install/raid.pm index cb814bd9b..5270d2218 100644 --- a/perl-install/raid.pm +++ b/perl-install/raid.pm @@ -140,7 +140,7 @@ sub make { '--chunk=' . $part->{'chunk-size'}, "--level=$part->{level}", "--raid-devices=$nb", - if_($part->{'metadata'}, "--metadata=$part->{'metadata'}"), + if_($part->{metadata}, "--metadata=$part->{metadata}"), map { devices::make($_->{device}) } @{$part->{disks}}); if (my $raw_part = get_md_info($dev)) { diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm index f57c7001c..12958dd20 100644 --- a/perl-install/scanner.pm +++ b/perl-install/scanner.pm @@ -180,7 +180,7 @@ sub nonroot_access_for_parport { # Is saned running? my $sanedrunning = services::starts_on_boot("saned"); # Is the "net" SANE backend active - my $netbackendactive = grep { /^\s*net\s*$/ } + my $netbackendactive = find { /^\s*net\s*$/ } cat_("/etc/sane.d/dll.conf"); # Set this to 1 to tell the caller that the list of locally available # scanners has changed (Here if the SANE client configuration has @@ -279,13 +279,13 @@ sub detect { $productid = $3; } if ($vendorid && $productid) { - my ($vendor) = ($vendorid =~ /0x([0-9a-f]+)/); - my ($id) = ($productid =~ /0x([0-9a-f]+)/); + my ($vendor) = $vendorid =~ /0x([0-9a-f]+)/; + my ($id) = $productid =~ /0x([0-9a-f]+)/; my ($device) = grep { sprintf("%04x", $_->{vendor}) eq $vendor && sprintf("%04x", $_->{id}) eq $id } @devices; if ($device) { $driver = $device->{driver}; - $real_device = $device + $real_device = $device; } else { #warn "Failed to lookup $vendorid and $productid!\n"; } @@ -567,10 +567,10 @@ sub updateScannerDBfromSane { next if $f =~ /unsupported.desc$/; # Treat unsupported.desc in the end $f = "$sanesrcdir/doc/descriptions/unsupported.desc" if - ($f eq "UNSUPPORTED"); + $f eq "UNSUPPORTED"; my $F = common::openFileMaybeCompressed($f); $to_add .= "\n# from $f"; - my ($lineno, $cmd, $val) = 0; + my ($lineno, $cmd, $val); my ($name, $intf, $comment, $mfg, $backend); my $fs = { backend => sub { $backend = $val }, diff --git a/perl-install/services.pm b/perl-install/services.pm index 203e4154b..6a77844e9 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -303,9 +303,7 @@ sub _set_service { $service = $service . ".service"; } run_program::rooted($::prefix, "systemctl", $enable ? "enable" : "disable", $service); - } - else - { + } else { my $script = "/etc/rc.d/init.d/$service"; run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); #- FIXME: handle services with no chkconfig line and with no Default-Start levels in LSB header diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index 33ad126aa..b138d62f7 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -134,7 +134,7 @@ sub __exit { } -sub real_version { +sub real_version() { return "VER"; # version automatically set from Makefile } @@ -206,7 +206,7 @@ sub bug_handler { $ctrace =~ s/0:.*(\d+:[^:]*Perl_sighandler)/\1/sig if $ctrace =~ /0:.*(\d+:[^:]*Perl_sighandler)/sig; $error .= "\nGlibc's trace:\n$ctrace\n"; } - $error .= "Perl's trace:\n". common::backtrace() if $error; + $error .= "Perl's trace:\n" . common::backtrace() if $error; my $progname = $0; diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst index 5ea9427d5..e1d27a72a 100755 --- a/perl-install/standalone/drakautoinst +++ b/perl-install/standalone/drakautoinst @@ -185,10 +185,10 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { my $local_page = $nb_pages; my $function = sub { $notebook->set_current_page($local_page) }; gtksignal_connect($button, toggled => sub { - $button->get_active and $function->() + $button->get_active and $function->(); }); my $b; - if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { undef $b }; + if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { undef $b } gtksignal_connect(gtkadd($button, gtkpack__(Gtk2::VBox->new(0,3), $b, @@ -200,9 +200,9 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { $button->set_active(1); $box->{active_function} = $function; $function->(); - }) + }); } @{$tree{$_}} - ) + ); } keys(%tree) ) ), @@ -296,7 +296,7 @@ sub h2widget { } else { $w = create_packtable({ col_spacings => 10, row_spacings => 3 }, map { create_entry_element($k->{$_}, "$label\{$_}", $_) } @list_keys - ) + ); } } elsif (ref($k) =~ /ARRAY/) { my $vb; @@ -341,7 +341,7 @@ sub create_entry_element { eval $exe; }); } - [ $label ? "$label : " : "" , $e ] + [ $label ? "$label : " : "" , $e ]; } sub control_buttons { @@ -366,5 +366,5 @@ sub control_buttons { $i >= 0 or $button_remove->set_sensitive(0); } ) - ) + ); } diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index 0c20313e8..a6adb6c5a 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -116,7 +116,7 @@ sub is_a_boot_issue() { sub format_trace_with_message { my ($message, $trace) = @_; - ([ $message ], [ "\n\n " . join("\n ", split("\n", $trace)) . "\n\n", { family => 'monospace' }]); + ([ $message ], [ "\n\n " . join("\n ", split("\n", $trace)) . "\n\n", { family => 'monospace' } ]); } my @commands = 'lspcidrake -v'; @@ -144,7 +144,7 @@ gtkadd($window->{window}, [ N("Used theme: %s", $theme_name) . "\n\n" ], [ N("To submit a bug report, click on the report button. \nThis will open a web browser window on %s where you'll find a form to fill in. The information displayed above will be transferred to that server", - $wizard_name). "\n" . + $wizard_name) . "\n" . P("It would be very useful to attach to your report the output of the following command: %s.", "Things useful to attach to your report are the output of the following commands: %s.", scalar(@commands), @@ -193,7 +193,7 @@ $button_pkg->signal_connect('clicked', sub { $package->set_text($pkg_name); }); -$button_browse->signal_connect('file-set', sub { $com_app->set_text($button_browse->get_filename()) }); +$button_browse->signal_connect('file-set', sub { $com_app->set_text($button_browse->get_filename) }); $window->{window}->show_all; $window->main; @@ -260,7 +260,7 @@ sub report_bug_to_bugzilla() { $cpuinfo = $1; } my $arch = arch(); - $arch = 'i586' if arch =~ /^i.86/; + $arch = 'i586' if arch() =~ /^i.86/; my $options = join('&', ($product || $version ? 'cf_rpmpkg=' . join('-', $product, $version) : ()), 'version=' . ($rel_data->{branch} eq 'Devel' ? 'Cauldron' : $rel_data->{version}), @@ -277,7 +277,7 @@ sub report_bug_to_bugzilla() { qq(The "$prog" program crashed. Drakbug-$rel caught it. ) . ($text || "Please describe what you were doing when it crashed.") . "\n\n" - . ($error ? $error : + . ($error || qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)) ) . qq( diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock index 7b13dd764..482548d38 100755 --- a/perl-install/standalone/drakclock +++ b/perl-install/standalone/drakclock @@ -93,7 +93,7 @@ $my_win->{window}->add(gtknew('VBox', border_width => $::isEmbedded ? 0 : 5, chi 1, gtknew('Frame', text => N("Timezone"), shadow_type => 'etched_in', child => gtknew('VBox', border_width => 5, children_tight => [ $label_timezone, - $button_time])), + $button_time ])), ]), ]), 0, create_okcancel(my $w = @@ -168,7 +168,7 @@ $time_box->set_direction('ltr'); my $servers = get_server(); $combo_ntpserver->set_popdown_strings(@$servers); -if (-e $ntpfile && ( -e $ntpdsystemdlock || -e $ntpdlock)) { +if (-e $ntpfile && (-e $ntpdsystemdlock || -e $ntpdlock)) { $ntp = timezone::ntp_server(); $ntp and ntp_widget_state(1); my $fullntp = $ntp; diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index f9337cb93..3e4212984 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -373,7 +373,7 @@ sub put_font_dir() { my $dir = "$drakfont_dir/$subdir"; move_fonts("$drakfont_dir/tmp/tmp", "../../$subdir", $subdir); run_program::run($_, $dir) foreach qw(mkfontscale mkfontdir), $fccache; - symlinkf($dir, '/etc/X11/fontpath.d/drakfont_' . basename ($dir)); + symlinkf($dir, '/etc/X11/fontpath.d/drakfont_' . basename($dir)); } interactive_progress($pbar2, 1, N("done")); @@ -519,7 +519,7 @@ sub help() { $license =~ s/\n/\n\n/sg; # nicer formatting my $w = gtknew('AboutDialog', name => N("Drakfont"), version => mageia_release_info()->{version}, - copyright => N("Copyright (C) %s by %s", 'Mandriva', '2001-2008') ."\n" .N("Copyright (C) %s by %s", N("Mageia"), '2011') . "\n", + copyright => N("Copyright (C) %s by %s", 'Mandriva', '2001-2008') . "\n" . N("Copyright (C) %s by %s", N("Mageia"), '2011') . "\n", license => $license, wrap_license => 1, comments => N("Font installer."), website => 'http://www.mageia.org', diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index cf7d50a2a..b5fd5d5ca 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -41,14 +41,13 @@ use security::l10n; #/^-?-(\S+)$/ and $options{$1} = 1 foreach @ARGV; -my $in = 'interactive'->vnew('su'); +my $_in = 'interactive'->vnew('su'); # enforce being root $ugtk2::wm_icon = "/usr/share/mcc/themes/default/draksec-mdk.png"; -my ($w, %fields); +my ($w); ############################ I18N ################################### -my @help; my %translations = ( 'ALL' => N("ALL"), @@ -65,9 +64,6 @@ sub to_i18n { map { $translations{$_} || $_ } @_ } sub from_i18n { $inv_translations{$_[0]} || $_[0] } sub resize { gtkset($_[0], width => 50) } -%fields = security::l10n::fields(); -my %inv_fields = reverse %fields; - # factorize this with rpmdrake and harddrake2 sub wait_msg { my $mainw = ugtk2->new(N("Please wait"), (modal => 1, transient => $w->{real_window})); @@ -87,7 +83,7 @@ sub new_nonedit_combo { gtknew('ComboBox', text => to_i18n($o_default_value), list => [ to_i18n(@$string_list) ]); } -my $msec = new security::msec; +#my $msec = security::msec->new; $w = ugtk2->new(N("Security Level and Checks")); my $window = $w->{window}; @@ -179,7 +175,7 @@ my %descr = ( gtkpack_($vbox, 0, gtkshow(gtknew('VBox', spacing => 5, children => [ if_(!$::isEmbedded, 0, Gtk2::Banner->new('/usr/share/mcc/themes/default/drakperm-mdk.png', N("Permissions"))), - 0, gtknew('Label', text => $auth_string, alignment => [ 0.5, 0]) + 0, gtknew('Label', text => $auth_string, alignment => [ 0.5, 0 ]) ])), 1, gtkshow(create_scrolled_window( gtknew('VBox', children => [ diff --git a/perl-install/standalone/draksound b/perl-install/standalone/draksound index 01c1df5af..6a8e899ea 100755 --- a/perl-install/standalone/draksound +++ b/perl-install/standalone/draksound @@ -48,7 +48,7 @@ if (my @devices = detect_devices::probe_category('multimedia/sound')) { $in->ask_warn(N("No Sound Card detected!"), formatAlaTeX( #-PO: keep the double empty lines between sections, this is formatted a la LaTeX - N("No Sound Card has been detected on your machine. Please verify that a Linux-supported Sound Card is correctly plugged in"). + N("No Sound Card has been detected on your machine. Please verify that a Linux-supported Sound Card is correctly plugged in") . N("\n\n\nNote: if you've an ISA PnP sound card, you'll have to use the alsaconf or the sndconfig program. Just type \"alsaconf\" or \"sndconfig\" in a console."))); diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups index a52384e67..8557aceff 100755 --- a/perl-install/standalone/drakups +++ b/perl-install/standalone/drakups @@ -236,8 +236,8 @@ sub edit_callback { sub del_callback { my ($model, $list) = @_; - my (undef, $iter) = $list->get_selection->get_selected; - my $removed_idx = $model->get($iter, 0); # 1st column is index + #my (undef, $iter) = $list->get_selection->get_selected; + #my $removed_idx = $model->get($iter, 0); # 1st column is index #@rules = grep { $_->{index} ne $removed_idx } @rules; #$tree->remove($iter); #sensitive_buttons(0); @@ -341,7 +341,7 @@ my $_msg = N("Welcome to the UPS configuration tools"); $w->{window}->add(gtkpack_(Gtk2::VBox->new, if_(!$::isEmbedded, 0, Gtk2::Banner->new('drakups', N("DrakUPS"))), 1, my $nb = Gtk2::Notebook->new, - 0, create_okcancel(my $oc = + 0, create_okcancel( { ok_clicked => sub { #$_->{save}->() foreach @pages; @@ -357,12 +357,6 @@ $w->{window}->add(gtkpack_(Gtk2::VBox->new, #------------------------------------------------------------------ # build the notebook -my %labels = ( - add => N("Add"), - edit => N("Edit"), - remove => N("Remove"), - ); - foreach my $i (@pages) { my $model = $models{$i->{id}} = Gtk2::ListStore->new("Glib::Int", ("Glib::String") x listlength(@{$i->{columns}})); my (%buttons, $list); diff --git a/perl-install/standalone/fileshareset b/perl-install/standalone/fileshareset index 77e0139c9..b5dcbfb16 100755 --- a/perl-install/standalone/fileshareset +++ b/perl-install/standalone/fileshareset @@ -153,7 +153,7 @@ sub read_conf { $conf{$cmd} = $value || warn qq(suspicious line "$_" in $authorisation_file\n); } # no close $F_lock, keep it locked - \%conf + \%conf; } sub check { @@ -170,7 +170,7 @@ sub check { # ok, access granted for everybody } else { my @l; - while (@l = getgrent) { + while (@l = getgrent()) { last if $l[0] eq $authorisation_group; } ::member($username, split(' ', $l[3])) or ::error($non_authorised); diff --git a/perl-install/standalone/interactive_http/interactive_http.cgi b/perl-install/standalone/interactive_http/interactive_http.cgi index 4da796719..24899c451 100755 --- a/perl-install/standalone/interactive_http/interactive_http.cgi +++ b/perl-install/standalone/interactive_http/interactive_http.cgi @@ -8,7 +8,7 @@ use c; my $q = CGI->new; $| = 1; -my $script_name = $q->url(-relative => 1); +my $script_name = $q->url('-relative' => 1); # name inversed (must be in sync with interactive_http.html) my $pipe_r = "/tmp/interactive_http_w"; @@ -27,24 +27,23 @@ if ($q->param('state') eq 'new') { error("booh..."); } -sub read_ { - local *F; - open F, "<$pipe_r" or error("Failed to connect to the prog"); +sub read_() { + open my $F, "<$pipe_r" or error("Failed to connect to the prog"); my $t; - print $t while sysread F, $t, 1; + print $t while sysread $F, $t, 1; } -sub write_ { +sub write_() { local *F; open F, ">$pipe_w" or die; my $q = CGI->new; $q->save(\*F); } -sub first_step { read_() } -sub next_step { write_(); read_() } +sub first_step() { read_() } +sub next_step() { write_(); read_() } -sub force_exit_dead_prog { +sub force_exit_dead_prog() { -p $pipe_w or return; { local *F; @@ -65,7 +64,7 @@ sub spawn_server { my @authorised_progs = map { chomp_($_) } cat_('/etc/drakxtools_http/authorised_progs'); member($prog, @authorised_progs) or error("You tried to call a non-authorised program"); - fork and return; + fork() and return; $ENV{INTERACTIVE_HTTP} = $script_name; @@ -78,9 +77,9 @@ sub spawn_server { } sub error { - print $q->header(), $q->start_html(); + print $q->header, $q->start_html; print $q->h1(N("Error")), @_; - print $q->end_html(), "\n"; + print $q->end_html, "\n"; exit 0; } diff --git a/perl-install/standalone/notify-x11-free-driver-switch b/perl-install/standalone/notify-x11-free-driver-switch index e871d2ee9..30c42f82c 100755 --- a/perl-install/standalone/notify-x11-free-driver-switch +++ b/perl-install/standalone/notify-x11-free-driver-switch @@ -8,7 +8,7 @@ $::isStandalone = 0; my $in = 'interactive'->vnew; my $driver = eval { require Xconfig::xfree; - $raw_X = Xconfig::xfree->read; + my $raw_X = Xconfig::xfree->read; $raw_X->get_Driver; } || N("unknown"); diff --git a/perl-install/standalone/scannerdrake b/perl-install/standalone/scannerdrake index 3a4bfea49..da7376813 100755 --- a/perl-install/standalone/scannerdrake +++ b/perl-install/standalone/scannerdrake @@ -29,10 +29,8 @@ use scanner; use handle_configs; use services; -my $companyname = "%s"; my $distroname = "%s"; my $shortdistroname = "%s"; -my $domainname = "mageia.org"; foreach (@ARGV) { /^--update-usbtable$/ and do { scanner::updateScannerDBfromUsbtable(); exit() }; @@ -94,7 +92,7 @@ sub auto() { my $changed = 0; foreach (@f) { my $c = 0; - if (member($_->{val}{DESCRIPTION}, keys %$scanner::scannerDB)) { + if (exists $scanner::scannerDB->{$_->{val}{DESCRIPTION}}) { my $name = $_->{val}{DESCRIPTION}; $name =~ s/\s$//; # some HP entries have a trailing space, i will correct usbtable asap if ($scanner::scannerDB->{$name}{flags}{unsupported}) { @@ -102,11 +100,11 @@ sub auto() { next; } if ($in->ask_yesorno(N("Confirmation"), N("%s found on %s, configure it automatically?", removeverticalbar($name), $_->{port}),1)) { - $c = (tryConfScanner($name, $_->{port}, + $c = tryConfScanner($name, $_->{port}, $_->{val}{vendor}, $_->{val}{id}) || manual($_->{port}, $_->{val}{vendor}, - $_->{val}{id}, $name)); + $_->{val}{id}, $name); } else { $c = manual($_->{port}, $_->{val}{vendor}, $_->{val}{id}, $name); @@ -149,10 +147,10 @@ sub dynamic() { @f = scanner::detect(); my $name; foreach (@f) { - if (member($_->{val}{DESCRIPTION}, keys %$scanner::scannerDB)) { + if (exists $scanner::scannerDB->{$_->{val}{DESCRIPTION}}) { $name = $_->{val}{DESCRIPTION}; $name =~ s/\s$//; #some HP entry have a trailing space, i will correct usbtable asap - next if ($scanner::scannerDB->{$name}{flags}{unsupported}); + next if $scanner::scannerDB->{$name}{flags}{unsupported}; if (my @modules = @{$scanner::scannerDB->{$name}{kernel}}) { modules::load(@modules); modules::append_to_modules_loaded_at_startup_for_all_kernels(@modules); @@ -195,8 +193,8 @@ sub installfirmware { return ""; } # Let user select a firmware file from a floppy, hard disk, ... - $firmware = $in->ask_file(N("Select firmware file"), "$dir"); - last if !$firmware || (-r $firmware); + $firmware = $in->ask_file(N("Select firmware file"), $dir); + last if !$firmware || -r $firmware; $in->ask_warn(N("Error"), N("The firmware file %s does not exist or is unreadable!", $firmware)); @@ -212,9 +210,9 @@ sub updatefirmware { my $firmware; my @scanners = map { - $_->{val}{DESCRIPTION} + $_->{val}{DESCRIPTION}; } grep { - $_->{val}{FIRMWARELINE} + $_->{val}{FIRMWARELINE}; } @configured; my ($scannerchoice, $mediachoice); while (1) { @@ -254,8 +252,8 @@ sub updatefirmware { } # Let user select a firmware file from a floppy, hard disk, ... $firmware = $in->ask_file(N("Select firmware file for the %s", - $scannerchoice), "$dir"); - last if !$firmware || (-r $firmware); + $scannerchoice), $dir); + last if !$firmware || -r $firmware; $in->ask_warn(N("Error"), N("The firmware file %s does not exist or is unreadable!", $firmware)); @@ -276,7 +274,7 @@ sub updatefirmware { return 0; } # Enter the path to the firmware in the appropriate config file - my $firmwareline =$_->{val}{FIRMWARELINE}; + my $firmwareline = $_->{val}{FIRMWARELINE}; $firmwareline =~ s/\$FIRMWARE/$firmware/sg; scanner::setfirmware($backend, $firmwareline); last; @@ -302,18 +300,18 @@ sub tryConfScanner { $in->ask_warn(N("Warning"), N("The %s must be configured by system-config-printer.\nYou can launch system-config-printer from the %s Control Center in Hardware section.", removeverticalbar($model), $shortdistroname)); return 0; } - my @modules = (); + my @modules; if (defined($scanner::scannerDB->{$model}{kernel})) { - push(@modules, @{$scanner::scannerDB->{$model}{kernel}}); - } elsif ((defined($scanner::scannerDB->{$model}{scsikernel})) && - ($scanner::scannerDB->{$model}{driver} =~ /SCSI/i)) { - push(@modules, @{$scanner::scannerDB->{$model}{scsikernel}}); - } elsif ((defined($scanner::scannerDB->{$model}{usbkernel})) && - ($scanner::scannerDB->{$model}{driver} =~ /USB/i)) { - push(@modules, @{$scanner::scannerDB->{$model}{usbkernel}}); - } elsif ((defined($scanner::scannerDB->{$model}{parportkernel})) && - ($scanner::scannerDB->{$model}{driver} =~ /Parport/i)) { - push(@modules, @{$scanner::scannerDB->{$model}{parportkernel}}); + push @modules, @{$scanner::scannerDB->{$model}{kernel}}; + } elsif (defined($scanner::scannerDB->{$model}{scsikernel}) && + $scanner::scannerDB->{$model}{driver} =~ /SCSI/i) { + push @modules, @{$scanner::scannerDB->{$model}{scsikernel}}; + } elsif (defined($scanner::scannerDB->{$model}{usbkernel}) && + $scanner::scannerDB->{$model}{driver} =~ /USB/i) { + push @modules, @{$scanner::scannerDB->{$model}{usbkernel}}; + } elsif (defined($scanner::scannerDB->{$model}{parportkernel}) && + $scanner::scannerDB->{$model}{driver} =~ /Parport/i) { + push @modules, @{$scanner::scannerDB->{$model}{parportkernel}}; } if ($#modules >= 0) { my $wait = $in->wait_message(N("Please wait"), @@ -321,8 +319,7 @@ sub tryConfScanner { foreach my $m (@modules) { eval { modules::load($m) }; if (!$@) { - modules::append_to_modules_loaded_at_startup_for_all_kernels - ($m); + modules::append_to_modules_loaded_at_startup_for_all_kernels($m); } } } @@ -395,7 +392,7 @@ sub tryConfScanner { ($vendor, $product) = scanner::get_usb_ids_for_port($port); my $firmware; my $server = $scanner::scannerDB->{$model}{server}; - if (grep { /FIRMWARELINE/ } @{$scanner::scannerDB->{$model}{lines}} ) { + if (any { /FIRMWARELINE/ } @{$scanner::scannerDB->{$model}{lines}}) { $firmware = installfirmware($model, $server); return 0 if $firmware eq "///"; } @@ -475,13 +472,13 @@ sub mainwindow { $buttonclicked = "manualadd"; 1; } }, - ( (grep { $_->{val}{FIRMWARELINE} } @configured) ? + ((any { $_->{val}{FIRMWARELINE} } @configured) ? { val => N("Install/Update firmware files"), type => 'button', clicked_may_quit => sub { $buttonclicked = "firmware"; 1; - } } : () ), + } } : ()), { val => N("Scanner sharing"), type => 'button', clicked_may_quit => sub { @@ -576,7 +573,7 @@ sub sharewindow { my $sanedrunning = services::starts_on_boot("saned"); my $oldsanedrunning = $sanedrunning; # Is the "net" SANE backend active - my $netbackendactive = grep { /^\s*net\s*$/ } + my $netbackendactive = find { /^\s*net\s*$/ } cat_("/etc/sane.d/dll.conf"); my $oldnetbackendactive = $netbackendactive; # Set this to 1 to tell the caller that the list of locally available @@ -668,7 +665,7 @@ sub sharewindow { 1; }, disabled => sub { - return ($#list < 0); + return $#list < 0; } }, { val => N("Remove selected host"), type => 'button', @@ -677,7 +674,7 @@ sub sharewindow { 1; }, disabled => sub { - return ($#list < 0); + return $#list < 0; } }, { val => N("Done"), type => 'button', @@ -818,7 +815,7 @@ sub sharewindow { 1; }, disabled => sub { - return ($#list < 0); + return $#list < 0; } }, { val => N("Remove selected host"), type => 'button', @@ -827,7 +824,7 @@ sub sharewindow { 1; }, disabled => sub { - return ($#list < 0); + return $#list < 0; } }, { val => N("Done"), type => 'button', diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index 2e5c0abbb..e575f6098 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -114,7 +114,7 @@ sub find_xorg_driver { || -e "/usr/$lib/xorg/extra-modules/${new_driver}_drv.so"; } -sub after_x_driver_switch { +sub after_x_driver_switch() { # If a wrong driver is loaded, ask for a reboot. my $reboot_needed = -x "/sbin/display_driver_helper" && system("/sbin/display_driver_helper", "--check-loaded") != 0; if (!$reboot_needed) { diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index 76a907cc0..b419fa66c 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -195,7 +195,7 @@ sub print_ntp_servers() { $ntp_servers{""} = { N_("Global") => "pool.ntp.org", }; -$ntp_servers{"Global"} = { +$ntp_servers{Global} = { N_("Africa") => "africa.pool.ntp.org", N_("Asia") => "asia.pool.ntp.org", N_("Europe") => "europe.pool.ntp.org", @@ -203,11 +203,11 @@ $ntp_servers{"Global"} = { N_("Oceania") => "oceania.pool.ntp.org", N_("South America") => "south-america.pool.ntp.org", }; -$ntp_servers{"Africa"} = { +$ntp_servers{Africa} = { N_("South Africa") => "za.pool.ntp.org", N_("Tanzania") => "tz.pool.ntp.org", }; -$ntp_servers{"Asia"} = { +$ntp_servers{Asia} = { N_("Bangladesh") => "bd.pool.ntp.org", N_("China") => "cn.pool.ntp.org", N_("Hong Kong") => "hk.pool.ntp.org", @@ -225,7 +225,7 @@ $ntp_servers{"Asia"} = { N_("Turkey") => "tr.pool.ntp.org", N_("United Arab Emirates") => "ae.pool.ntp.org", }; -$ntp_servers{"Europe"} = { +$ntp_servers{Europe} = { N_("Austria") => "at.pool.ntp.org", N_("Belarus") => "by.pool.ntp.org", N_("Belgium") => "be.pool.ntp.org", @@ -263,7 +263,7 @@ $ntp_servers{"North America"} = { N_("Mexico") => "mx.pool.ntp.org", N_("United States") => "us.pool.ntp.org", }; -$ntp_servers{"Oceania"} = { +$ntp_servers{Oceania} = { N_("Australia") => "au.pool.ntp.org", N_("New Zealand") => "nz.pool.ntp.org", }; diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index b36927411..364bea2c9 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -523,7 +523,7 @@ sub create_okcancel { $bprev = $w->{cancel} = gtknew('Button', text => $cancel, clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk2->main_quit }); } - $w->{wizcancel} = gtknew('Button', text => ($::Wizard_skip ? N("Skip") : N("Cancel")), clicked => sub { die 'wizcancel' }) if $::isWizard && !$::isInstall && !$::Wizard_no_cancel;; + $w->{wizcancel} = gtknew('Button', text => ($::Wizard_skip ? N("Skip") : N("Cancel")), clicked => sub { die 'wizcancel' }) if $::isWizard && !$::isInstall && !$::Wizard_no_cancel; if (!defined $wm_is_kde) { require any; my $wm = any::running_window_manager(); -- cgit v1.2.1