- From: Bjoern Hoehrmann via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 15 Aug 2005 20:54:54 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv7693 Modified Files: check Log Message: more consistent formatting to reduced perceived impact when applying perltidy at some point... Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.432 retrieving revision 1.433 diff -u -d -r1.432 -r1.433 --- check 29 Jul 2005 06:26:15 -0000 1.432 +++ check 15 Aug 2005 20:54:51 -0000 1.433 @@ -565,7 +565,6 @@ } } - # # Sanity check Charset information and add any warnings necessary. $File = &charset_conflicts($File); @@ -673,7 +672,7 @@ # Run it through SP, redirecting output to temporary files. my $pid = do { no warnings 'once'; - local(*SPIN, *SPOUT, *SPERR) = ($spin, $spout, $sperr); + local (*SPIN, *SPOUT, *SPERR) = ($spin, $spout, $sperr); open3("<&SPIN", ">&SPOUT", ">&SPERR", @cmd); }; undef $spin; @@ -708,7 +707,7 @@ } } - next if / IMPLIED$/ && not $DEBUG;; + next if / IMPLIED$/ && not $DEBUG; next if /^ASDAFORM CDATA /; next if /^ASDAPREF CDATA /; chomp; # Removes trailing newlines @@ -891,7 +890,7 @@ # # Tip of the Day... - my $tip = &get_tip; + my $tip = &get_tip(); $T->param(tip_uri => $tip->[0]); $T->param(tip_slug => $tip->[1]); @@ -951,7 +950,6 @@ $T->param(file_thispage => $thispage); } - # # Add a waring message to the output. sub add_warning ($$) { @@ -962,7 +960,6 @@ $File->{T}->param(have_warnings => TRUE); } - # # Proxy authentication requests. # Note: expects the third argument to be a hash ref (see HTTP::Headers::Auth). @@ -996,7 +993,6 @@ exit; # Further interaction will be a new HTTP request. } - # # Fetch an URL and return the content and selected meta-info. sub handle_uri { @@ -1061,7 +1057,7 @@ # Enforce Max Recursion level. &check_recursion($File, $res); - my($mode, $ct, $charset) + my ($mode, $ct, $charset) = &parse_content_type( $File, $res->header('Content-Type'), @@ -1105,7 +1101,7 @@ local $/ = undef; # set line delimiter so that <> reads rest of file $file = <$f>; - my($mode, $ct, $charset) = &parse_content_type($File, $h->{'Content-Type'}); + my ($mode, $ct, $charset) = &parse_content_type($File, $h->{'Content-Type'}); $File->{Bytes} = $file; $File->{Mode} = $mode; @@ -1140,7 +1136,6 @@ return $File; } - # # Parse a Content-Type and parameters. Return document type and charset. sub parse_content_type { @@ -1150,12 +1145,12 @@ my $charset = ''; my $mode = ''; - my($ct, @param) = split /\s*;\s*/, lc $Content_Type; + my ($ct, @param) = split /\s*;\s*/, lc $Content_Type; $mode = $CFG->{MIME}->{$ct} || $ct; foreach my $param (@param) { - my($p, $v) = split /\s*=\s*/, $param; + my ($p, $v) = split /\s*=\s*/, $param; next unless $p =~ m(charset)i; if ($v =~ m/([\'\"]?)(\S+)\1/i) { $charset = lc $2; @@ -1198,8 +1193,6 @@ } } - - # # Normalize newline forms (CRLF/CR/LF) to native newline. sub normalize_newlines { @@ -1237,7 +1230,6 @@ return $exact_charset; } - # # Return $_[0] encoded for HTML entities (cribbed from merlyn). # @@ -1250,7 +1242,6 @@ return $_; } - # # Truncate source lines for report. # @@ -1299,7 +1290,6 @@ return $line, $col; } - # # Suppress any existing DOCTYPE by commenting it out. sub override_doctype { @@ -1359,7 +1349,6 @@ return $File; } - # # Parse errors reported by SP. sub parse_errors ($$) { @@ -1375,12 +1364,12 @@ push @{$File->{DEBUG}->{Errors}}, $_; chomp; - my($err, @errors); + my ($err, @errors); next if /^<OSFD>0:[0-9]+:[0-9]+:[^A-Z]/; next if /numbers exceeding 65535 not supported/; next if /URL Redirected to/; - my(@_err) = split /:/; + my (@_err) = split /:/; next unless $_err[1] eq '<OSFD>0'; #@@FIXME: This is a polite fiction!; if ($_err[1] =~ m(^<URL>)) { @errors = ($_err[0], join(':', $_err[1], $_err[2]), @_err[3..$#_err]); @@ -1445,13 +1434,13 @@ if (scalar @{$File->{Errors}}) { foreach my $err (@{$File->{Errors}}) { - my($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $err->{char}); + my ($line, $col) = &truncate_line($File->{Content}->[$err->{line}-1], $err->{char}); $line = &mark_error($line, $col); my $explanation; if ($err->{num}) { - my(undef, $num) = split /\./, $err->{num}; + my (undef, $num) = split /\./, $err->{num}; if (exists $Msgs{$num}) { # We've already seen this message... if ($File->{Opt}->{Verbose}) { # ...so only repeat it in Verbose mode. $explanation = qq(\n <div class="hidden mid-$num"></div>\n); @@ -1575,7 +1564,6 @@ return $line; } - # # Produce an outline of the document based on Hn elements from the ESIS. sub outline { @@ -1646,7 +1634,6 @@ return $outline; } - # # Create a HTML representation of the document. sub source { @@ -1660,7 +1647,6 @@ return \@source; } - # # Create a HTML Parse Tree of the document for validation report. sub parsetree { @@ -1719,7 +1705,6 @@ return $tree; } - # # Do an initial parse of the Document Entity to extract FPI. sub preparse_doctype { @@ -1732,7 +1717,7 @@ my $dtd = sub { return if $File->{Root}; - ($File->{Root}, $File->{DOCTYPE}) = shift =~ m(<!DOCTYPE\s+(\w+)\s+(?:PUBLIC|SYSTEM)\s+(?:[\'\"])([^\"\']+)(?:[\"\']).*>)si; + ($File->{Root}, $File->{DOCTYPE}) = shift =~ m(<!DOCTYPE\s+(\w+)\s+(?:PUBLIC|SYSTEM)\s+(?:[\'\"])([^\"\']+)(?:[\"\']).*>)si; }; my $start = sub { @@ -1788,7 +1773,6 @@ return $file_raw_errors; } - # # Preprocess CGI parameters. sub prepCGI { @@ -1909,7 +1893,6 @@ return $ssi; } - # # Utility sub to tell if mode "is" XML. sub is_xml {shift->{Mode} == MODE_XML}; @@ -1922,7 +1905,7 @@ my $dtd = sub { return if $File->{Root}; - ($File->{Root}, $File->{DOCTYPE}) = shift =~ m(<!DOCTYPE\s+(\w+)\s+PUBLIC\s+(?:[\'\"])([^\"\']+)(?:[\"\']).*>)si; + ($File->{Root}, $File->{DOCTYPE}) = shift =~ m(<!DOCTYPE\s+(\w+)\s+PUBLIC\s+(?:[\'\"])([^\"\']+)(?:[\"\']).*>)si; }; my $start = sub { @@ -1999,7 +1982,6 @@ return $File; } - # # Transcode to UTF-8 sub transcode { @@ -2108,14 +2090,13 @@ return $File; } - # # Return an XML report for the page. sub report_xml { my $File = shift; my $valid = ($File->{'Is Valid'} ? 'Valid' : 'Invalid'); - my $errs = ($File->{'Is Valid'} ? '0' : scalar @{$File->{Errors}}); + my $errs = ($File->{'Is Valid'} ? '0' : scalar @{$File->{Errors}}); if ($File->{E}->param('fatal_http_error')) { $valid = 'Could not validate'; } @@ -2208,15 +2189,13 @@ print qq(</result>\n); } - - # # Return an EARL report for the page. sub report_earl { my $File = shift; my $valid = ($File->{'Is Valid'} ? 'Valid' : 'Invalid'); - my $errs = ($File->{'Is Valid'} ? '0' : scalar @{$File->{Errors}}); + my $errs = ($File->{'Is Valid'} ? '0' : scalar @{$File->{Errors}}); if ($File->{E}->param('fatal_http_error')) { $valid = 'Could not validate'; } @@ -2305,8 +2284,6 @@ .EOF. } - - # # Return a Notation3 EARL report for the page. # @@ -2391,7 +2368,6 @@ print " .\n"; } - # # Autodetection as in Appendix F of the XML 1.0 Recommendation. # <http://www.w3.org/TR/2000/REC-xml-20001006#sec-guessing> @@ -2429,7 +2405,6 @@ # nothing in particular } - # # Find encoding in document according to XML rules # Only meaningful if file contains a BOM, or for well-formed XML! @@ -2501,7 +2476,6 @@ return $encodingA && $encodingB && ($encodingA ne $encodingB); } - # # Construct a self-referential URL from a CGI.pm $q object. sub self_url_q { @@ -2564,8 +2538,7 @@ use base qw(LWP::UserAgent); -sub new -{ +sub new { my ($proto, $CFG, $File, @rest) = @_; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(@rest); @@ -2574,14 +2547,12 @@ return $self; } -sub redirect_ok -{ +sub redirect_ok { my ($self, $req, $res) = @_; return $self->SUPER::redirect_ok($req, $res) && $self->uri_ok($req->uri()); } -sub uri_ok -{ +sub uri_ok { my ($self, $uri) = @_; return 1 if ($self->{'W3C::Validator::CFG'}->{'Allow Private IPs'} or !$uri->can('host'));
Received on Monday, 15 August 2005 20:55:00 UTC