]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
remove useless uses of scalar
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index be7a28722845ab099a09a8108f4af0b1c0ad23c0..7dfa52f570c3cd21fa63234713b44316af3cae9c 100644 (file)
@@ -275,7 +275,7 @@ sub pagetemplate (@) {
                $template->param(percenttranslated => percenttranslated($page));
        }
        if ($template->query(name => "istranslation")) {
-               $template->param(istranslation => scalar istranslation($page));
+               $template->param(istranslation => istranslation($page));
        }
        if ($template->query(name => "istranslatable")) {
                $template->param(istranslatable => istranslatable($page));
@@ -388,7 +388,7 @@ sub change(@) {
        # at once. As this more or less doubles the time needed to rebuild the
        # wiki, we do so only when really needed.
 
-       if (scalar @rendered
+       if (@rendered
            && exists $config{rebuild} && defined $config{rebuild} && $config{rebuild}
            && UNIVERSAL::can("IkiWiki::Plugin::meta", "getsetup")
            && exists $config{meta_overrides_page_title}
@@ -474,7 +474,7 @@ sub canrename ($$@) {
                # by looking for the master page in the list of to-be-renamed pages we
                # saved early in the renaming process.
                my $orig_torename = $session->param("po_orig_torename");
-               unless (scalar grep { $_->{src} eq $masterpage } @{$orig_torename}) {
+               unless (grep { $_->{src} eq $masterpage } @{$orig_torename}) {
                        return gettext("Can not rename a translation. Renaming the master page, ".
                                       "though, renames its translations as well.");
                }
@@ -537,17 +537,17 @@ sub formbuilder (@) {
        # This cannot be done in the formbuilder_setup hook as the list of types is
        # computed later.
        if ($form->field("do") eq "create") {
-               for my $field ($form->field) {
+               foreach my $field ($form->field) {
                        next unless "$field" eq "type";
                        if ($field->type eq 'select') {
                                # remove po from the list of types
                                my @types = grep { $_ ne 'po' } $field->options;
-                               $field->options(\@types) if scalar @types;
+                               $field->options(\@types) if @types;
                        }
                        else {
                                # make sure the default value is not po;
                                # does this case actually happen?
-                               debug "po(formbuilder) ".gettext("type field is not select - not implemented yet");
+                               debug "po(formbuilder) ".gettext("type field is not selected - not implemented yet");
                        }
                }
        }
@@ -989,7 +989,7 @@ sub deletetranslations ($) {
                }
        } @todelete;
 
-       if (scalar @todelete) {
+       if (@todelete) {
                commit_and_refresh(
                        gettext("removed obsolete PO files"),
                        "IkiWiki::Plugin::po::deletetranslations");