.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 "CGI::Test::Page 3pm" .TH CGI::Test::Page 3pm "2022-06-10" "perl v5.34.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" CGI::Test::Page \- Abstract represention of an HTTP reply content .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Deferred class, only heirs can be created \& # $page holds a CGI::Test::Page object \& \& use CGI::Test; \& \& ok 1, $page\->is_ok; \& ok 2, $page\->user ne \*(Aq\*(Aq; # authenticated access \& \& my $ctype = $page\->content_type; \& ok 3, $ctype eq "text/plain"; \& \& $page\->delete; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`CGI::Test::Page\*(C'\fR class is deferred. It is an abstract representation of an \s-1HTTP\s0 reply content, which would be displayed on a browser, as a page. It does not necessarily hold \s-1HTML\s0 content. .PP Here is an outline of the class hierarchy tree, with the leading \f(CW\*(C`CGI::Test::\*(C'\fR string stripped for readability, and a trailing \f(CW\*(C`*\*(C'\fR indicating deferred clases: .PP .Vb 6 \& Page* \& Page::Error \& Page::Real* \& Page::HTML \& Page::Other \& Page::Text .Ve .PP Those classes are constructed as needed by \f(CW\*(C`CGI::Test\*(C'\fR. You must always call \fIdelete\fR on them to break the circular references if you care about reclaiming unused memory. .SH "INTERFACE" .IX Header "INTERFACE" This is the interface defined at the \f(CW\*(C`CGI::Test::Page\*(C'\fR level. Each subclass may add further specific features, but the following is available to the whole hierarchy: .ie n .IP """content_type""" 4 .el .IP "\f(CWcontent_type\fR" 4 .IX Item "content_type" The \s-1MIME\s0 content type, along with parameters, as it appeared in the headers. For instance, it can be: .Sp .Vb 1 \& text/html; charset=ISO\-8859\-1 .Ve .Sp Don't assume it to be just \f(CW\*(C`text/html\*(C'\fR though. Use something like: .Sp .Vb 1 \& ok 1, $page\->content_type =~ m|^text/html\eb|; .Ve .Sp in your regression tests, which will match whether there are parameters following the content type or not. .ie n .IP """delete""" 4 .el .IP "\f(CWdelete\fR" 4 .IX Item "delete" Breaks circular references to allow proper reclaiming of unused memory. Must be the last thing to call on the object before forgetting about it. .ie n .IP """error_code""" 4 .el .IP "\f(CWerror_code\fR" 4 .IX Item "error_code" The error code. Will be 0 to mean \s-1OK,\s0 but otherwise \s-1HTTP\s0 error codes are used, as described by HTTP::Status. .ie n .IP """forms""" 4 .el .IP "\f(CWforms\fR" 4 .IX Item "forms" Returns a list reference containing all the \s-1CGI\s0 forms on the page, as \f(CW\*(C`CGI::Test::Form\*(C'\fR objects. Will be an empty list for anything but \f(CW\*(C`CGI::Test::Page::HTML\*(C'\fR, naturally. .ie n .IP """form_count""" 4 .el .IP "\f(CWform_count\fR" 4 .IX Item "form_count" The amount of forms held in the \f(CW\*(C`forms\*(C'\fR list. .ie n .IP """is_error""" 4 .el .IP "\f(CWis_error\fR" 4 .IX Item "is_error" Returns \fItrue\fR when the page indicates an \s-1HTTP\s0 error. .ie n .IP """is_ok""" 4 .el .IP "\f(CWis_ok\fR" 4 .IX Item "is_ok" Returns \fItrue\fR when the page is not the result of an \s-1HTTP\s0 error. .ie n .IP """server""" 4 .el .IP "\f(CWserver\fR" 4 .IX Item "server" Returns the server object that returned the page. Currently, this is the \f(CW\*(C`CGI::Test\*(C'\fR object, but it might change one day. In any case, this is the place where \s-1GET/POST\s0 requests may be addresed. .ie n .IP """user""" 4 .el .IP "\f(CWuser\fR" 4 .IX Item "user" The authenticated user that requested this page, or \f(CW\*(C`undef\*(C'\fR if no authentication was made. .SH "AUTHORS" .IX Header "AUTHORS" The original author is Raphael Manfredi. .PP Steven Hilton was long time maintainer of this module. .PP Current maintainer is Alexander Tokarev \fI\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBCGI::Test::Page::Error\fR\|(3), \fBCGI::Test::Page::Real\fR\|(3).