CGI::Test::Page(3pm) | User Contributed Perl Documentation | CGI::Test::Page(3pm) |
CGI::Test::Page - Abstract represention of an HTTP reply content
# 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 ''; # authenticated access my $ctype = $page->content_type; ok 3, $ctype eq "text/plain"; $page->delete;
The "CGI::Test::Page" class is deferred. It is an abstract representation of an HTTP reply content, which would be displayed on a browser, as a page. It does not necessarily hold HTML content.
Here is an outline of the class hierarchy tree, with the leading "CGI::Test::" string stripped for readability, and a trailing "*" indicating deferred clases:
Page* Page::Error Page::Real* Page::HTML Page::Other Page::Text
Those classes are constructed as needed by "CGI::Test". You must always call delete on them to break the circular references if you care about reclaiming unused memory.
This is the interface defined at the "CGI::Test::Page" level. Each subclass may add further specific features, but the following is available to the whole hierarchy:
text/html; charset=ISO-8859-1
Don't assume it to be just "text/html" though. Use something like:
ok 1, $page->content_type =~ m|^text/html\b|;
in your regression tests, which will match whether there are parameters following the content type or not.
The original author is Raphael Manfredi.
Steven Hilton was long time maintainer of this module.
Current maintainer is Alexander Tokarev <tokarev@cpan.org>.
2022-06-10 | perl v5.34.0 |