HTMLObject::Base(3)

NAME
HTMLObject::Base - Perl extension for HTMLObject.

SYNOPSIS
  use HTMLObject::Base;
  my $doc = HTMLObject::Base->new();

  $doc->setTitle("Test of HTMLObject::Base");
  $doc->setFocus("body");
  $doc->print(<<"END_OF_BODY");
  <center>
  <h1>HTMLObject::Base</h1>
  <br>
  This is cool!
  END_OF_BODY

  $doc->setCookie(name => 'cookie name', value => 'This rocks!');

  # Actually generate the entire document, cookie and all!
  $doc->display();

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.

Exported FUNCTIONS
  scalar new()
    Creates a new instance of the HTMLObject::Base document type.

  void reset()
    Resets the HTMLObject::Base document back to the defaults.

  void set_error_message(code => '', message => '')
    This adds the error message associated with code to the
    errorMessages hash. Modifies %errorMessages.

  void setErrorMessage(code => '', message => '')
    This adds the error message associated with code to the
    errorMessages hash. Modifies %errorMessages.

  void clear_error_message(code => '')
    This removes the message associated with code from the
    errorMessages hash. Modifies %errorMessages.

  void clearErrorMessage(code => '')
    This removes the message associated with code from the
    errorMessages hash. Modifies %errorMessages.

  void set_error(code => '')
    This takes the code and sets $error=1, $errorCode = $code. This is a
    helper function for the derived classes to use to signal when an
    error has occurred. Modifies $error and $errorCode.

  void setError(code => '')
    This takes the code and sets $error=1, $errorCode = $code. This is a
    helper function for the derived classes to use to signal when an
    error has occurred. Modifies $error and $errorCode.

  scalar didErrorOccurr() - (This is gone in 2.x series.)
    Returns 1 if an error occurred, 0 otherwise.

  scalar didErrorOccur()
    Returns 1 if an error occurred, 0 otherwise.

  scalar getErrorMessage()
    Returns the message that was generated via the code that was set.

  scalar getErrorCode()
    Returns the code that was set to indicate the error that occurred.

  void doRequiredParameterError(title => '', message => '')
    Creates an Error document using the customized title to display the
    error of Required Parameter missing. The specified message is also
    included in the body so that the program can notify the user of what
    variable is missing. Uses displayError() to generate the Error
    document.

  void display()
    This function generates the Base Document displaying any cookies,
    plus the contents of the Body that the user created.  This function
    prints the generated document to standard out which is then hopefully
    being sent to a web server to process.

  void displayError(title => '', message => '')
    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.

  void set_content_type(content_type) (scalar value)
    Uses the specified string to set the content-type: header with.
    Modifies $contentTypeString. If $contentType not equal to
    "text/html" then the focus is automatically set to "body".

  void setContentType(contentType) (scalar value)
    Uses the specified string to set the content-type: header with.
    Modifies $contentTypeString. If $contentType not equal to
    "text/html" then the focus is automatically set to "body".

  scalar get_content_type()
    Returns $contentTypeString.  If the content-type string is
    text/html, then the ; charset=xxxx is also appended.

  scalar getContentType()
    Returns $contentTypeString.  If the content-type string is
    text/html, then the ; charset=xxxx is also appended.

  void set_language_encoding(language => 'en', encoding => 'iso-8859-1')
    Sets the language and encoding values to the specified values after
    validating that they exist and are valid together.

  void setLanguageEncoding(language => 'en', encoding => 'iso-8859-1')
    Sets the language and encoding values to the specified values after
    validating that they exist and are valid together.

  scalar get_language()
    Returns the value of $language.

  scalar getLanguage()
    Returns the value of $language.

  scalar get_language_name()
    Returns the name of the language we are using.

  scalar getLanguageName()
    Returns the name of the language we are using.

  scalar lookup_language_name(code => 'en')
    Returns the name of the language code that is specified.  Defaults
    to looking up english if nothing specified.  Returns an empty string
    if the language code is not defined in our hash.

  scalar lookupLanguageName(code => 'en')
    Returns the name of the language code that is specified.  Defaults
    to looking up english if nothing specified.  Returns an empty string
    if the language code is not defined in our hash.

  scalar get_char_encoding()
    Returns the value of $charsetEncoding.

  scalar getCharEncoding()
    Returns the value of $charsetEncoding.

  (scalar or @ ref) lookup_char_encoding(code => 'en')
    Returns the array ref or string that represents the valid charset
    encodings that this language code supports.  Defaults to looking up
    english if nothing specified.

  (scalar or @ ref) lookupCharEncoding(code => 'en')
    Returns the array ref or string that represents the valid charset
    encodings that this language code supports.  Defaults to looking up
    english if nothing specified.

  void set_title(title)  (scalar value)
    Uses the specified string to set the title with. Modifies
    $titleString.

  void setTitle(title)  (scalar value)
    Uses the specified string to set the title with. Modifies
    $titleString.

  scalar get_title()
    Returns $titleString.

  scalar getTitle()
    Returns $titleString.

  scalar get_head_string()
    Returns $headString.

  scalar getHeadString()
    Returns $headString.

  scalar get_body_string()
    Returns $bodyString.

  scalar getBodyString()
    Returns $bodyString.

  scalar encode_string(string => '')
    URI encodes the string and returns the result.

  scalar encodeString(string => '')
    URI encodes the string and returns the result.

  scalar form_encode_string(string => '')
    encode the string to replace all HTML special characters with their
    tag equivalents.  Ex.  & => &amp;

  scalar formEncodeString(string => '')
    encode the string to replace all HTML special characters with their
    tag equivalents.  Ex.  & => &amp;

  void set_cookie(name => '', value => '', expires => '', path => '',
                  domain => '', secure => '')
    Creates an entry in the cookies array that specifies the name=value
    pair and the expiration date and if it is to be secure for the
    specified cookie.  If secure is defined then it is included in the
    Set-Cookie line, else it is left out. The value does not matter as it
    is a tag in the Set-Cookie line and not a name=value item. Modifies
    @cookies.

    Valid formats for the expiration date are:
             Weekday, dd-Mon-yyyy hh:mm:ss GMT
    Valid formats for the domain are:
             The domain must be within the current domain and must have
             2 or more periods depending on the type of domain.
             Ex. ".host.com"

  void setCookie(name => '', value => '', expires => '', path => '',
                 domain => '', secure => '')
    Creates an entry in the cookies array that specifies the name=value
    pair and the expiration date and if it is to be secure for the
    specified cookie.  If secure is defined then it is included in the
    Set-Cookie line, else it is left out. The value does not matter as it
    is a tag in the Set-Cookie line and not a name=value item. Modifies
    @cookies.

    Valid formats for the expiration date are:
             Weekday, dd-Mon-yyyy hh:mm:ss GMT
    Valid formats for the domain are:
             The domain must be within the current domain and must have
             2 or more periods depending on the type of domain.
             Ex. ".host.com"

  void set_compressed_cookie(name => '', cookies => [name, value],
                             expires => '', path => '', domain => '',
                             secure => '')
    Creates an entry in the cookies array that specifes the name=value
    pair where the value is the embedded cookies to be stored in this
    cookie. The embedded cookies are seperated with a :: but other than
    that everything else is the same as setCookie. The cookies hash
    entry is pointing to an array where each entry is another array with
    the first entry being the name and the second entry the value for
    each embedded cookie. Modifies @cookies.

  void setCompressedCookie(name => '', cookies => [name, value],
                           expires => '', path => '', domain => '',
                           secure => '')
    Creates an entry in the cookies array that specifes the name=value
    pair where the value is the embedded cookies to be stored in this
    cookie. The embedded cookies are seperated with a :: but other than
    that everything else is the same as setCookie. The cookies hash
    entry is pointing to an array where each entry is another array with
    the first entry being the name and the second entry the value for
    each embedded cookie. Modifies @cookies.

  void set_meta_tag('http-equiv' => '', content => '')
    Creates an entry in the meta_tags array that specifies the http-equiv
    and content values for the specified Meta tag to be created when
    display is called. Modifies @metaTags.

  void setMetaTag('http-equiv' => '', content => '')
    Creates an entry in the meta_tags array that specifies the http-equiv
    and content values for the specified Meta tag to be created when
    display is called. Modifies @metaTags.

  void set_focus(section) (scalar value)
    Validates the section name specified and then sets the internal
    pointer to the specified section. The output of any following print,
    read, or delete commands will work with the specified section.
    Modifies $currentSection.

  void setFocus(section) (scalar value)
    Validates the section name specified and then sets the internal
    pointer to the specified section. The output of any following print,
    read, or delete commands will work with the specified section.
    Modifies $currentSection.

  scalar get_focus()
    Returns the currently specified section.

  scalar getFocus()
    Returns the currently specified section.

  void print(string) (scalar value)
    Appends the contents of string to the currently specified section.
    This could modify $headString or $bodyString.

  scalar read()
    Returns the contents of the currently specified section. This could
    be $headString or $bodyString.

  void delete()
    Deletes the contents of the currently specified section. You should
    call read() before doing this so you can restore if this was an
    accident. This could modify $headString or $bodyString.

  void set_body_bgcolor(color)  (scalar value)
    This function sets the background color for the body. Modifies
    $bodyBgcolor.

  void setBodyBgcolor(color)  (scalar value)
    This function sets the background color for the body. Modifies
    $bodyBgcolor.

  scalar get_body_bgcolor()
    This function returns the background color for the body.

  scalar getBodyBgcolor()
    This function returns the background color for the body.

  void set_body_fgcolor(color)  (scalar value)
    This function sets the text color for the body. Modifies
    $bodyFgcolor.

  void setBodyFgcolor(color)  (scalar value)
    This function sets the text color for the body. Modifies
    $bodyFgcolor.

  scalar get_body_fgcolor()
    This function returns the text color for the body.

  scalar getBodyFgcolor()
    This function returns the text color for the body.

  void set_body_link_color(color)  (scalar value)
    This function sets the default link color for the body. Modifies
    $bodyLinkColor.

  void setBodyLinkColor(color)  (scalar value)
    This function sets the default link color for the body. Modifies
    $bodyLinkColor.

  scalar get_body_link_color()
    This function returns the default link color for the body.

  scalar getBodyLinkColor()
    This function returns the default link color for the body.

  void set_body_vlink_color(color)  (scalar value)
    This function sets the visited link color for the body. Modifies
    $bodyVlinkColor.

  void setBodyVlinkColor(color)  (scalar value)
    This function sets the visited link color for the body. Modifies
    $bodyVlinkColor.

  scalar get_body_vlink_color()
    This function returns the visited link color for the body.

  scalar getBodyVlinkColor()
    This function returns the visited link color for the body.

  void set_body_alink_color(color)  (scalar value)
    This function sets the active link color for the body. Modifies
    $bodyAlinkColor.

  void setBodyAlinkColor(color)  (scalar value)
    This function sets the active link color for the body. Modifies
    $bodyAlinkColor.

  scalar get_body_alink_color()
    This function returns the active link color for the body.

  scalar getBodyAlinkColor()
    This function returns the active link color for the body.

  void set_body_image(image)  (scalar value)
    This function sets the background image for the body. Modifies
    $bodyImage.

  void setBodyImage(image)  (scalar value)
    This function sets the background image for the body. Modifies
    $bodyImage.

AUTHOR
James A. Pattie, htmlobject@pcxperience.com

SEE ALSO
perl(1), HTMLObject::Normal(3), HTMLObject::FrameSet(3), HTMLObject::ReadCookie(3).