LibWeb::Database - A generic database driver for libweb applications
DBI
LibWeb::Core
use LibWeb::Database; my $db = new LibWeb::Database(); my ($sql, $user, $host, $fetch, $result); $sql = "select USER_NAME, USER_HOST ". "from USER_TABLE ". "where USER_LOGIN_STATUS = ". "LOGIN_INDICATOR"; $fetch = $db->query( -sql => $sql, -bind_cols => [\$user, \$host] ); while ( &$fetch ) { $result .= "$user $host <BR>\n"; } $db->done(); print "Content-Type: text/html\n\n"; print "<P> The following users have logged in: $result";
As long as you have the proper DBD installed for your database, you can use this class to interact with your database in your LibWeb applications.
The current version of LibWeb::Database is available at
http://libweb.sourceforge.net
Several LibWeb applications (LEAPs) have be written, released and are available at
http://leaps.sourceforge.net
Variables in all-caps (e.g. USER_TABLE) are those variables set through LibWeb's rc file. Please read LibWeb::Core for more information. Method's parameters in square brackets means optional.
do()
Params:
-sql =>
Pre:
-sql is a valid sql statement.
-sql
Post:
Return the number of rows affected by the SQL statement, -sql.
query()
-sql=>, -bind_cols=> [, -want_hash=> ]
-sql is the sql statement to perform the query,
-bind_cols is an ARRAY reference to SCALAR references to fields to be bound in the table specified in -sql,
-bind_cols
-want_hash indicates whether the returning function (a reference) is a reference to DBI's fetchrow_hashref() or fetchrow_arrayref().
-want_hash
Returns a reference to a fetching function based on -sql. A reference to DBI's fetchrow_arrayref() is returned if -want_hash is not defined; otherwise a reference to DBI's fetchrow_hashref() is returned.
finish()
Finish a statement execution.
disconnect()
Disconnect the current database session.
done()
Finish a statement execution and disconnect the current database session.
DBI, LibWeb::Core.
To install LibWeb::CGI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LibWeb::CGI
CPAN shell
perl -MCPAN -e shell install LibWeb::CGI
For more information on module installation, please visit the detailed CPAN module installation guide.