Fix stupid use of length(@) when I meant scalar(@)
authorJamie Cameron <jcameron@webmin.com>
Fri, 17 Dec 2010 20:16:14 +0000 (12:16 -0800)
committerJamie Cameron <jcameron@webmin.com>
Fri, 17 Dec 2010 20:16:14 +0000 (12:16 -0800)
50 files changed:
bind8/bind8-lib.pl
cfengine/cfengine-lib.pl
cron/cron-lib.pl
dovecot/dovecot-lib.pl
fdisk/fdisk-lib.pl
frox/frox-lib.pl
htaccess-htpasswd/htaccess-lib.pl
ipsec/ipsec-lib.pl
ldap-client/ldap-client-lib.pl
ldap-client/switch-lib.pl
ldap-server/ldap-server-lib.pl
ldap-useradmin/ldap-useradmin-lib.pl
lilo/lilo-lib.pl
lpadmin/freebsd-lib.pl
lpadmin/linux-lib.pl
lpadmin/lprng-lib.pl
mailboxes/mailboxes-lib.pl
mailcap/mailcap-lib.pl
miniserv.pl
mscstyle3/index.cgi
mscstyle3/theme.pl
mscstyle_mini/index.cgi
mscstyle_mini/theme.pl
msctheme-enhanced/index.cgi
msctheme-enhanced/theme.pl
mysql/mysql-lib.pl
osx-theme/theme.pl
package-updates/package-updates-lib.pl
postfix/postfix-lib.pl
pserver/edit_access.cgi
qmailadmin/index.cgi
qmailadmin/qmail-lib.pl
quota/cgi_args.pl
raid/raid-lib.pl
rbac/rbac-lib.pl
sarg/sarg-lib.pl
sendmail/access-lib.pl
sendmail/domain-lib.pl
sendmail/generics-lib.pl
sendmail/mailers-lib.pl
sendmail/virtusers-lib.pl
sentry/save_hostsentry.cgi
spam/spam-lib.pl
status/nut-monitor.pl
status/sensors-monitor.pl
syslog-ng/syslog-ng-lib.pl
updown/download.cgi
updown/upload.cgi
useradmin/user-lib.pl
zones/zones-lib.pl

index 4b2913d..8ad8bd8 100755 (executable)
@@ -1960,7 +1960,7 @@ if ($changed || !$filecount || $znc{'version'} != $zone_names_version ||
        }
 
 # Use in-memory cache
