| 1 | #============================================================================== | ||||||||||||||||||||
| 2 | # LibWeb::HTML::Standard -- An interface defining HTML display for libweb | ||||||||||||||||||||
| 3 | # applications. | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package LibWeb::HTML::Standard; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # Copyright (C) 2000 Colin Kong | ||||||||||||||||||||
| 8 | # | ||||||||||||||||||||
| 9 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||
| 10 | # modify it under the terms of the GNU General Public License | ||||||||||||||||||||
| 11 | # as published by the Free Software Foundation; either version 2 | ||||||||||||||||||||
| 12 | # of the License, or (at your option) any later version. | ||||||||||||||||||||
| 13 | # | ||||||||||||||||||||
| 14 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||
| 17 | # GNU General Public License for more details. | ||||||||||||||||||||
| 18 | # | ||||||||||||||||||||
| 19 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||
| 20 | # along with this program; if not, write to the Free Software | ||||||||||||||||||||
| 21 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||||||||||||||||||||
| 22 | #============================================================================= | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # $Id: Standard.pm,v 1.2 2000/07/19 20:31:57 ckyc Exp $ | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | $VERSION = '0.02'; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | #-############################## | ||||||||||||||||||||
| 29 | # Use standard libraries. | ||||||||||||||||||||
| 30 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | 1 | ▶ | use vars qw($VERSION @ISA); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | #-############################## | ||||||||||||||||||||
| 34 | # Use custom libraries. | ||||||||||||||||||||
| 35 | 1 | require LibWeb::Core; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | #-############################## | ||||||||||||||||||||
| 38 | # Inheritance. | ||||||||||||||||||||
| 39 | 1 | @ISA = qw(LibWeb::Core); | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | #-############################## | ||||||||||||||||||||
| 42 | # Methods. | ||||||||||||||||||||
| 43 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 44 | # | ||||||||||||||||||||
| 45 | # Params: $class , $rc_file, $error_object | ||||||||||||||||||||
| 46 | # | ||||||||||||||||||||
| 47 | # - $class is the class/package name of this package, be it a string | ||||||||||||||||||||
| 48 | # or a reference. | ||||||||||||||||||||
| 49 | # - $rc_file is the absolute path to the rc file for LibWeb. | ||||||||||||||||||||
| 50 | # - $error_object is a reference to a perl object for printing out | ||||||||||||||||||||
| 51 | # error/help message to users when error occurs. | ||||||||||||||||||||
| 52 | # | ||||||||||||||||||||
| 53 | # Usage: No, you don't use or ISA this class directly. Use or ISA | ||||||||||||||||||||
| 54 | # LibWeb::HTML::Default instead. | ||||||||||||||||||||
| 55 | # | ||||||||||||||||||||
| 56 | 1 | my ($class, $Class, $self); | |||||||||||||||||||
| 57 | 1 | $class = shift; | |||||||||||||||||||
| 58 | 1 | ▶ | $Class = ref($class) || $class; | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | # Inherit instance variables from the base class. | ||||||||||||||||||||
| 61 | 1 | $self = $Class->SUPER::new( shift, shift ); | |||||||||||||||||||
| 62 | 1 | bless($self, $Class); | |||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 0 | ▶ | sub display { | ||||||||||||||||||
|
Subroutine
display: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 68 | # | ||||||||||||||||||||
| 69 | # This is an interface describing how to implement this method. | ||||||||||||||||||||
| 70 | # Implementation is done at LibWeb::HTML::Default. | ||||||||||||||||||||
| 71 | # | ||||||||||||||||||||
| 72 | # Override base class method: LibWeb::Core::display(). | ||||||||||||||||||||
| 73 | # Params: -content=>, [ -sheader=>, -lpanel=>, -rpanel=>, -header=>, -footer=> ]. | ||||||||||||||||||||
| 74 | # | ||||||||||||||||||||
| 75 | # -content, -sheader, -lpanel, -rpanel, -header and -footer must be an ARRAY | ||||||||||||||||||||
| 76 | # ref. to elements which are scalar/SCALAR ref/ARRAY ref. | ||||||||||||||||||||
| 77 | # If the the elements are ARRAY ref., then the elements in that ARRAY ref. must | ||||||||||||||||||||
| 78 | # be scalar and NOT ref. | ||||||||||||||||||||
| 79 | # | ||||||||||||||||||||
| 80 | # -content default is lines read from $self->content(). | ||||||||||||||||||||
| 81 | # -sheader default is lines read from $self->sheader(). | ||||||||||||||||||||
| 82 | # -lpanel default is lines read from $self->lpanel(). | ||||||||||||||||||||
| 83 | # -rpanel default is lines read from $self->rpanel(). | ||||||||||||||||||||
| 84 | # -header default is lines read from $self->header(). | ||||||||||||||||||||
| 85 | # -footer default is lines read from $self->footer(). | ||||||||||||||||||||
| 86 | # | ||||||||||||||||||||
| 87 | # Return a scalar ref. to a formatted page in HTML format for display | ||||||||||||||||||||
| 88 | # to Web client. | ||||||||||||||||||||
| 89 | # | ||||||||||||||||||||
| 90 | 0 | return \("You should use or ISA LibWeb::HTML::Default instead.\n"); | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | #================================================================================ | ||||||||||||||||||||
| 94 | # Site's HTML constructs: header, sub header, left panel, right panel and footer. | ||||||||||||||||||||
| 95 | # They are interfaces and therefore not implemented. LibWeb::HTML::Default | ||||||||||||||||||||
| 96 | # implements these HTML constructs. | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 0 | ▶ | sub header { | ||||||||||||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 99 | 0 | return [' ']; | |||||||||||||||||||
| 100 | } | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 0 | ▶ | sub sheader { | ||||||||||||||||||
|
Subroutine
sheader: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 103 | 0 | return [' ']; | |||||||||||||||||||
| 104 | } | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | 0 | ▶ | sub content { | ||||||||||||||||||
|
Subroutine
content: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 107 | 0 | return [' ']; | |||||||||||||||||||
| 108 | } | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 0 | ▶ | sub lpanel { | ||||||||||||||||||
|
Subroutine
lpanel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 111 | 0 | return [' ']; | |||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 0 | ▶ | sub rpanel { | ||||||||||||||||||
|
Subroutine
rpanel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 115 | 0 | return [' ']; | |||||||||||||||||||
| 116 | } | ||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 0 | ▶ | sub footer { | ||||||||||||||||||
|
Subroutine
footer: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 119 | 0 | return [' ']; | |||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | 1 | 1; | |||||||||||||||||||
| 123 | __DATA__ | ||||||||||||||||||||