Apache::Wyrd::DBL - Object for Wyrds to access "Das Blinkenlights"



NAME

Apache::Wyrd::DBL - Object for Wyrds to access ``Das Blinkenlights'' (Apache internals, etc.)


SYNOPSIS

        my $hostname = $wyrd->dbl->req->hostname;
        my $database_handle = $wyrd->dbl->dbh;
        my $value = $wyrd->dbl->param('value');


DESCRIPTION

``Das Blinkenlights'' is a convenient placeholder for all session information a wyrd might need in order to do work. It holds references to the session's current apreq, DBI, and Apache objects, as well as the current session log and other vital information. It is meant to be called from within an Apache::Wyrd object through it's dbl method, as in the SYNOPSIS.

Debugging is always turned on if port 81 is used. Note that apache must be set up to listen at this port as well. See the Listen and BindAddress Apache directives.


METHODS

(DBL) new (hashref, hashref)
initialize and return the DBL with a set of startup params and a set of global variables (for the WO to access) in the form of two hashrefs. The first hashref should include at least the 'req' key, which is an Apache request object.

The startup params can have several keys set. These may be:

apr
the param/cookie subsystem (CGI or Apache::Request object initialized by a Apache::Wyrd::Request object);

dba
database application. Should be the name of a DBI::DBD driver.

database
database name (to connect to)

db_password
database password

db_username
database user name

debug
debugging level

globals
pointer to globals hashref

req (required)
the request itself (Apache request object)

self_url
full URL of current request (depreciated)

strict
should strict procedures be followed (not used by default)

user
the current user (not used by default)

verify_dbl_compatibility
Used by Apache::Wyrd to confirm it's been passed the right sort of object for a DBL.

(scalar) strict (void)
Optional read-only method for ``strict'' conditions. Not used by the default install.

(scalar) debug (void)
Optional read-only method for ``debug'' conditions. Not used by the default install.

(void) log_bug (scalar)
insert a debugging message in the session log.

(void) set_logfile (filehandle typeglob)
give DBL a file in which to store it's events. The filehandle is then kept in the logfile attribute.

(void) close_logfile (void)
flush logfile to disk. Necessary in mod_perl situation, it seems.

(void) log_event (scalar)
same as log_bug, but don't send the output to STDERR. Instead, make it HTML escaped and store it for later dumping.

(hashref) globals (void)
return a reference to the globals hashref Has a useful debugging message on unfound globals.

(scalar) mtime (void)
the modification time of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) size (void)
the file size of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(variable) get_global (scalar)
retrieve a global by name.

(void) set_global(scalar, scalar)
find the global by name and set it. Has a helpful debugging message on undefined globals.

(scalar) get_response (void)
Return the response. Should be an Apache::Constants response code.

(scalar) set_response (void)
Set the response. Should be an Apache::Constants response code.

(DBI::DBD::handle) dbh (void)
Database handle object. Will initialize a database connection on the first call, so as to avoid opening a database connection if the Wyrds in the file being serviced don't require one.

(Apache) req (void)
Apache request object

(scalar) user (void)
Optional read-only method for an Apache::Wyrd::User object. Not used by the default install.

(CGI/Apache::Request) apr (void)
Apache::Wyrd::Request object (handle to either a CGI or Apache::Request object)

(scalar/arrayref) param ([scalar])
Like CGI->param().

(scalar) param_exists (scalar)
Returns a non-null value if the CGI variable indicated by the scalar argument was actually returned by the client.

(scalar) file_path (void)
return the path to the actual file being parsed.

(scalar) self_path (void)
return the document-root relative path to the file being served.

(internal) _init_db (scalar, scalar, scalar, scalar);
open the DB connection. Accepts a database type, a database name, a username, and a password. Defaults to a mysql database. Sets the dbh parameter and the dbh_ok parameter if the database connection was successful. Meant to be called from dbh.

(internal) close_db (void);
close the dbh connection if it was opened.

(scalarref) dump_log (void)
return a scalarref to a html-formatted dump of the log.


BUGS

UNKNOWN


AUTHOR

Barry King <wyrd@nospam.wyrdwright.com>


SEE ALSO

Apache::Wyrd
General-purpose HTML-embeddable perl object


LICENSE

Copyright 2002-2004 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

 Apache::Wyrd::DBL - Object for Wyrds to access "Das Blinkenlights"