-if (length(@list_zone_names_cache)) {
+if (scalar(@list_zone_names_cache)) {
        return @list_zone_names_cache;
        }
 
index 17b52ea..535b2da 100755 (executable)
@@ -29,7 +29,7 @@ $cfrun_hosts = $config{'cfrun_hosts'} ? $config{'cfrun_hosts'} :
 # a list of classes, each containing options for the section type.
 sub get_config
 {
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
        @get_config_cache = &get_config_file($cfengine_conf);
        }
 return \@get_config_cache;
@@ -39,7 +39,7 @@ return \@get_config_cache;
 # Parses the cfd.conf file
 sub get_cfd_config
 {
-if (!length(@get_cfd_config_cache)) {
+if (!scalar(@get_cfd_config_cache)) {
        @get_cfd_config_cache = &get_config_file($cfd_conf);
        }
 return \@get_cfd_config_cache;
index 11f1f34..945bb82 100755 (executable)
@@ -59,7 +59,7 @@ reference with the following keys :
 sub list_cron_jobs
 {
 local (@rv, $lnum, $f);
-if (length(@cron_jobs_cache)) {
+if (scalar(@cron_jobs_cache)) {
        return @cron_jobs_cache;
        }
 
index 5e54fb5..2850802 100755 (executable)
@@ -13,7 +13,7 @@ use WebminCore;
 # Returns a list of dovecot config entries
 sub get_config
 {
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
        @get_config_cache = ( );
        local $lnum = 0;
        local ($section, @sections);
index 5eed83a..ba9c66c 100755 (executable)
@@ -26,7 +26,7 @@ $| = 1;
 # Returns a structure containing the details of all disks and partitions
 sub list_disks_partitions
 {
-if (length(@list_disks_partitions_cache)) {
+if (scalar(@list_disks_partitions_cache)) {
        return @list_disks_partitions_cache;
        }
 
@@ -872,7 +872,7 @@ if ($raid_module) {
                }
        }
 if ($lvm_module) {
-       if (!length(@physical_volumes)) {
+       if (!scalar(@physical_volumes)) {
                @physical_volumes = ();
                foreach $vg (&foreign_call("lvm", "list_volume_groups")) {
                        push(@physical_volumes,
index 24e65c0..73866d1 100755 (executable)
@@ -9,7 +9,7 @@ use WebminCore;
 # Returns an array reference containing the contents of the Frox config file
 sub get_config
 {
-    if (!length(@get_config_cache)) {
+    if (!scalar(@get_config_cache)) {
            local $lnum = 0;
            open(CONF, $config{'frox_conf'});
            while(<CONF>) {
index d5d3325..be72d26 100755 (executable)
@@ -30,7 +30,7 @@ else {
        if (&supports_users()) {
                # Include user home
                @uinfo = getpwnam($remote_user);
-               if ($access{'home'} && length(@uinfo)) {
+               if ($access{'home'} && scalar(@uinfo)) {
                        push(@accessdirs, &resolve_links($uinfo[7]));
                        }
                }
index d92b051..219d155 100755 (executable)
@@ -353,7 +353,7 @@ return undef;
 # Returns a list of IPsec secret keys
 sub list_secrets
 {
-if (!length(@list_secrets_cache)) {
+if (!scalar(@list_secrets_cache)) {
        local (@lines);
        local $lnum = 0;
        open(SEC, $config{'secrets'});
index 25f9638..9c9b34a 100755 (executable)
@@ -12,7 +12,7 @@ use WebminCore;
 sub get_config
 {
 local $file = $_[0] || $config{'auth_ldap'};
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
        local $lnum = 0;
        @get_config_cache = ( );
        &open_readfile(CONF, $file);
index f1ed651..9a54977 100755 (executable)
@@ -6,7 +6,7 @@ $nsswitch_config_file = $config{'nsswitch_conf'} || "/etc/nsswitch.conf";
 # Returns an array ref of information from nsswitch.conf
 sub get_nsswitch_config
 {
-if (!length(@get_nsswitch_cache)) {
+if (!scalar(@get_nsswitch_cache)) {
        @get_nsswitch_cache = ( );
        local $lnum = 0;
        open(CONF, $nsswitch_config_file);
index 8887ec0..9fa9c13 100755 (executable)
@@ -635,7 +635,7 @@ sub check_ldap_permissions
 {
 local @uinfo;
 if ($config{'data_dir'} && $config{'ldap_user'} &&
-    length(@uinfo = getpwnam($config{'ldap_user'}))) {
+    scalar(@uinfo = getpwnam($config{'ldap_user'}))) {
        opendir(DATADIR, $config{'data_dir'});
        local @datafiles = grep { !/^\./ } readdir(DATADIR);
        closedir(DATADIR);
index 9a9a2a4..bea116f 100755 (executable)
@@ -169,7 +169,7 @@ else {
 # Returns a list of users, in the same format as the useradmin module
 sub list_users
 {
-if (!length(@list_users_cache)) {
+if (!scalar(@list_users_cache)) {
        local $ldap = &ldap_connect();
        local $base = &get_user_base();
        local $rv = $ldap->search(base => $base,
@@ -213,7 +213,7 @@ local $rv = $ldap->add($_[0]->{'dn'}, attr => \@attrs);
 if ($rv->code) {
        &error(&text('usave_eadd', $rv->error));
        }
-push(@list_users_cache, $_[0]) if (length(@list_users_cache));
+push(@list_users_cache, $_[0]) if (scalar(@list_users_cache));
 $ldap->unbind();
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
@@ -230,7 +230,7 @@ if ($rv->code) {
        }
 $ldap->unbind();
 @list_users_cache = grep { $_ ne $_[0] } @list_users_cache
-        if (length(@list_users_cache));
+        if (scalar(@list_users_cache));
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
 
@@ -292,7 +292,7 @@ $ldap->unbind();
 # Returns a list of groups, in the same format as the useradmin module
 sub list_groups
 {
-if (!length(@list_groups_cache)) {
+if (!scalar(@list_groups_cache)) {
        local $ldap = &ldap_connect();
        local $base = &get_group_base();
        local $rv = $ldap->search(base => $base,
@@ -325,7 +325,7 @@ local $rv = $ldap->add($_[0]->{'dn'}, attr => \@attrs);
 if ($rv->code) {
        &error(&text('gsave_eadd', $rv->error));
        }
-push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (scalar(@list_groups_cache));
 $ldap->unbind();
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
@@ -342,7 +342,7 @@ if ($rv->code) {
        }
 $ldap->unbind();
 @list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
-        if (length(@list_groups_cache));
+        if (scalar(@list_groups_cache));
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
 
index ae6d27e..e7c53db 100755 (executable)
@@ -20,7 +20,7 @@ if (open(VERSION, "$module_config_directory/version")) {
 # Parses lilo.conf and returns a list of directives
 sub get_lilo_conf
 {
-return @lilo_conf_cache if (length(@lilo_conf_cache));
+return @lilo_conf_cache if (scalar(@lilo_conf_cache));
 open(CONF, $config{'lilo_conf'});
 local $lnum = -1;
 local ($image, $line);
index 1038cc0..14a74d7 100755 (executable)
@@ -177,7 +177,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
 local(@rv, @line, $line, $cont, $lnum, $i, %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
        next if (!$capfile || $done{$capfile}++);
index 709b9de..b8bcab3 100755 (executable)
@@ -212,7 +212,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
 local(@rv, @line, @comment, @eline, @sline, $line, $cont, $lnum, $i,
       %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
index a230f0c..1443616 100755 (executable)
@@ -255,7 +255,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (length(@list_printcap_cache));
+return @list_printcap_cache if (scalar(@list_printcap_cache));
 local(@rv, @line, @comment, $line, $cont, $lnum, $i, %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
        next if (!$capfile || $done{$capfile}++);
index 2c54df3..2cd1af7 100755 (executable)
@@ -201,7 +201,7 @@ return &list_user_folders(@_);
 # mail file in home dir, and maildir in home dir
 sub get_mail_style
 {
-if (!length(@mail_style_cache)) {
+if (!scalar(@mail_style_cache)) {
        if ($config{'auto'}) {
                # Based on mail server
                if ($config{'mail_system'} == 1) {
index d6cd2c5..cdd6422 100755 (executable)
@@ -19,7 +19,7 @@ else {
 # Returns a list of /etc/mailcap entries
 sub list_mailcap
 {
-if (!length(@list_mailcap_cache)) {
+if (!scalar(@list_mailcap_cache)) {
   @list_mailcap_cache = ( );
   open(CAP, $mailcap_file);
   local $lnum = 0;
index 2d69ec0..cca9c76 100755 (executable)
@@ -3508,12 +3508,12 @@ if (!$uinfo) {
        return ( undef, 0, 1, undef ) if (!@uinfo && !$pamany);
 
        if (@uinfo) {
-               if (length(@allowusers)) {
+               if (scalar(@allowusers)) {
                        # Only allow people on the allow list
                        return ( undef, 0, 0, undef )
                                if (!&users_match(\@uinfo, @allowusers));
                        }
-               elsif (length(@denyusers)) {
+               elsif (scalar(@denyusers)) {
                        # Disallow people on the deny list
                        return ( undef, 0, 0, undef )
                                if (&users_match(\@uinfo, @denyusers));
index c78eaee..e12271f 100755 (executable)
@@ -22,7 +22,7 @@ else {
 
 # Redirect if the user has only one module
 @msc_modules = &get_visible_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 
 if (!defined($in{'cat'})) {
        # Maybe redirect to some module after login
index 57efc82..edacd3f 100755 (executable)
@@ -219,7 +219,7 @@ if (@_ > 0) {
     }
 
 @msc_modules = &get_visible_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 
 print "</head>\n";
 local $dir = $current_lang_info->{'dir'} ? "dir=\"$current_lang_info->{'dir'}\""
index 909d9f7..1a6f9c1 100755 (executable)
@@ -16,7 +16,7 @@ else {
 
 # Redirect if the user has only one module
 @msc_modules = &get_visible_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 if (@msc_modules == 1 && $gconfig{'gotoone'}) {
        &redirect("$msc_modules[0]->{'dir'}/");
        exit;
index fb059c6..618b6c2 100755 (executable)
@@ -52,7 +52,7 @@ if (@_ > 0) {
     }
 
 @msc_modules = &get_visible_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 
 print '<body bgcolor=#424242 link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
 
index de1bf74..50c060f 100755 (executable)
@@ -21,7 +21,7 @@ else {
 
 # Redirect if the user has only one module
 @msc_modules = &get_available_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 if (@msc_modules == 1 && $gconfig{'gotoone'}) {
        &redirect("$msc_modules[0]->{'dir'}/");
        exit;
index 1cae660..30437bc 100644 (file)
@@ -315,7 +315,7 @@ div.title_menu {
     }
 
 @msc_modules = &get_available_module_infos()
-       if (!length(@msc_modules));
+       if (!scalar(@msc_modules));
 
 print "</head>\n";
 if ($theme_no_table) {
index 0564ea1..753cd50 100755 (executable)
@@ -982,7 +982,7 @@ return $config{'host'} eq '' || $config{'host'} eq 'localhost' ||
 # Returns the parsed my.cnf file
 sub get_mysql_config
 {
-if (!length(@mysql_config_cache)) {
+if (!scalar(@mysql_config_cache)) {
        if (!-r $config{'my_cnf'}) {
                return undef;
                }
index 0fee3ec..8a2122d 100644 (file)
@@ -20,7 +20,7 @@ print "<body $_[8]>\n";
 
 # Get all modules visible to this user
 @osx_modules = &get_available_module_infos()
-       if (!length(@osx_modules));
+       if (!scalar(@osx_modules));
 
 # Show table of categories
 local $one = @osx_modules == 1 && $gconfig{'gotoone'};
index 5a71471..6a11af3 100644 (file)
@@ -255,7 +255,7 @@ return defined(&software::update_system_updates);
 sub updates_available
 {
 my ($nocache) = @_;
-if (!length(@updates_available_cache)) {
+if (!scalar(@updates_available_cache)) {
        if ($nocache || &cache_expired($updates_cache_file)) {
                # Get from original source
                @updates_available_cache = &software::update_system_updates();
index e3263dc..19cd7a9 100755 (executable)
@@ -1283,7 +1283,7 @@ else {
 #         2 and the maildir name for ~/Maildir style
 sub postfix_mail_system
 {
-if (!length(@mail_system_cache)) {
+if (!scalar(@mail_system_cache)) {
        local $home_mailbox = &get_current_value("home_mailbox");
        if ($home_mailbox) {
                @mail_system_cache = $home_mailbox =~ /^(.*)\/$/ ?
@@ -1535,7 +1535,7 @@ return &parse_value_header_checks(@_);
 # Returns an array reference of entries from the Postfix master.cf file
 sub get_master_config
 {
-if (!length(@master_config_cache)) {
+if (!scalar(@master_config_cache)) {
        @master_config_cache = ( );
        local $lnum = 0;
        local $prog;
@@ -2080,7 +2080,7 @@ sub supports_map_type
 {
 local ($type) = @_;
 return 1 if ($type eq 'hash'); # Assume always supported
-if (!length(@supports_map_type_cache)) {
+if (!scalar(@supports_map_type_cache)) {
        @supports_map_type = ( );
        open(POSTCONF, "$config{'postfix_config_command'} -m |");
        while(<POSTCONF>) {
index c245251..4a452bc 100755 (executable)
@@ -22,9 +22,9 @@ if (open(READ, $readers_file)) {
        }
 print "<tr> <td width=50% valign=top nowrap>\n";
 printf "<input type=radio name=readers_def value=1 %s> %s\n",
-       length(@readers) ? "" : "checked", $text{'access_readers1'};
+       scalar(@readers) ? "" : "checked", $text{'access_readers1'};
 printf "<input type=radio name=readers_def value=0 %s> %s<br>\n",
-       length(@readers) ? "checked" : "", $text{'access_readers0'};
+       scalar(@readers) ? "checked" : "", $text{'access_readers0'};
 print "<textarea rows=20 cols=30 name=readers>",
        join("\n", @readers),"</textarea>",
        &user_chooser_button("readers", 1),"</td>\n";
@@ -40,9 +40,9 @@ if (open(WRITE, $writers_file)) {
        }
 print "<td width=50% valign=top nowrap>\n";
 printf "<input type=radio name=writers_def value=1 %s> %s\n",
-       length(@writers) ? "" : "checked", $text{'access_writers1'};
+       scalar(@writers) ? "" : "checked", $text{'access_writers1'};
 printf "<input type=radio name=writers_def value=0 %s> %s<br>\n",
-       length(@writers) ? "checked" : "", $text{'access_writers0'};
+       scalar(@writers) ? "checked" : "", $text{'access_writers0'};
 print "<textarea rows=20 cols=30 name=writers>",
        join("\n", @writers),"</textarea>",
        &user_chooser_button("writers", 1),"</td> </tr>\n";
index 881fabb..2f2977f 100755 (executable)
@@ -39,7 +39,7 @@ if (!$config{'mailq_count'}) {
             "$text{'routes_title'}<br>(smtproutes)",
             "$text{'percents_title'}<br>(percenthack)",
             "$text{'assigns_title'}<br>(assign)",
-            length(@queue) ?
+            scalar(@queue) ?
               "$text{'queue_title'}<br>".&text('queue_count', scalar(@queue)) :
               "$text{'queue_title'}<br>(qmail-qread)",
             $text{'boxes_title'} );
index ffb9156..07e8141 100755 (executable)
@@ -261,7 +261,7 @@ else {
 # Returns a list of all SMTP routes
 sub list_routes
 {
-if (!length(@list_routes_cache)) {
+if (!scalar(@list_routes_cache)) {
        local $lnum = 0;
        local @rv;
        open(ROUTES, $qmail_routes_file);
@@ -387,7 +387,7 @@ print "</table></td></tr></table></form>\n";
 # Returns a list of all virtualdomains file entries
 sub list_virts
 {
-if (!length(@list_virts_cache)) {
+if (!scalar(@list_virts_cache)) {
        local $lnum = 0;
        local @rv;
        open(VIRTS, $qmail_virts_file);
@@ -592,7 +592,7 @@ return $r;
 # Returns a list of qmail user assignments
 sub list_assigns
 {
-if (!length(@list_assigns_cache)) {
+if (!scalar(@list_assigns_cache)) {
        local @rv;
        local $lnum = 0;
        open(ASSIGNS, $qmail_assigns_file);
index 6f8bd44..d3d760d 100755 (executable)
@@ -23,13 +23,13 @@ elsif ($cgi eq 'edit_group_quota.cgi') {
                    '&group='.&urlize($group{0,'group'}) : 'none';
        }
 elsif ($cgi eq 'user_filesys.cgi' || $cgi eq 'copy_user_form.cgi') {
-       return length(@uinfo) ?
+       return scalar(@uinfo) ?
                'user='.&urlize($remote_user) : 'user=root';
        }
 elsif ($cgi eq 'group_filesys.cgi' || $cgi eq 'copy_group_form.cgi') {
-       if (length(@uinfo)) {
+       if (scalar(@uinfo)) {
                my @ginfo = getgrgid($uinfo[3]);
-               return 'group='.&urlize($ginfo[0]) if (length(@ginfo));
+               return 'group='.&urlize($ginfo[0]) if (scalar(@ginfo));
                }
        return 'group=bin';
        }
index bb89d81..c214175 100755 (executable)
@@ -65,7 +65,7 @@ return %mdstat;
 sub get_raidtab
 {
 local ($raiddev, $device, %mdstat);
-return \@get_raidtab_cache if (length(@get_raidtab_cache));
+return \@get_raidtab_cache if (scalar(@get_raidtab_cache));
 %mdstat = &get_mdstat();
 
 if ($raid_mode eq "raidtools") {
@@ -601,7 +601,7 @@ if ($mounted) { return ($mounted->[0], $mounted->[2], 1,
                        &indexof($mounted, @mounted)); }
 elsif ($mount) { return ($mount->[0], $mount->[2], 0,
                         &indexof($mount, @mounts)); }
-if (!length(@physical_volumes)) {
+if (!scalar(@physical_volumes)) {
        @physical_volumes = ();
        foreach $vg (&lvm::list_volume_groups()) {
                push(@physical_volumes,
index 05f3f65..96edb21 100755 (executable)
@@ -11,7 +11,7 @@ use WebminCore;
 # Returns a list of user attribute objects
 sub list_user_attrs
 {
-if (!length(@list_user_attrs_cache)) {
+if (!scalar(@list_user_attrs_cache)) {
        @list_user_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'user_attr'});
@@ -142,7 +142,7 @@ return @rv;
 # Returns a list of all profiles
 sub list_prof_attrs
 {
-if (!length(@list_prof_attrs_cache)) {
+if (!scalar(@list_prof_attrs_cache)) {
        @list_prof_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'prof_attr'});
@@ -285,7 +285,7 @@ return @rv;
 # Returns a user of all authorizations
 sub list_auth_attrs
 {
-if (!length(@list_auth_attrs_cache)) {
+if (!scalar(@list_auth_attrs_cache)) {
        @list_auth_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'auth_attr'});
@@ -406,7 +406,7 @@ return join(",", @auths);
 # Returns a user of all execorizations
 sub list_exec_attrs
 {
-if (!length(@list_exec_attrs_cache)) {
+if (!scalar(@list_exec_attrs_cache)) {
        @list_exec_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'exec_attr'});
@@ -496,7 +496,7 @@ return $rv;
 # Returns a list of policy config file directives
 sub get_policy_config
 {
-if (!length(@policy_conf_cache)) {
+if (!scalar(@policy_conf_cache)) {
        @policy_conf_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'policy_conf'});
@@ -571,7 +571,7 @@ elsif ($old && $old->{'enabled'} && !$value) {
 # Returns a list of project objects
 sub list_projects
 {
-if (!length(@list_projects_cache)) {
+if (!scalar(@list_projects_cache)) {
        @list_projects_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'project'});
@@ -808,7 +808,7 @@ foreach $c (&rbac_config_files()) {
 # Returns 1 list of all encryption algorithms, including the internal __unix__
 sub list_crypt_algorithms
 {
-if (!length(@list_crypt_algorithms_cache)) {
+if (!scalar(@list_crypt_algorithms_cache)) {
        push(@list_crypt_algorithms_cache, { 'name' => '__unix__' } );
        local $lnum = 0;
        open(CRYPT, $config{'crypt_conf'});
index a7e5073..84a1637 100755 (executable)
@@ -13,7 +13,7 @@ $cron_cmd = "$module_config_directory/generate.pl";
 # Parses the sarg config file into directives
 sub get_config
 {
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
        local $lnum = 0;
        open(CONF, $config{'sarg_conf'});
        while(<CONF>) {
index bb7409e..648fca0 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'access_file'}, &access_dbm($_[0]));
 # list_access(textfile)
 sub list_access
 {
-if (!length(@list_access_cache)) {
+if (!scalar(@list_access_cache)) {
        @list_access_cache = ( );
        local $lnum = 0;
        open(ACC, $_[0]);
index 8139a82..54c1331 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'domains_file'}, &domains_dbm($_[0]));
 # list_domains(textfile)
 sub list_domains
 {
-if (!length(@list_domains_cache)) {
+if (!scalar(@list_domains_cache)) {
        @list_domains_cache = ( );
        local $lnum = 0;
        local $cmt;
index 1bc0336..7fcbfcc 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'generics_file'}, &generics_dbm($_[0]));
 # list_generics(textfile)
 sub list_generics
 {
-if (!length(@list_generics_cache)) {
+if (!scalar(@list_generics_cache)) {
        @list_generics_cache = ( );
        local $lnum = 0;
        local $cmt;
index 731edd8..93a8ce3 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'mailers_file'}, &mailers_dbm($_[0]));
 # list_mailers(textfile)
 sub list_mailers
 {
-if (!length(@list_mailers_cache)) {
+if (!scalar(@list_mailers_cache)) {
        local $lnum = 0;
        @list_mailers_cache = ( );
        local $cmt;
index 8157bd9..b59fdb1 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'virtusers_file'}, &virtusers_dbm($_[0]));
 # list_virtusers(textfile)
 sub list_virtusers
 {
-if (!length(@list_virtusers_cache)) {
+if (!scalar(@list_virtusers_cache)) {
        @list_virtusers_cache = ( );
        local $lnum = 0;
        local $cmt;
index 2bae340..0a1285b 100755 (executable)
@@ -52,7 +52,7 @@ foreach $m (@mods) {
 &unlock_file($mods);
 
 $basedir = &get_hostsentry_dir();
-if (length(@foreign)) {
+if (scalar(@foreign)) {
        &lock_file("$basedir/moduleForeignDomain.allow");
        &open_tempfile(FOREIGN, ">$basedir/moduleForeignDomain.allow");
        foreach $f (@foreign) {
@@ -61,7 +61,7 @@ if (length(@foreign)) {
        &close_tempfile(FOREIGN);
        &unlock_file("$basedir/moduleForeignDomain.allow");
        }
-if (length(@multiple)) {
+if (scalar(@multiple)) {
        &lock_file("$basedir/moduleMultipleLogins.allow");
        &open_tempfile(MULTIPLE, ">$basedir/moduleMultipleLogins.allow");
        foreach $m (@multiple) {
index 1a50884..abc9e3c 100755 (executable)
@@ -1044,9 +1044,9 @@ elsif ($access{'awl_groups'}) {
        # Check if the user is a member of any of the allowed groups
        local %ugroups;
        local @uinfo = getpwnam($user);
-       return 0 if (!length(@uinfo));
+       return 0 if (!scalar(@uinfo));
        local @ginfo = getgrgid($uinfo[3]);
-       $ugroups{$ginfo[0]}++ if (length(@ginfo));
+       $ugroups{$ginfo[0]}++ if (scalar(@ginfo));
        foreach my $o (&other_groups($user)) {
                $ugroups{$o}++;
                }
index 2f8bbca..19c11ab 100755 (executable)
@@ -72,7 +72,7 @@ elsif ($in{'mode'} == 2) {
 # Returns a list of NUT attribute names and values for some UPS
 sub get_ups_values
 {
-if (!length(@get_ups_cache)) {
+if (!scalar(@get_ups_cache)) {
        local @rv;
        open(SENS, "upsc ".quotemeta($_[0])." |");
        while(<SENS>) {
index 43a5fef..6bffc30 100755 (executable)
@@ -63,7 +63,7 @@ elsif ($in{'mode'} == 2) {
 # Returns a list of lm_sensors names, values and maxes
 sub get_sensors_values
 {
-if (!length(@get_sensors_cache)) {
+if (!scalar(@get_sensors_cache)) {
        local @rv;
        open(SENS, "sensors 2>/dev/null |");
        while(<SENS>) {
index c6ee836..f8a7e4b 100755 (executable)
@@ -23,7 +23,7 @@ return $gconfig{'os_type'} eq 'solaris';
 # Parses the syslog-ng config file into an array ref of objects
 sub get_config
 {
-if (!length(@get_config_cache)) {
+if (!scalar(@get_config_cache)) {
        # First read file into tokens
        @get_config_cache = &read_config_file($config{'syslogng_conf'});
        }
index 4128ad3..4282c7d 100755 (executable)
@@ -45,15 +45,15 @@ $in{'dir'} || &error($text{'upload_edir'});
 $download{'dir'} = $in{'dir'};
 if ($can_mode != 3) {
        # User can be entered
-       length(@uinfo = getpwnam($in{'user'})) || &error($text{'upload_euser'});
+       scalar(@uinfo = getpwnam($in{'user'})) || &error($text{'upload_euser'});
        &can_as_user($in{'user'}) ||
                &error(&text('download_eucannot', $in{'user'}));
        $download{'uid'} = $uinfo[2];
-       $in{'group_def'} || length(@ginfo = getgrnam($in{'group'})) ||
+       $in{'group_def'} || scalar(@ginfo = getgrnam($in{'group'})) ||
                &error($text{'upload_egroup'});
        $can_mode == 0 || $in{'group_def'} || &in_group(\@uinfo, \@ginfo) ||
                &error($text{'download_egcannot'});
-       $download{'gid'} = length(@ginfo) ? $ginfo[2] : $uinfo[3];
+       $download{'gid'} = scalar(@ginfo) ? $ginfo[2] : $uinfo[3];
        }
 else {
        # User is fixed
index b9ad82c..d3f3edd 100755 (executable)
@@ -17,11 +17,11 @@ if (defined($in{'email_def'}) && !$in{'email_def'}) {
        }
 if ($can_mode != 3) {
        # User can be entered
-       length(@uinfo = getpwnam($in{'user'})) ||
+       scalar(@uinfo = getpwnam($in{'user'})) ||
                &error($text{'upload_euser'});
        &can_as_user($in{'user'}) ||
                &error(&text('upload_eucannot', $in{'user'}));
-       $in{'group_def'} || length(@ginfo = getgrnam($in{'group'})) ||
+       $in{'group_def'} || scalar(@ginfo = getgrnam($in{'group'})) ||
                &error($text{'upload_egroup'});
        $can_mode == 0 || $in{'group_def'} || &in_group(\@uinfo, \@ginfo) ||
                &error($text{'upload_egcannot'});
@@ -41,7 +41,7 @@ $found || &error($text{'upload_enone'});
        &error(&text('upload_eaccess', "<tt>$in{'dir'}</tt>", $!));
 
 # Switch to the upload user
-&switch_uid_to($uinfo[2], length(@ginfo) ? $ginfo[2] : $uinfo[3]);
+&switch_uid_to($uinfo[2], scalar(@ginfo) ? $ginfo[2] : $uinfo[3]);
 
 # Create the directory if needed
 if (!-d $in{'dir'} && $in{'mkdir'}) {
@@ -163,7 +163,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) {
                        # Doesn't look possible
                        $err = $text{'upload_notcomp'};
                        }
-               &switch_uid_to($uinfo[2], length(@ginfo) ? $ginfo[2] : $uinfo[3]);
+               &switch_uid_to($uinfo[2], scalar(@ginfo) ? $ginfo[2] : $uinfo[3]);
                if (!$err) {
                        local $j = join("<br>",
                                map { "&nbsp;&nbsp;<tt>$_</tt>" } @files);
index 2ad24ed..a85fca8 100755 (executable)
@@ -97,7 +97,7 @@ Or if it supports FreeBSD master.passwd info, it will also have keys :
 =cut
 sub list_users
 {
-return @list_users_cache if (length(@list_users_cache));
+return @list_users_cache if (scalar(@list_users_cache));
 
 # read the password file
 local (@rv, $_, %idx, $lnum, @pw, $p, $i, $j);
@@ -306,7 +306,7 @@ if ($pft == 1) {
               "$_[0]->{'gid'}:$_[0]->{'class'}:$_[0]->{'change'}:".
               "$_[0]->{'expire'}:$_[0]->{'real'}:$_[0]->{'home'}:".
               "$_[0]->{'shell'}");
-       if (length(@list_users_cache)) {
+       if (scalar(@list_users_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_users_cache;
                }
@@ -337,7 +337,7 @@ else {
        # add to /etc/passwd
        $lref = &read_file_lines($config{'passwd_file'});
        $_[0]->{'line'} = &nis_index($lref);
-       if (length(@list_users_cache)) {
+       if (scalar(@list_users_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_users_cache;
                }
@@ -351,7 +351,7 @@ else {
                # Find correct place to insert in shadow file
                $lref = &read_file_lines($config{'shadow_file'});
                $_[0]->{'sline'} = &nis_index($lref);
-               if (length(@list_users_cache)) {
+               if (scalar(@list_users_cache)) {
                        map { $_->{'sline'}++
                              if ($_->{'sline'} >= $_[0]->{'sline'}) }
                            @list_users_cache;
@@ -400,7 +400,7 @@ else {
                }
        }
 &flush_file_lines() if (!$batch_mode);
-push(@list_users_cache, $_[0]) if (length(@list_users_cache));
+push(@list_users_cache, $_[0]) if (scalar(@list_users_cache));
 &refresh_nscd() if (!$batch_mode);
 }
 
@@ -568,7 +568,7 @@ else {
                }
        }
 @list_users_cache = grep { $_->{'user'} ne $_[0]->{'user'} } @list_users_cache
-       if (length(@list_users_cache));
+       if (scalar(@list_users_cache));
 if (!$batch_mode) {
        &flush_file_lines();
        &refresh_nscd();
@@ -591,7 +591,7 @@ contain the keys :
 =cut
 sub list_groups
 {
-return @list_groups_cache if (length(@list_groups_cache));
+return @list_groups_cache if (scalar(@list_groups_cache));
 
 local(@rv, $lnum, $_, %idx, $g, $i, $j, @gr);
 $lnum = 0;
@@ -740,7 +740,7 @@ else {
        local $lref;
        $lref = &read_file_lines($config{'group_file'});
        $_[0]->{'line'} = &nis_index($lref);
-       if (length(@list_groups_cache)) {
+       if (scalar(@list_groups_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_groups_cache;
                }
@@ -751,7 +751,7 @@ else {
        if ($gft == 2) {
                $lref = &read_file_lines($config{'gshadow_file'});
                $_[0]->{'sline'} = &nis_index($lref);
-               if (length(@list_groups_cache)) {
+               if (scalar(@list_groups_cache)) {
                        map { $_->{'sline'}++
                              if ($_->{'sline'} >= $_[0]->{'sline'}) }
                            @list_groups_cache;
@@ -767,7 +767,7 @@ else {
        &flush_file_lines();
        }
 &refresh_nscd();
-push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (scalar(@list_groups_cache));
 }
 
 =head2 modify_group(&old, &details)
@@ -860,7 +860,7 @@ else {
                }
        }
 @list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
-       if (length(@list_groups_cache));
+       if (scalar(@list_groups_cache));
 &refresh_nscd();
 }
 
index f0fecdf..033a858 100755 (executable)
@@ -289,7 +289,7 @@ return &ui_opt_textbox($name, $value, 10, $text{'pool_none'});
 sub get_active_interface
 {
 local ($zinfo, $net) = @_;
-if (!length(@active_interfaces_cache)) {
+if (!scalar(@active_interfaces_cache)) {
        @active_interfaces_cache = &net::active_interfaces();
        }
 local $address = $net->{'address'};
@@ -307,7 +307,7 @@ sub get_active_mount
 {
 local ($zinfo, $fs) = @_;
 local $dir = &get_zone_root($zinfo).$fs->{'dir'};
-if (!length(@active_mounts_cache)) {
+if (!scalar(@active_mounts_cache)) {
        @active_mounts_cache = &mount::list_mounted();
        }
 local ($mount) = grep { $_->[0] eq $dir } @active_mounts_cache;