summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorville <ville@localhost>2009-01-04 10:41:21 +0000
committerville <ville@localhost>2009-01-04 10:41:21 +0000
commit043b267f2011866674976e65df163658658a4ffa (patch)
treee6dc09bd449bca7e2e8b11d2b1c8ff4f42e79623
parentabf3be9b67d992d1bf2225090bc3d7fd0259d956 (diff)
downloadmarkup-validator-043b267f2011866674976e65df163658658a4ffa.zip
markup-validator-043b267f2011866674976e65df163658658a4ffa.tar.gz
markup-validator-043b267f2011866674976e65df163658658a4ffa.tar.bz2
Use File::Spec::Functions for somewhat more compact code.
-rwxr-xr-xhttpd/cgi-bin/check64
-rwxr-xr-xhttpd/cgi-bin/sendfeedback.pl16
-rw-r--r--misc/bundle/META.yml2
-rw-r--r--misc/bundle/Makefile.PL28
-rw-r--r--misc/bundle/lib/Bundle/W3C/Validator.pm2
-rwxr-xr-xmisc/docs_errors.pl11
6 files changed, 57 insertions, 66 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check
index 45e9f30..acbefad 100755
--- a/httpd/cgi-bin/check
+++ b/httpd/cgi-bin/check
@@ -14,7 +14,7 @@
# This source code is available under the license at:
# http://www.w3.org/Consortium/Legal/copyright-software
#
-# $Id: check,v 1.612 2009-01-04 10:23:10 ville Exp $
+# $Id: check,v 1.613 2009-01-04 10:41:20 ville Exp $
#
# Disable buffering on STDOUT!
@@ -53,7 +53,7 @@ use Encode::Alias qw();
use Encode::HanExtra qw(); # for some chinese character encodings,
# e.g gb18030
use Encode::JIS2K qw(); # ditto extra japanese encodings
-use File::Spec qw();
+use File::Spec::Functions qw(catfile);
use HTML::Encoding 0.52 qw();
use HTML::Parser 3.25 qw(); # Need 3.25 for $p->ignore_elements.
use HTML::Template 2.6 qw();
@@ -198,7 +198,7 @@ Directory not readable (permission denied): @_r
#
# Strings
- $VERSION = q$Revision: 1.612 $;
+ $VERSION = q$Revision: 1.613 $;
$VERSION =~ s/Revision: ([\d\.]+) /$1/;
#
@@ -208,8 +208,8 @@ Directory not readable (permission denied): @_r
# Read friendly error message file
my %rsrc = Config::General->new(
-MergeDuplicateBlocks => 1,
- -ConfigFile => File::Spec->catfile($CFG->{Paths}->{Templates},
- 'en_US', 'error_messages.cfg'),
+ -ConfigFile => catfile($CFG->{Paths}->{Templates}, 'en_US',
+ 'error_messages.cfg'),
)->getall();
# 'en_US' should be replaced by $lang for lang-neg
# Config::General workarounds for <msg 0> issues:
@@ -325,84 +325,74 @@ my %template_defaults = (
$File->{Templates}->{Result} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'result.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'result.tmpl'),
loop_context_vars => TRUE,
);
$File->{Templates}->{Error} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'fatal-error.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'fatal-error.tmpl'),
);
$File->{Templates}->{AuthzReq} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'http_401_authrequired.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang,
+ 'http_401_authrequired.tmpl'),
);
# templates for alternate output formats
$File->{Templates}->{XML} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'xml_output.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'xml_output.tmpl'),
loop_context_vars => TRUE,
);
$File->{Templates}->{SOAP} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'soap_output.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'soap_output.tmpl'),
loop_context_vars => TRUE,
);
-$File->{Templates}->{UCN} = HTML::Template->new(
+$File->{Templates}->{SOAPFault} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'ucn_output.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'soap_fault.tmpl'),
loop_context_vars => TRUE,
);
-$File->{Templates}->{SOAPFault} = HTML::Template->new(
+$File->{Templates}->{SOAPDisabled} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'soap_fault.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'soap_disabled.tmpl'),
loop_context_vars => TRUE,
);
-$File->{Templates}->{SOAPDisabled} = HTML::Template->new(
+$File->{Templates}->{UCN} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'soap_disabled.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'ucn_output.tmpl'),
loop_context_vars => TRUE,
);
$File->{Templates}->{EARLXML} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'earl_xml.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'earl_xml.tmpl'),
loop_context_vars => TRUE,
global_vars => TRUE,
);
$File->{Templates}->{EARLN3} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'earl_n3.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'earl_n3.tmpl'),
loop_context_vars => TRUE,
global_vars => TRUE,
);
$File->{Templates}->{JSON} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'json_ouput.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'json_ouput.tmpl'),
loop_context_vars => TRUE,
global_vars => TRUE,
);
$File->{Templates}->{PrefillHTML} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'prefill_html401.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang,
+ 'prefill_html401.tmpl'),
loop_context_vars => TRUE,
global_vars => TRUE,
);
$File->{Templates}->{PrefillXHTML} = HTML::Template->new(
%template_defaults,
- filename => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'prefill_xhtml10.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang,
+ 'prefill_xhtml10.tmpl'),
loop_context_vars => TRUE,
global_vars => TRUE,
);
@@ -694,7 +684,7 @@ if (&is_xml($File)) {
$xmlparser->validation(0);
$xmlparser->load_ext_dtd(0);
# [NOT] loading the XML catalog for entities resolution as it seems to cause a lot of unnecessary DTD/entities fetching (requires >= 1.53 if enabled)
- #$xmlparser->load_catalog( File::Spec->catfile($CFG->{Paths}->{SGML}->{Library}, 'xml.soc') );
+ #$xmlparser->load_catalog(catfile($CFG->{Paths}->{SGML}->{Library}, 'xml.soc'));
my $xml_string = join"\n",@{$File->{Content}};
# the XML parser will check the value of encoding attribute in XML declaration
# so we have to amend it to reflect transcoding. see Bug 4867
@@ -921,7 +911,7 @@ sub dtd_validate (\$) {
my $parser_name = "SGML::Parser::OpenSP";
#
# By default, use SGML catalog file and SGML Declaration.
- my $catalog = File::Spec->catfile($CFG->{Paths}->{SGML}->{Library}, 'sgml.soc');
+ my $catalog = catfile($CFG->{Paths}->{SGML}->{Library}, 'sgml.soc');
# default parsing options
my @spopt = qw(valid non-sgml-char-ref no-duplicate);
@@ -933,7 +923,7 @@ sub dtd_validate (\$) {
#
# Switch to XML semantics if file is XML.
if (&is_xml($File)) {
- $catalog = File::Spec->catfile($CFG->{Paths}->{SGML}->{Library}, 'xml.soc');
+ $catalog = catfile($CFG->{Paths}->{SGML}->{Library}, 'xml.soc');
push(@spopt, 'xml');
# workaround for a bug in s:p:o 0.99
# see http://www.w3.org/Bugs/Public/show_bug.cgi?id=798#c5
diff --git a/httpd/cgi-bin/sendfeedback.pl b/httpd/cgi-bin/sendfeedback.pl
index fb8be06..3bba907 100755
--- a/httpd/cgi-bin/sendfeedback.pl
+++ b/httpd/cgi-bin/sendfeedback.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -T
##
## feedback generator for W3C Markup Validation Service
-# # $Id: sendfeedback.pl,v 1.8 2007-05-25 21:34:29 ville Exp $
+# # $Id: sendfeedback.pl,v 1.9 2009-01-04 10:41:20 ville Exp $
## Pragmas.
use strict;
@@ -10,10 +10,10 @@ use warnings;
## Modules. See also the BEGIN block further down below.
-use CGI qw();
-use HTML::Template 2.6 qw();
-use Config::General 2.19 qw(); # Need 2.19 for -AutoLaunder
-use File::Spec qw();
+use CGI qw();
+use File::Spec::Functions qw(catfile);
+use HTML::Template 2.6 qw();
+use Config::General 2.19 qw(); # Need 2.19 for -AutoLaunder
use vars qw($DEBUG $CFG $RSRC $VERSION $HAVE_IPC_RUN);
# Define global constants
@@ -70,8 +70,8 @@ our $lang = 'en_US'; # @@@ TODO: conneg
# Read error message + explanations file
our %rsrc = Config::General->new(
-MergeDuplicateBlocks => 1,
- -ConfigFile => File::Spec->catfile($CFG->{Paths}->{Templates},
- $lang, 'error_messages.cfg'),
+ -ConfigFile => catfile($CFG->{Paths}->{Templates}, $lang,
+ 'error_messages.cfg'),
)->getall();
# Config::General workarounds for <msg 0> issues:
# http://lists.w3.org/Archives/Public/public-qa-dev/2006Feb/0022.html
@@ -85,7 +85,7 @@ $rsrc{msg}{0} ||=
$RSRC = \%rsrc;
our $T = HTML::Template->new(
- filename => File::Spec->catfile($CFG->{Paths}->{Templates}, $lang, 'feedback.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'feedback.tmpl'),
die_on_bad_params => FALSE,
);
diff --git a/misc/bundle/META.yml b/misc/bundle/META.yml
index 0402659..1f2fd45 100644
--- a/misc/bundle/META.yml
+++ b/misc/bundle/META.yml
@@ -10,7 +10,7 @@ requires:
Encode: 0
Encode::HanExtra: 0
Encode::JIS2K: 0
- File::Spec: 0
+ File::Spec::Functions: 0
HTML::Encoding: 0.52
HTML::Parser: 3.25
HTML::Template: 2.6
diff --git a/misc/bundle/Makefile.PL b/misc/bundle/Makefile.PL
index bd36939..86db228 100644
--- a/misc/bundle/Makefile.PL
+++ b/misc/bundle/Makefile.PL
@@ -7,20 +7,20 @@ WriteMakefile(
AUTHOR => 'The W3C Markup Validator Team <www-validator@w3.org>',
VERSION_FROM => 'lib/Bundle/W3C/Validator.pm',
PREREQ_PM => {
- CGI => 2.81,
- Config::General => 2.19,
- Encode => 0,
- Encode::HanExtra => 0,
- Encode::JIS2K => 0,
- File::Spec => 0,
- HTML::Encoding => 0.52,
- HTML::Parser => 3.25,
- HTML::Template => 2.6,
- LWP::UserAgent => 1.90,
- Net::IP => 0,
- SGML::Parser::OpenSP => 0,
- URI => 0,
- XML::LibXML => 0,
+ CGI => 2.81,
+ Config::General => 2.19,
+ Encode => 0,
+ Encode::HanExtra => 0,
+ Encode::JIS2K => 0,
+ File::Spec::Functions => 0,
+ HTML::Encoding => 0.52,
+ HTML::Parser => 3.25,
+ HTML::Template => 2.6,
+ LWP::UserAgent => 1.90,
+ Net::IP => 0,
+ SGML::Parser::OpenSP => 0,
+ URI => 0,
+ XML::LibXML => 0,
},
dist => { TARFLAGS => '--owner=0 --group=0 -cvf' },
clean => { FILES => 'ChangeLog.bak' },
diff --git a/misc/bundle/lib/Bundle/W3C/Validator.pm b/misc/bundle/lib/Bundle/W3C/Validator.pm
index 2e77d69..756471b 100644
--- a/misc/bundle/lib/Bundle/W3C/Validator.pm
+++ b/misc/bundle/lib/Bundle/W3C/Validator.pm
@@ -25,7 +25,7 @@ C<perl -MCPAN -e "install Bundle::W3C::Validator">
Encode
Encode::HanExtra
Encode::JIS2K
- File::Spec
+ File::Spec::Functions
HTML::Encoding 0.52
HTML::Parser 3.25
HTML::Template 2.6
diff --git a/misc/docs_errors.pl b/misc/docs_errors.pl
index ba57d42..178101f 100755
--- a/misc/docs_errors.pl
+++ b/misc/docs_errors.pl
@@ -2,7 +2,7 @@
##
## Generates HTML documentation of error messages and explanations
## for W3C Markup Validation Service
-## $Id: docs_errors.pl,v 1.7 2007-10-17 18:11:24 ville Exp $
+## $Id: docs_errors.pl,v 1.8 2009-01-04 10:41:20 ville Exp $
## Pragmas.
use strict;
@@ -11,8 +11,9 @@ use warnings;
## Modules. See also the BEGIN block further down below.
-use HTML::Template 2.6 qw();
-use Config::General 2.19 qw(); # Need 2.19 for -AutoLaunder
+use File::Spec::Functions qw(catfile);
+use HTML::Template 2.6 qw();
+use Config::General 2.19 qw(); # Need 2.19 for -AutoLaunder
use vars qw($DEBUG $CFG $RSRC $VERSION $HAVE_IPC_RUN);
# Define global constants
@@ -64,7 +65,7 @@ delete $ENV{PATH};
our $lang = 'en_US'; # @@@ TODO: conneg
# Read error message + explanations file
-our $error_messages_file = File::Spec->catfile($CFG->{Paths}->{Templates}, $lang, 'error_messages.cfg');
+our $error_messages_file = catfile($CFG->{Paths}->{Templates}, $lang, 'error_messages.cfg');
our %config_errs = ( -MergeDuplicateBlocks => 1,
-ConfigFile => $error_messages_file);
our %rsrc = Config::General->new(%config_errs)->getall();
@@ -81,7 +82,7 @@ $RSRC = \%rsrc;
our $T = HTML::Template->new(
- filename => File::Spec->catfile($CFG->{Paths}->{Templates}, $lang, 'docs_errors.tmpl'),
+ filename => catfile($CFG->{Paths}->{Templates}, $lang, 'docs_errors.tmpl'),
die_on_bad_params => FALSE,
);