.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "WebService::Validator::CSS::W3C 3pm" .TH WebService::Validator::CSS::W3C 3pm "2021-01-07" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" WebService::Validator::CSS::W3C \- Interface to the W3C CSS Validator .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use WebService::Validator::CSS::W3C; \& \& my $css = "p { color: not\-a\-color }"; \& my $val = WebService::Validator::CSS::W3C\->new; \& my $ok = $val\->validate(string => $css); \& \& if ($ok and !$val\->is_valid) { \& print "Errors:\en"; \& printf " * %s\en", $_\->{message} \& foreach $val\->errors \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is an interface to the W3C \s-1CSS\s0 Validation online service , based on its \s-1SOAP 1.2\s0 support. It helps to find errors in Cascading Style Sheets. .PP The following methods are available: .ie n .IP "my $val = WebService::Validator::CSS::W3C\->new" 4 .el .IP "my \f(CW$val\fR = WebService::Validator::CSS::W3C\->new" 4 .IX Item "my $val = WebService::Validator::CSS::W3C->new" .PD 0 .ie n .IP "my $val = WebService::Validator::CSS::W3C\->new($ua)" 4 .el .IP "my \f(CW$val\fR = WebService::Validator::CSS::W3C\->new($ua)" 4 .IX Item "my $val = WebService::Validator::CSS::W3C->new($ua)" .ie n .IP "my $val = WebService::Validator::CSS::W3C\->new($ua, $url)" 4 .el .IP "my \f(CW$val\fR = WebService::Validator::CSS::W3C\->new($ua, \f(CW$url\fR)" 4 .IX Item "my $val = WebService::Validator::CSS::W3C->new($ua, $url)" .PD Creates a new WebService::Validator::CSS::W3C object. A custom LWP::UserAgent object can be supplied which is then used for \s-1HTTP\s0 communication with the \s-1CSS\s0 Validator. \f(CW$url\fR is the \s-1URL\s0 of the \s-1CSS\s0 Validator, \f(CW\*(C`http://jigsaw.w3.org/css\-validator/validator\*(C'\fR by default. .ie n .IP "my $success = $val\->validate(%params)" 4 .el .IP "my \f(CW$success\fR = \f(CW$val\fR\->validate(%params)" 4 .IX Item "my $success = $val->validate(%params)" Validate a style sheet, takes \f(CW%params\fR as defined below. Either \f(CW\*(C`string\*(C'\fR or \f(CW\*(C`uri\*(C'\fR must be supplied. Returns a true value if the validation succeeded (regardless of whether the style sheet contains errors). .RS 4 .ie n .IP "string => $css" 4 .el .IP "string => \f(CW$css\fR" 4 .IX Item "string => $css" A style sheet as a string. It is currently unlikely that validation will work if the string is not a legal \s-1UTF\-8\s0 string. If a string is specified, the \f(CW\*(C`uri\*(C'\fR parameter will be ignored. Note that \f(CW\*(C`GET\*(C'\fR will be used to pass the string to the Validator, it might not work with overly long strings. .ie n .IP "uri => $uri" 4 .el .IP "uri => \f(CW$uri\fR" 4 .IX Item "uri => $uri" The location of a style sheet or a \s-1HTML/XHTML/SVG\s0 document containing or referencing style sheets. .ie n .IP "medium => ""print""" 4 .el .IP "medium => ``print''" 4 .IX Item "medium => print" The medium for which the style sheet should apply, one of \f(CW\*(C`aural\*(C'\fR, \f(CW\*(C`braille\*(C'\fR, \&\f(CW\*(C`embossed\*(C'\fR, \f(CW\*(C`handheld\*(C'\fR, \f(CW\*(C`print\*(C'\fR, \f(CW\*(C`screen\*(C'\fR, \f(CW\*(C`tty\*(C'\fR, \f(CW\*(C`tv\*(C'\fR, and \f(CW\*(C`presentation\*(C'\fR. A special value \f(CW\*(C`all\*(C'\fR can also be specified. The default is \f(CW\*(C`undef\*(C'\fR in which case the \s-1CSS\s0 Validator determines a value; this would currently be as if \f(CW\*(C`all\*(C'\fR had been specified. .ie n .IP "profile => ""css3""" 4 .el .IP "profile => ``css3''" 4 .IX Item "profile => css3" The \s-1CSS\s0 Version or profile to validate against, legal values are \f(CW\*(C`css1\*(C'\fR, \f(CW\*(C`css2\*(C'\fR, \f(CW\*(C`css21\*(C'\fR, \&\f(CW\*(C`css3\*(C'\fR, \f(CW\*(C`svg\*(C'\fR, \f(CW\*(C`svgbasic\*(C'\fR, \f(CW\*(C`svgtiny\*(C'\fR, \f(CW\*(C`mobile\*(C'\fR, \f(CW\*(C`atsc\-tv\*(C'\fR, and \f(CW\*(C`tv\*(C'\fR. A special value \f(CW\*(C`none\*(C'\fR can also be used. The default is \f(CW\*(C`undef\*(C'\fR in which case the \s-1CSS\s0 Validator determines a default. .IP "warnings => 2" 4 .IX Item "warnings => 2" Either \*(L"no\*(R" or an integer \f(CW0\fR \- \f(CW2\fR that determines how many warning messages you want to get back from the \s-1CSS\s0 Validator. \*(L"no\*(R" means no warning, \f(CW0\fR means only the most serious warnings, and \f(CW2\fR will give all warnings, including low level ones. The defaut is \f(CW\*(C`undef\*(C'\fR in which case the \s-1CSS\s0 Validator determines a default value; this is expected to be as if \f(CW1\fR had been specified. .ie n .IP "language => ""de""" 4 .el .IP "language => ``de''" 4 .IX Item "language => de" The desired language of the supposedly human-readable messages. The string will passed as an \f(CW\*(C`Accept\-Language\*(C'\fR header in the \s-1HTTP\s0 request. The \s-1CSS\s0 Validator currently supports \f(CW\*(C`en\*(C'\fR, \f(CW\*(C`de\*(C'\fR, \f(CW\*(C`fr\*(C'\fR, \f(CW\*(C`ja\*(C'\fR, \f(CW\*(C`nl\*(C'\fR, \f(CW\*(C`zh\*(C'\fR, and \f(CW\*(C`zh\-cn\*(C'\fR. .RE .RS 4 .RE .ie n .IP "my $success = $val\->success" 4 .el .IP "my \f(CW$success\fR = \f(CW$val\fR\->success" 4 .IX Item "my $success = $val->success" Same as the return value of \f(CW\*(C`validate()\*(C'\fR. .ie n .IP "my $is_valid = $val\->is_valid" 4 .el .IP "my \f(CW$is_valid\fR = \f(CW$val\fR\->is_valid" 4 .IX Item "my $is_valid = $val->is_valid" Returns a true value if the last attempt to \f(CW\*(C`validate()\*(C'\fR succeeded and the validator reported no errors in the style sheet. .ie n .IP "my $num_errors = $val\->errorcount" 4 .el .IP "my \f(CW$num_errors\fR = \f(CW$val\fR\->errorcount" 4 .IX Item "my $num_errors = $val->errorcount" returns the number of errors found for the checked style sheet. Get the details of the errors with \f(CW$val\fR\->errors (see below). .ie n .IP "my @errors = $val\->errors" 4 .el .IP "my \f(CW@errors\fR = \f(CW$val\fR\->errors" 4 .IX Item "my @errors = $val->errors" Returns a list with information about the errors found for the style sheet. An error is a hash reference; the example in the synopsis would currently return something like .Sp .Vb 8 \& ( { \& context => \*(Aqp\*(Aq, \& property => \*(Aqcolor\*(Aq, \& expression => { start => \*(Aq\*(Aq, end => \*(Aqnot\-a\-color\*(Aq } \& errortype => \*(Aqparse\-error\*(Aq, \& message => \*(Aqnot\-a\-color is not a color value\*(Aq, \& line => 0, \& } ) .Ve .ie n .IP "my $num_warnings = $val\->warningcount" 4 .el .IP "my \f(CW$num_warnings\fR = \f(CW$val\fR\->warningcount" 4 .IX Item "my $num_warnings = $val->warningcount" returns the number of warnings found for the checked style sheet. Get the details of each warning with \f(CW$val\fR\->warnings (see below). .ie n .IP "my @warnings = $val\->warnings" 4 .el .IP "my \f(CW@warnings\fR = \f(CW$val\fR\->warnings" 4 .IX Item "my @warnings = $val->warnings" Returns a list with information about the warnings found for the style sheet. .ie n .IP "my $ua = $val\->user_agent" 4 .el .IP "my \f(CW$ua\fR = \f(CW$val\fR\->user_agent" 4 .IX Item "my $ua = $val->user_agent" .PD 0 .ie n .IP "my $ua = $val\->user_agent($new_ua)" 4 .el .IP "my \f(CW$ua\fR = \f(CW$val\fR\->user_agent($new_ua)" 4 .IX Item "my $ua = $val->user_agent($new_ua)" .PD The LWP::UserAgent object you supplied to the constructor or a custom object created at construction time you can manipulate. .Sp .Vb 2 \& # set timeout to 30 seconds \& $val\->user_agent\->timeout(30); .Ve .Sp You can also supply a new object to replace the old one. .ie n .IP "my $uri = $val\->validator_uri" 4 .el .IP "my \f(CW$uri\fR = \f(CW$val\fR\->validator_uri" 4 .IX Item "my $uri = $val->validator_uri" .PD 0 .ie n .IP "my $uri = $val\->validator_uri($validator_uri)" 4 .el .IP "my \f(CW$uri\fR = \f(CW$val\fR\->validator_uri($validator_uri)" 4 .IX Item "my $uri = $val->validator_uri($validator_uri)" .PD Gets or sets the \s-1URI\s0 of the validator. If you did not specify a custom \s-1URI,\s0 \f(CW\*(C`http://jigsaw.w3.org/css\-validator/validator\*(C'\fR by default. .ie n .IP "my $response = $val\->response" 4 .el .IP "my \f(CW$response\fR = \f(CW$val\fR\->response" 4 .IX Item "my $response = $val->response" The HTTP::Response object returned from the last request. This is useful to determine why validation might have failed. .Sp .Vb 5 \& if (!$val\->validate(string => $css)) { \& if (!$val\->response\->is_success) { \& print $val\->response\->message, "\en" \& } \& } .Ve .ie n .IP "my $uri = $val\->request_uri" 4 .el .IP "my \f(CW$uri\fR = \f(CW$val\fR\->request_uri" 4 .IX Item "my $uri = $val->request_uri" The \s-1URI\s0 object used for the last request. .ie n .IP "my $som = $val\->som" 4 .el .IP "my \f(CW$som\fR = \f(CW$val\fR\->som" 4 .IX Item "my $som = $val->som" The \s-1SOAP::SOM\s0 object for the last successful deserialization, check the return value of \f(CW\*(C`validate()\*(C'\fR or \f(CW\*(C`success()\*(C'\fR before using the object. .SH "BUGS" .IX Header "BUGS" This module uses the \s-1SOAP\s0 interface for the W3C \s-1CSS\s0 validatom, which still has a number of bugs, tracked via W3C's Bugzilla, . .PP Please report bugs in the W3C \s-1CSS\s0 Validator to www\-validator\-css@w3.org or enter them directly in Bugzilla (see above). Please report bugs in this module via \s-1RT,\s0 . .SH "NOTE" .IX Header "NOTE" This module is not directly associated with the W3C. Please remember that the \s-1CSS\s0 Validator is a shared resource so do not abuse it: you should sleep between requests, and consider installing the Validator locally, see . .SH "AUTHOR / COPYRIGHT / LICENSE" .IX Header "AUTHOR / COPYRIGHT / LICENSE" .Vb 2 \& Copyright 2004\-2013 Bjoern Hoehrmann . \& This module is licensed under the same terms as Perl itself. .Ve