Colin Kong > LibWeb-0.02 > LibWeb

Download:
LibWeb-0.02.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

LibWeb:: - HTML display for libweb applications

SUPPORTED PLATFORMS ^

BSD, Linux, Solaris and Windows.

REQUIRE ^

ISA ^

SYNOPSIS ^

  use LibWeb::HTML::Default;

  my $rc_file = '/absolute/path/to/dot_lwrc';
  my $html = new LibWeb::HTML::Default($rc_file);

  $html->fatal(
                -msg =>
                  'You have not typed in the stock symbol.',
                -alertMsg =>
                  'Try to view stock quotes without a symbol.',
                -helpMsg =>
                  $html->hit_back_and_edit()
              )
      unless ($stock_symbol);

  my $display =
      $html->display(
                      -content =>
                        [ $news, $stock_quotes, $weather ],
                      -sheader=> [ $tabbed_navigation_bar ],
                      -lpanel=> [ $banner_ad ],
                      -rpanel=> [ $back_issues, $downloads ],
                      -header=> undef,
                      -footer=> undef
                    );

  print "Content-Type: text/html\n\n";
  print $$display;

I pass the absolute path to my LibWeb's rc (config) file to LibWeb::HTML::Default::new() so that LibWeb can do things according to my site's preferences. A sample rc file is included in the eg directory, if you could not find that, go to the following address to down load a standard distribution of LibWeb,

  http://libweb.sourceforge.net

This synopsis also demonstrated how I have handled error by calling the fatal() method. For the display() call, I passed undef to -header and -footer to demonstrate how to tell the display to use default header and footer.

Finally, I de-referenced $display (by appending $ in front of the variable) to print out the HTML page. Please see the synopsis of LibWeb::Themes::Default to see how I have prepared $news, $weather, $stock_quotes, $back_issues and $tabbed_navigation_bar.

If I would like to customize the HTML display of LibWeb, I would have ISAed LibWeb::HTML::Default, say a class called MyHTML and I just have to replace the following two lines,

  use LibWeb::HTML::Default;
  my $html = new LibWeb::HTML::Default( $rc_file );

with

  use MyHTML;
  my $html = new MyHTML( $rc_file );

A sample MyHTML.pm is included in the distribution for your hacking pleasure.

ABSTRACT ^

This class is a sub-class of LibWeb::HTML::Standard, LibWeb::HTML::Error and LibWeb::Themes::Default and therefore it handles both standard and error display (HTML) for a LibWeb application. To customize the behavior of display(), display_error() and built-in error/help messages, you can make a sub-class of LibWeb::HTML::Default (an example can be found in the eg directory. If you could not find it, download a standard distribution from the following address). In the sub-class you made, you can also add your own error messages. You may want to take a look at LibWeb::HTML::Error to see what error messages are built into LibWeb. To override the standard error messages, you re-define them in the sub-class you made.

The current version of LibWeb::HTML::Default is available at

   http://libweb.sourceforge.net

Several LibWeb applications (LEAPs) have be written, released and are available at

   http://leaps.sourceforge.net

TYPOGRAPHICAL CONVENTIONS AND TERMINOLOGY ^

All `error/help messages' mentioned can be found at LibWeb::HTML::Error and they can be customized by ISA (making a sub-class of) LibWeb::HTML::Default. Error/help messages are used when you call LibWeb::Core::fatal, see LibWeb::Core for details. Method's parameters in square brackets means optional.

DESCRIPTION ^

new()

Params:

class, rc_file

Usage:

  my $html = new LibWeb::HTML::Default( $rc_file );

Pre:

display()

This implements the base class method: LibWeb::HTML::Standard::display().

Params:

  -content=>, [ -sheader=>, -lpanel=>, -rpanel=>,
                -header=>, -footer=> ]

Pre:

Post:

Each of the following methods return an ARRAY reference to partial HTML. These are the defaults used by the display() method.

header()

sheader()

lpanel()

content()

rpanel()

footer()

AUTHORS ^

Colin Kong (colin.kong@toronto.edu)

CREDITS ^

BUGS ^

SEE ALSO ^

LibWeb::Core, LibWeb::HTML::Error, LibWeb::HTML::Standard, LibWeb::Themes::Default.

syntax highlighting: