The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache::Wyrd::DBL - Centralized location for tracking variables, internals

SYNOPSIS

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

DESCRIPTION

Apache::Wyrd::DBL ("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

loglevel

Logging level, per Apache::Wyrd object

globals

pointer to globals hashref

req (required)

the request itself (Apache request object)

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) loglevel (void)

Optional read-only method for "loglevel" 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) base_class (void)

return the base class of this set of Wyrds.

(hashref) taint_exceptions (void)

Which params are allowed to contain information that could be interpreted as a Wyrd.

(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.

(scalar) dev (void)

the device number of filesystem of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) ino (void)

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

(scalar) mode (void)

the file mode (type and permissions) of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

the number of (hard) links to the file of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) uid (void)

the numeric user ID of file's owner of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) gid (void)

the numeric group ID of file's owner of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) rdev (void)

the the device identifier (special files only) of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) atime (void)

the last access time in seconds since the epoch of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) ctime (void)

the inode change time in seconds since the epoch of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function. See the perl documentation for details.

(scalar) blksize (void)

the preferred block size for file system I/O of the file currently being served. Derived from Apache::Wyrd::Handler, by default compatible with the stat() builtin function.

(scalar) blocks (void)

the actual number of blocks allocated 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. Collects database information from the initialization data and calls _init_db with it.

(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(). As a security measure, any data found in parameters which matches the name of the Wyrds on a given installation, e.g. BASENAME is dropped unless the variable is named in the array of variable names stored by reference under the taint_exceptions key of the BASENAME::Handler's init() function.

(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.

(scalar) self_url (void)

return an interpolated version of the current url.

(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. As of version 0.97 calls connect_cached instead of attempting to maintain a cached connection itself.

(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-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 804:

You forgot a '=back' before '=head1'