validator/httpd/cgi-bin check,1.731,1.732 sendfeedback.pl,1.16,1.17

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv21014/httpd/cgi-bin

Modified Files:
	check sendfeedback.pl 
Log Message:
Fix some cascading if-elsif chains flagged by perlcritic.

Index: sendfeedback.pl
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/sendfeedback.pl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- sendfeedback.pl	25 Nov 2009 19:09:39 -0000	1.16
+++ sendfeedback.pl	25 Nov 2009 19:52:48 -0000	1.17
@@ -68,7 +68,7 @@
 delete $ENV{PATH};
 
 our $q    = CGI->new();
-our $lang = 'en_US';    # @@@ TODO: conneg
+our $lang = 'en_US';      # @@@ TODO: conneg
 
 # Read error message + explanations file
 %RSRC = Config::General->new(

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.731
retrieving revision 1.732
diff -u -d -r1.731 -r1.732
--- check	25 Nov 2009 19:09:39 -0000	1.731
+++ check	25 Nov 2009 19:52:47 -0000	1.732
@@ -909,19 +909,15 @@
     }
 }
 
-my $template;
-
-if ($File->{Opt}->{Output} eq 'earl') {
-    $template = &get_template($File, 'earl_xml.tmpl');
-}
-elsif ($File->{Opt}->{Output} eq 'n3') {
-    $template = &get_template($File, 'earl_n3.tmpl');
-}
-elsif ($File->{Opt}->{Output} eq 'json') {
-    $template = &get_template($File, 'json_output.tmpl');
-}
-elsif ($File->{Opt}->{Output} eq 'ucn') {
-    $template = &get_template($File, 'ucn_output.tmpl');
+my %templates = (
+    earl => 'earl_xml.tmpl',
+    n3   => 'earl_n3.tmpl',
+    json => 'json_output.tmpl',
+    ucn  => 'ucn_output.tmpl',
+);
+my $template = $templates{$File->{Opt}->{Output}};
+if ($template) {
+    $template = &get_template($File, $template);
 }
 elsif ($File->{Opt}->{Output} eq 'soap12') {
     if ($CFG->{'Enable SOAP'} != 1) {
@@ -2791,7 +2787,8 @@
         );
         return;
     }
-    elsif ($parseModeFromMimeType ne 'TBD') {
+
+    if ($parseModeFromMimeType ne 'TBD') {
 
         # if The mime type gives clear indication of whether the document is
         # XML or not
@@ -2823,7 +2820,8 @@
         }
         return;
     }
-    elsif ($parseModeFromDoctype ne 'TBD') {
+
+    if ($parseModeFromDoctype ne 'TBD') {
 
         # the mime type is ambiguous (hence we didn't stop at the previous test)
         # but by now we're sure that the document type is a good indication
@@ -2844,7 +2842,8 @@
         $File->{ModeChoice} = 'Doctype';
         return;
     }
-    elsif ($parseModeFromXMLDecl ne 'TBD') {
+
+    if ($parseModeFromXMLDecl ne 'TBD') {
 
         # the mime type is ambiguous (hence we didn't stop at the previous test)
         # and so was the doctype
@@ -2861,22 +2860,20 @@
         $File->{ModeChoice} = 'XMLDecl';
         return;
     }
-    else {
 
-        # this is the last case. We know that all  modes are not TBD,
-        # yet mime type, doctype AND XML DECL tests have failed => we are saved
-        # by the presence of namespaces
-        if ($File->{Mode} eq "") {
-            $File->{Mode} = "DTD+" . $parseModeFromNamespace;
-        }
-        elsif ($File->{Mode} =~ /\+/) {
-            $File->{Mode} =~ s/\+.*/\+$parseModeFromNamespace/;
-        }
-        else {
-            $File->{Mode} = $File->{Mode} . "+" . $parseModeFromNamespace;
-        }
-        $File->{ModeChoice} = 'Namespace';
+    # this is the last case. We know that all  modes are not TBD,
+    # yet mime type, doctype AND XML DECL tests have failed => we are saved
+    # by the presence of namespaces
+    if ($File->{Mode} eq "") {
+        $File->{Mode} = "DTD+" . $parseModeFromNamespace;
     }
+    elsif ($File->{Mode} =~ /\+/) {
+        $File->{Mode} =~ s/\+.*/\+$parseModeFromNamespace/;
+    }
+    else {
+        $File->{Mode} = $File->{Mode} . "+" . $parseModeFromNamespace;
+    }
+    $File->{ModeChoice} = 'Namespace';
 }
 
 #

Received on Wednesday, 25 November 2009 19:52:51 UTC