Apache-Wyrd
view release on metacpan or search on metacpan
my $id = "($processing -- $caller[0]:$caller[2])";
$value = join(':', $id, $value , "\n". $self->{'_as_html'} . "\n");
if ($_dbl) {
my $htmlvalue = join(':', $id, $value , "<BR>\n". Apache::Util::escape_html($self->{'_as_html'}) . "<BR>\n");
$_dbl->log_event($htmlvalue);
}
die $value;
};
sub _verbose {
goto $_error_handler{$_loglevel{'verbose'}};
}
sub _debug {
goto $_error_handler{$_loglevel{'debug'}};
}
sub _info {
goto $_error_handler{$_loglevel{'info'}};
}
sub _warn {
goto $_error_handler{$_loglevel{'warn'}};
}
sub _error {
goto $_error_handler{$_loglevel{'error'}};
}
sub _fatal {
goto $_error_handler{$_loglevel{'fatal'}};
}
sub _raise_exception {
goto $_fatal_error_handler;
}
=pod
=head1 NAME
Apache::Wyrd - HTML embeddable perl objects under mod_perl
=head1 SYNOPSIS
NONE
=head1 DESCRIPTION
Apache::Wyrd is the core module in a collection of interoperating
modules that allow the rapid object-oriented development of web sites in
Apache's mod_perl environment (LAMP). This collection includes a very
flexible, HTML-friendly method of defining dynamic items on a web page,
and interfacing directly to perl objects with them. It comes with many
pre-built objects to support a web site such as an authentication
module, an reverse-lookup database, granular debugging, and smart
forms/inputs and their interfaces to a DBI-compliant SQL application.
The collection is not meant to be a drop-in replacement for PHP,
ColdFusion, or other server-side parsed content creation systems, but to
provide a more flexible framework for organic custom perl development
for an experienced perl programmer who favors an object-oriented
approach. It has been designed to simplify the transition from static
to dynamic web content by allowing the design of objects that can be
operated by a non-perl programmer through the modification of the HTML
page on which the content is to be delivered.
The Apache::Wyrd module itself is an abstract class used to create
HTML-embeddable perl objects (I<Wyrds>). The embedded objects are
interpreted from HTML files by an instance of the abstract class
C<Apache::Wyrd::Handler>. Most Wyrds also require an instance of an
C<Apache::Wyrd::DBL> object to store connection information and to
provide intermediary access to the Apache request and any DBI-style
database interfaces.
Each Wyrd has a corresponding perl module which performs work and
generates any output at the Wyrd's location on the HTML page. Each
of these objects is a derived class of Apache::Wyrd, and consequently
draws on the existing methods of the abstract class as well as
implements methods of its own. A few "hook" methods (C<_setup>,
C<_format_output>, and C<_generate_output> in particular) are defined in
the abstract class for this purpose.
The modules in this distribution are not meant to be used directly.
Instead, instances of the objects are created in another namespace (in
all POD synopses called BASENAME, but it can be any string acceptable as
a single namespace of a perl class) where the Handler object has been
configured to use that namespace in interpreting HTML pages (see
C<Apache::Wyrd::Handler>).
=head2 SETUP
At the minimum, BASENAME::Wyrd needs to be defined, C<BASENAME::Handler>
needs to be defined and properly configured and able to properly invoke
an instance of C<BASENAME::DBL>. [N.B: A sample minimal installation,
C<TESTCLIENT> can be found in the t/lib directory of this package].
When a BASENAME::FOO Wyrd is invoked, and no BASENAME::FOO perl object can
be found, the object Apache::Wyrd::FOO will be tried. This allows the use
of any Apache::Wyrd::FOO objects derived from this module to be used in a
web page as BASENAME::FOO objects without explicitly subclassing them. If
neither a BASENAME::FOO nor an Apache::Wyrd::FOO object exists, a generic
(do-nothing) Apache::Wyrd object will be used rather than an error occur.
As one would expect, one namespace can also instantiate another namespace's
objects as long as the other namespace can be found in the local perl
installation's @INC array.
=head2 SYNTAX IN HTML
Wyrds are embedded in HTML documents as if they were specialized tags.
These tags are assigned attributes in a manner very similar to HTML
tags, in that they are formed like HTML tags with named attributes and
(optionally) with enclosed text, i.e.:
<NAME ATTRIBUTENAME="ATTRIBUTE VALUE">ENCLOSED TEXT</NAME>
They follow the XHTML syntax somewhat in that they require a terminating
whitespace followed by a forward-slash (/) before the enclosing brace
when they are embedded as "stand-alone" tags, and require quotes around
all attributes. Therefore:
( run in 0.516 second using v1.01-cache-2.11-cpan-df04353d9ac )