# Base.pm - The Base Class that the FrameSet and Normal HTML document Objects
# are derived from.
# Created by James Pattie, 04/27/2000.
# Copyright (c) 2000 PC & Web Xperience, Inc. http://www.pcxperience.com/
# All rights reserved. This program is free software; you can redistribute it
# and/or modify it under the same terms as Perl itself.
# updated 02/24/2001 - Converted to new method and variable naming convention.
# updated 06/05/2001 - Add non-Buffering mode.
# updated 10/06/2001 - Added debug display code and tag substitution support.
# updated 10/08/2001 - Started to fix the indentation problem with textareas.
# updated 10/15/2001 - Removing the error if the tag doesn't exist in printTag.
# updated 10/23/2001 - Added support to decode a string which has form encoded chars in it.
# updated 11/20/2001 - Added support for selecting the version of HTML to generate a DOCTYPE for.
package HTMLObject::Base;
use strict;
use POSIX qw(strftime);
use Date::Manip qw(ParseDate UnixDate DateCalc Date_ConvTZ);
use vars qw($AUTOLOAD $VERSION @ISA @EXPORT @EXPORT_OK);
require Exporter;
=head1 NAME
HTMLObject::Base - Perl extension for HTMLObject.
=head1 SYNOPSIS
use HTMLObject::Base;
my $doc = HTMLObject::Base->new();
$doc->setTitle("Test of HTMLObject::Base");
$doc->setFocus("body");
$doc->print(<<"END_OF_BODY");
HTMLObject::Base
This is cool!
END_OF_BODY
$doc->setCookie(name => 'cookie name', value => 'This rocks!');
# Actually generate the entire document, cookie and all!
$doc->display();
=head1 DESCRIPTION
HTMLObject::Base provides the Base methods needed to create a generic
HTML document dynamically. See documentation.html for complete details.
It now supports Internationalization via the lang and charset
attributes of the html tag and the Content-type.
=head1 Exported FUNCTIONS
=over 4
=cut
@ISA = qw(Exporter AutoLoader);
@EXPORT = qw(
);
$VERSION = '2.28';
# pre-declare the variables so that I can access them from the HTMLObject::Form module, etc.
use vars qw($formEncodedCharacters %formEncodedCharactersHash $formUnEncodedCharacters %formUnEncodedCharactersHash @htmlTags @htmlTagArgs $encodeCharacters %codeToCharset %codeToLanguage %doctypesHash %xhtmlDocTypesHash);
# Internationalization support
%codeToLanguage = (
"ab" => "Abkhazian",
"om" => "Afan",
"aa" => "Afar",
"af" => "Afrikaans",
"sq" => "Albanian",
"am" => "Amharic",
"ar" => "Arabic",
"hy" => "Armenian",
"as" => "Assamese",
"ay" => "Aymara",
"az" => "Azerbaijani",
"ba" => "Bashkir",
"eu" => "Basque",
"bn" => "Bengali",
"dz" => "Bhutani",
"bh" => "Bihari",
"bi" => "Bislama",
"br" => "Breton",
"bg" => "Bulgarian",
"my" => "Burmese",
"be" => "Byelorussian",
"km" => "Cambodian",
"ca" => "Catalan",
"zh" => "Chinese",
"co" => "Corsican",
"hr" => "Croatian",
"cs" => "Czech",
"da" => "Danish",
"nl" => "Dutch",
"en" => "English",
"eo" => "Esperanto",
"et" => "Estonian",
"fo" => "Faroese",
"fj" => "Fiji",
"fi" => "Finnish",
"fr" => "French",
"fy" => "Frisian",
"gl" => "Galician",
"ka" => "Georgian",
"de" => "German",
"el" => "Greek",
"kl" => "Greenlandic",
"gn" => "Guarani",
"gu" => "Gujarati",
"ha" => "Hausa",
"he" => "Hebrew", # used to be iw
"hi" => "Hindi",
"hu" => "Hungarian",
"is" => "Icelandic",
"id" => "Indonesian",
"ia" => "Interlingua",
"ie" => "Interlingue",
"iu" => "Inuktitut",
"ik" => "Inupiak",
"ga" => "Irish",
"it" => "Italian",
"ja" => "Japanese",
"jv" => "Javanese",
"kn" => "Kannada",
"ks" => "Kashmiri",
"kk" => "Kazakh",
"rw" => "Kinyarwanda",
"ky" => "Kirghiz",
"rn" => "Kurundi",
"ko" => "Korean",
"ku" => "Kurdish",
"lo" => "Laothian",
"la" => "Latin",
"lv" => "Latvian",
"ln" => "Lingala",
"lt" => "Lithuanian",
"mk" => "Macedonian",
"mg" => "Malagasy",
"ms" => "Malay",
"ml" => "Malayalam",
"mt" => "Maltese",
"mi" => "Maori",
"mr" => "Marathi",
"mo" => "Moldavian",
"mn" => "Mongolian",
"na" => "Nauru",
"ne" => "Nepali",
"no" => "Norwegian",
"oc" => "Occitan",
"or" => "Oriya",
"ps" => "Pashto",
"fa" => "Persian",
"pl" => "Polish",
"pt" => "Portuguese",
"pa" => "Punjabi",
"qu" => "Quechua",
"rm" => "Rhaeto-Romance",
"ro" => "Romanian",
"ru" => "Russian",
"sm" => "Samoan",
"sg" => "Sangho",
"sa" => "Sanskrit",
"gd" => "Scots Gaelic",
"sr" => "Serbian",
"sh" => "Serbo-Croatian",
"st" => "Sesotho",
"tn" => "Setswana",
"sn" => "Shona",
"sd" => "Sindhi",
"si" => "Singhalese",
"ss" => "Siswati",
"sk" => "Slovak",
"sl" => "Slovenian",
"so" => "Somali",
"es" => "Spanish",
"su" => "Sundanese",
"sw" => "Swahili",
"sv" => "Swedish",
"tl" => "Tagalog",
"tg" => "Tajik",
"ta" => "Tamil",
"tt" => "Tatar",
"te" => "Telugu",
"th" => "Thai",
"bo" => "Tibetan",
"ti" => "Tigrinya",
"to" => "Tonga",
"ts" => "Tsonga",
"tr" => "Turkish",
"tk" => "Turkmen",
"tw" => "Twi",
"ug" => "Uigur",
"uk" => "Ukrainian",
"ur" => "Urdu",
"uz" => "Uzbek",
"vi" => "Vietnamese",
"vo" => "Volapuk",
"cy" => "Welsh",
"wo" => "Wolof",
"xh" => "Xhosa",
"yi" => "Yiddish",
"yo" => "Yoruba",
"za" => "Zhuang",
"zu" => "Zulu",
);
# This hash takes the 2 letter abreviation and returns the charset encoding to use with it. It is possible to return an array if there is more than
# one possible encoding that is standard for that language.
%codeToCharset = (
"af" => [ "iso-8859-1", "windows-1252" ],
"sq" => [ "iso-8859-1", "windows-1252" ],
"ar" => "iso-8859-6",
"eu" => [ "iso-8859-1", "windows-1252" ],
"bg" => "iso-8859-5",
"be" => "iso-8859-5",
"ca" => [ "iso-8859-1", "windows-1252" ],
"hr" => "iso-8859-2",
"cs" => "iso-8859-2",
"da" => [ "iso-8859-1", "windows-1252" ],
"nl" => [ "iso-8859-1", "windows-1252" ],
"en" => [ "iso-8859-1", "windows-1252" ],
"eo" => "iso-8859-3",
"et" => "iso-8859-10",
"fo" => [ "iso-8859-1", "windows-1252" ],
"fi" => [ "iso-8859-1", "windows-1252" ],
"fr" => [ "iso-8859-1", "windows-1252" ],
"gl" => [ "iso-8859-1", "windows-1252" ],
"de" => [ "iso-8859-1", "windows-1252" ],
"el" => "iso-8859-7",
"he" => "iso-8859-8",
"hu" => "iso-8859-2",
"is" => [ "iso-8859-1", "windows-1252" ],
"ga" => [ "iso-8859-1", "windows-1252" ],
"it" => [ "iso-8859-1", "windows-1252" ],
"ja" => [ "shift_jis", "iso-2022", "euc-jp" ],
"lv" => "iso-8859-10",
"lt" => "iso-8859-10",
"mk" => "iso-8859-5",
"mt" => "iso-8859-3",
"no" => [ "iso-8859-1", "windows-1252" ],
"pl" => "iso-8859-2",
"pt" => [ "iso-8859-1", "windows-1252" ],
"ro" => "iso-8859-2",
"ru" => [ "koi-8-r", "windows-1252" ],
"sr" => "iso-8859-5",
"sk" => "iso-8859-2",
"sl" => "iso-8859-2",
"es" => [ "iso-8859-1", "windows-1252" ],
"sv" => [ "iso-8859-1", "windows-1252" ],
"tr" => [ "iso-8859-9", "windows-1254" ],
"uk" => "iso-8859-5",
);
$encodeCharacters = ';,=&: \n"#$\/?<>@';
# removed the \$ => \$\$ conversions as they don't appear to be needed and removed ' => '
$formEncodedCharacters = '&|<|>|"';
%formEncodedCharactersHash = ( '<' => '<', '>' => '>', '"' => '"', '&' => '&', );
$formUnEncodedCharacters = '<>"';
%formUnEncodedCharactersHash = ( '<' => '<', '>' => '>', '"' => '"', '&' => '&', );
@htmlTags = qw /a abbr acronym address area b base basefont bdo big blockquote
br button caption center cite code col colgroup dd del dfn dir
div dl dt em fieldset font form h1 h2 h3 h4 h5 h6 hr i iframe
img input ins isindex kbd label legend li map menu object ol
optgroup option p param pre q s samp script select small span
strike strong sub sup table tbody td textarea tfoot th thead
tr tt u ul var/;
@htmlTagArgs = qw/abbr accept-charset accept accesskey action align alt archive
axis bgcolor border cellpadding cellspacing char charoff
charset checked cite class clear codebase color cols colspan
compact coords datetime dir disabled enctype face for frame
headers height href hreflang hspace id ismap label lang
longdesc marginheight marginwidth maxlength method
multiple name nohref noshade nowrap onblur onchange onclick
ondblclick onfocus onkeydown onkeypress onkeyup onmousedown
onmousemove onmouseout onmouseover onmouseup onselect
onsubmit prompt readonly rel rows rowspan rules scope
scrolling selected shape size span src start style summary
tabindex target title type usemap valign value valuetype
vspace width/;
# supported DOCTYPE's
%doctypesHash = ( "4.0" =>
{
"strict" => "",
"loose" => "",
},
"4.01" =>
{
"strict" => "",
"loose" => "",
},
);
%xhtmlDocTypesHash = ( "1.0" =>
{
"strict" => "",
"loose" => "",
},
);
=item scalar new(displayOnExit)
Creates a new instance of the HTMLObject::Base document type.
Optional: displayOnExit - boolean (1 or 0). If true (1), when the
object goes out of scope and the display() or startDisplaying()
methods have not been called and we have not been instructed to
not display via the doNotDisplay() method, then we call display()
thus transparently making sure the object is output to the user.
displayOnExit defaults to 0 (false).
=cut
sub new
{
my $that = shift;
my $class = ref($that) || $that;
my $self = bless {}, $class;
my %args = ( displayOnExit => 0, @_ );
$self->{error} = 0; # no error initially.
$self->{errorMessages} = { 1002 => 'Required Parameter missing',
1007 => 'Error Code already being used',
};
$self->setErrorMessage(code => '-1', message => 'No error occurred');
$self->setErrorMessage(code => '1000', message => 'Invalid Content-Type Specified');
$self->setErrorMessage(code => '1001', message => 'Invalid Focus Specified');
$self->setErrorMessage(code => '1003', message => "Eval'ing setCookie command failed");
$self->setErrorMessage(code => '1004', message => 'Invalid Date for Cookie Expires');
$self->setErrorMessage(code => '1005', message => 'Invalid Domain for Cookie');
$self->setErrorMessage(code => '1006', message => 'Invalid Section used when Content-Type not equal to "text/html"');
$self->setErrorMessage(code => '1008', message => 'Error Code does not exist');
$self->setErrorMessage(code => '1009', message => "Invalid Language Code");
$self->setErrorMessage(code => '1010', message => "Recognized Language Code but No Charset Encoding Known");
$self->setErrorMessage(code => '1011', message => "Charset Encoding Not Valid");
$self->setErrorMessage(code => '1012', message => "In Buffering Mode");
$self->setErrorMessage(code => '1013', message => "In non-Buffering Mode");
$self->setErrorMessage(code => '1014', message => "Invalid variable or function");
$self->setErrorMessage(code => '3000', message => 'Parameters and Options are both required if they are to be used');
$self->setErrorMessage(code => '3001', message => 'Invalid Decoration type specified');
$self->setErrorMessage(code => '3002', message => 'Value must be specified');
$self->setErrorMessage(code => '3010', message => "Tag not found");
$self->setErrorMessage(code => '1015', message => 'Invalid HTML Version');
$self->setErrorMessage(code => '1016', message => 'Invalid HTML DTD');
$self->setErrorMessage(code => '1017', message => 'Invalid Value');
$self->{errorCode} = -1;
$self->{displayOnExit} = $args{displayOnExit};
$self->{doNotDisplay} = 0; # by default we want to display, if displayOnExit = 1.
$self->{weHaveDisplayed} = 0; # by default we haven't displayed yet.
$self->{currentSection} = "body";
$self->{titleString} = "HTMLObject::Base";
$self->{contentTypeString} = "text/html";
$self->{language} = "en";
$self->{charsetEncoding} = "iso-8859-1";
$self->{headString} = "";
$self->{bodyString} = "";
$self->{bodyBgcolor} = "white";
$self->{bodyFgcolor} = "black";
$self->{bodyImage} = "";
$self->{bodyLinkColor} = "blue";
$self->{bodyVlinkColor} = "blue";
$self->{bodyAlinkColor} = "blue";
$self->{bodyClass} = "";
$self->{bodyID} = "";
$self->{bodyStyle} = "";
$self->{bodyTitle} = "";
$self->{bodyCustomArgs} = ""; # stores user defined attributes for the body tag.
$self->{cookies} = [];
$self->{metaTags} = [];
$self->{encodeCharacters} = $encodeCharacters;
$self->{formEncodedCharacters} = $formEncodedCharacters;
$self->{formUnEncodedCharacters} = $formUnEncodedCharacters;
$self->{formEncodedCharactersHash} = \%formEncodedCharactersHash;
$self->{formUnEncodedCharactersHash} = \%formUnEncodedCharactersHash;
$self->{linkTag} = [];
$self->{baseHrefString} = "";
$self->{baseTargetString} = "";
$self->{cssEntries} = [];
$self->{codeToLanguageHash} = \%codeToLanguage;
$self->{codeToCharsetHash} = \%codeToCharset;
$self->{bufferMode} = 1; # we default to buffer the data.
$self->{allreadyClosed} = 0; # we default to not yet closing the document.
$self->{tagBuffers} = ();
$self->{tagBufferModes} = ();
# define the DOCTYPE's possible.
$self->{doctypes} = \%doctypesHash;
$self->{xhtmlDoctypes} = \%xhtmlDocTypesHash;
$self->{htmlVersion} = "4.01";
$self->{htmlDTD} = "loose";
$self->{xhtml} = 0; # by default we do not use xhtml code.
$self->{docEncoding} = "iso-8859-1";
$self->{displayDTD} = 1; # by default we always display the DTD.
# define the htmlTags we know about.
$self->{htmlTags} = \@htmlTags;
$self->{htmlTagArgs} = \@htmlTagArgs;
# Add Location: support
$self->{location} = "";
return $self;
}
=item void setErrorMessage(code => '', message => '')
This adds the error message associated with code to the
errorMessages hash. Modifies %errorMessages.
=cut
sub setErrorMessage
{
my $self = shift;
my %args = ( @_, );
if (!exists $args{'code'})
{
$self->doRequiredParameterError('setErrorMessage', 'code');
}
if (!exists $args{'message'})
{
$self->doRequiredParameterError('setErrorMessage', 'message');
}
my $code = $args{'code'};
my $message = $args{'message'};
if (exists $self->{errorMessages}{$code})
{
$self->setError(code => '1007');
$self->displayError(title => 'Error: setErrorMessage', message => "Error Code = '$code' already exists!");
}
# otherwise assign this message and code to the hash.
$self->{errorMessages}{$code} = $message;
}
=item void clearErrorMessage(code => '')
This removes the message associated with code from the
errorMessages hash. Modifies %errorMessages.
=cut
sub clearErrorMessage
{
my $self = shift;
my $code;
if (scalar @_ == 1)
{
$code = shift;
}
else
{
my %args = ( @_, );
if (!exists $args{'code'})
{
$self->doRequiredParameterError('setErrorMessage', 'code');
}
$code = $args{'code'};
}
if (!exists $self->{errorMessages}{$code})
{
$self->set_error(code => '1008');
$self->displayError(title => 'Error: setErrorMessage', message => "Error Code = '$code' does not exist in the errorMessages hash!");
}
# otherwise remove this message and code from the hash.
delete($self->{errorMessages}{$code});
}
=item void setError(code => '')
This takes the code and sets $self->{error}=1,
$self->{errorCode} = $code. This is a helper function
for the derived classes to use to signal when an
error has occurred. Modifies $self->{error} and $self->{errorCode}.
=cut
sub setError
{
my $self = shift;
my $code;
if (scalar @_ == 1)
{
$code = shift;
}
else
{
my %args = ( @_, );
if (!exists $args{'code'})
{
$self->doRequiredParameterError('setError', 'code');
}
$code = $args{'code'};
}
$self->{error} = 1;
$self->{errorCode} = $code;
}
=item scalar didErrorOccurr() - (This is gone in 2.x series.)
See didErrorOccur().
=item scalar didErrorOccur()
Returns 1 if an error occurred, 0 otherwise.
=cut
sub didErrorOccur
{
my $self = shift;
return $self->{error};
}
=item scalar getErrorMessage()
Returns the message that was generated via the code that was set.
=cut
sub getErrorMessage
{
my $self = shift;
return $self->{errorMessages}{$self->{errorCode}};
}
=item scalar getErrorCode()
Returns the code that was set to indicate the error that occurred.
=cut
sub getErrorCode
{
my $self = shift;
return $self->{errorCode};
}
=item void reset()
Resets the HTMLObject::Base document back to the defaults.
=cut
sub reset
{
my $self = shift;
$self->{error} = 0; # no error initially.
%{$self->{errorMessages}} = ( 1002 => 'Required Parameter missing',
1007 => 'Error Code already being used',
);
$self->setErrorMessage(code => '-1', message => 'No error occurred');
$self->setErrorMessage(code => '1000', message => 'Invalid Content-Type Specified');
$self->setErrorMessage(code => '1001', message => 'Invalid Focus Specified');
$self->setErrorMessage(code => '1003', message => "Eval'ing setCookie command failed");
$self->setErrorMessage(code => '1004', message => 'Invalid Date for Cookie Expires');
$self->setErrorMessage(code => '1005', message => 'Invalid Domain for Cookie');
$self->setErrorMessage(code => '1006', message => 'Invalid Section used when Content-Type not equal to "text/html"');
$self->setErrorMessage(code => '1008', message => 'Error Code does not exist');
$self->setErrorMessage(code => '1009', message => "Invalid Language Code");
$self->setErrorMessage(code => '1010', message => "Recognized Language Code but No Charset Encoding Known");
$self->setErrorMessage(code => '1011', message => "Charset Encoding Not Valid");
$self->setErrorMessage(code => '1012', message => "In Buffering Mode");
$self->setErrorMessage(code => '1013', message => "In non-Buffering Mode");
$self->setErrorMessage(code => '1014', message => "Invalid variable or function");
$self->setErrorMessage(code => '3000', message => 'Parameters and Options are both required if they are to be used');
$self->setErrorMessage(code => '3001', message => 'Invalid Decoration type specified');
$self->setErrorMessage(code => '3002', message => 'Value must be specified');
$self->setErrorMessage(code => '3010', message => "Tag not found");
$self->setErrorMessage(code => '1015', message => 'Invalid HTML Version');
$self->setErrorMessage(code => '1016', message => 'Invalid HTML DTD');
$self->setErrorMessage(code => '1017', message => 'Invalid Value');
$self->{errorCode} = -1;
$self->{currentSection} = "body";
$self->{titleString} = "HTMLObject::Base";
$self->{contentTypeString} = "text/html";
$self->{language} = "en";
$self->{charsetEncoding} = "iso-8859-1";
$self->{headString} = "";
$self->{bodyString} = "";
$self->{bodyBgcolor} = "white";
$self->{bodyFgcolor} = "black";
$self->{bodyImage} = "";
$self->{bodyLinkColor} = "blue";
$self->{bodyVlinkColor} = "blue";
$self->{bodyAlinkColor} = "blue";
$self->{bodyClass} = "";
$self->{bodyID} = "";
$self->{bodyStyle} = "";
$self->{bodyTitle} = "";
$self->{bodyCustomArgs} = ""; # stores user defined attributes for the body tag.
$self->{cookies} = [];
$self->{metaTags} = [];
$self->{encodeCharacters} = $encodeCharacters;
$self->{formEncodedCharacters} = $formEncodedCharacters;
$self->{formUnEncodedCharacters} = $formUnEncodedCharacters;
$self->{formEncodedCharactersHash} = \%formEncodedCharactersHash;
$self->{formUnEncodedCharactersHash} = \%formUnEncodedCharactersHash;
$self->{linkTag} = [];
$self->{baseHrefString} = "";
$self->{baseTargetString} = "";
$self->{cssEntries} = [];
$self->{codeToLanguageHash} = \%codeToLanguage;
$self->{codeToCharsetHash} = \%codeToCharset;
# we can't reset these if they have already happened!
#$self->{bufferMode} = 1; # we default to buffer the data.
#$self->{allreadyClosed} = 0; # we default to not yet closing the document.
$self->{tagBuffers} = ();
$self->{tagBufferModes} = ();
# define the DOCTYPE's possible.
$self->{doctypes} = \%doctypesHash;
$self->{xhtmlDoctypes} = \%xhtmlDocTypesHash;
$self->{htmlVersion} = "4.01";
$self->{htmlDTD} = "loose";
$self->{xhtml} = 0; # by default we do not use xhtml code.
$self->{docEncoding} = "iso-8859-1";
$self->{displayDTD} = 1; # by default we always display the DTD.
# define the htmlTags we know about.
$self->{htmlTags} = \@htmlTags;
$self->{htmlTagArgs} = \@htmlTagArgs;
# Add Location: support
$self->{location} = "";
}
=item void setDocumentEncoding(encoding => "UTF-8")
requires: encoding - document encoding value default of UTF-8
This function sets the documents encoding format. Your document
defaults to iso-8859-1 if you do not use this method to change it.
This is only available if working with an XHTML document.
=cut
sub setDocumentEncoding
{
my $self = shift;
my $encoding;
if (scalar @_ == 1)
{
$encoding = shift;
}
else
{
my %args = (encoding => "UTF-8", @_);
$encoding = $args{encoding};
}
if (strlen $encoding == 0)
{
$self->doRequiredParameterError('Base::setDocumentEncoding', 'encoding');
}
$self->{docEncoding} = $encoding;
}
=item scalar getDocumentEncoding()
returns the current document encoding value.
This is only available if working with an XHTML document.
=cut
sub getDocumentEncoding
{
my $self = shift;
return $self->{docEncoding};
}
=item void displayError(title => '', message => '', debug => 0|1)
optional: debug (defaults to 0)
Creates a HTML document that displays the user specified error
message along with the error message generated by the program. The
user specified title is used also. The program is exited after the
document is displayed. Uses display() to generate the actual
document. If debug is specified and equals 1, then the
contents of the calling Document will be output in a viewable format
so that the user can determine what would have been generated.
=cut
sub displayError
{
my $self = shift;
my %args = ( title => 'Error: HTMLObject::Base',
message => 'An Error Occurred!', debug => 0,
@_ # arguments passed in go here.
);
my $debug = $args{debug};
if ($self->{bufferMode})
{
$self->doNotDisplay(1); # don't try and display ourselves since an error occured.
my $doc = HTMLObject::Base->new();
$doc->setTitle($args{'title'});
$doc->setFocus("body");
$doc->print("HTMLObject
\n");
$doc->print("Error: " . $self->getErrorCode() . " Occurred!
\n");
$doc->print("Message: " . $self->getErrorMessage() . "\n
\n");
$doc->print("
\n
\n$args{'message'}\n
\n");
$doc->setStyleEntry(tag => "body", string => "color: #000000; background-color: #ffffff;") if ($self->{xhtml});
# set the HTMLInfo based upon what was previously set.
my %docInfo = $self->getHTMLInfo();
$docInfo{dtd} = "loose" if ($docInfo{dtd} eq "frameset");
$doc->setHTMLInfo(%docInfo);
if ($debug == 1)
{
my $output = $self->display(debug => 1);
$output =~ s/^(.*)$/ $1/mg;
$output =~ s/^(.*)$/ $1/mg;
# need to use css in the future.
$doc->print(<<"END_OF_CODE");
| Your Document would have generated: |
|
$output
|
END_OF_CODE
}
$doc->display();
}
else
{
$self->print("HTMLObject
\n");
$self->print("
\nError: " . $self->getErrorCode() . " Occurred!
\n");
$self->print("Message: " . $self->getErrorMessage() . "\n
\n");
$self->print("
\n
\n$args{'message'}\n
\n");
$self->print("