DbFramework::Util - DbFramework utility functions
use DbFramework::Util; ($user,$password) = DbFramework::Util::get_auth(); $dbh = DbFramework::Util::get_dbh($dsn,$user,$password); $sth = DbFramework::Util::do_sql($dbh,$sql); ($user,$password) = DbFramework::Util::get_auth(); $object->debug($n);
DbFramework::Util contains miscellaneous utility functions and acts as a base class for many other DbFramework classes.
AUTOLOAD() provides default accessor methods (apart from DESTROY()) for any of its subclasses. For AUTOLOAD() to catch calls to these methods objects must be implemented as an anonymous hash. Object attributes must
The name accessor method is the name of the attribute in lower case. The 'set' versions of these accessor methods require a single scalar argument (which could of course be a reference.) Both 'set' and 'get' versions return the attribute's value.
Special Attributes
Attribute names matching the pattern /_L$/ will be treated as arrayrefs. These accessors require an arrayref as an argument. If the attribute is defined they return the arrayref, otherwise they return an empty arrayref.
A method *_l_add(@foo) can be called on this type of attribute to add the elements in @foo to the array. If the attribute is defined they return the arrayref, otherwise they return an empty arrayref.
Attribute names matching the pattern /_H$/ will be treated as hashrefs. These accessors require a reference to an array containing key/value pairs. If the attribute is defined they return the hashref, otherwise they return an empty hashref.
A method *_h_byname(@list) can be called on this type of attribute. These methods will return a list which is the hash slice of the _H attribute value over @list or an empty list if the attribute is undefined.
A method *_h_add(\%foo) can be called on this type of attribute to add the elements in %foo to the hash. If the attribute is defined they return the hashref, otherwise they return an empty hashref.
As a class method sets the class attribute $Debugging to $n. As an object method sets the object attribute $_DEBUG to $n.
Read ($user,$password) from standard input with no echo when entering password.
Returns a database handle for the data source name $dsn by connecting using $user and $password.
Executes $sql on $dbh and returns a statement handle. This method will die with $h->errstr if prepare() or execute() fails.
Paul Sharpe <paul@miraclefish.com>
Copyright (c) 1997,1998 Paul Sharpe. England. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DbFramework::Key, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DbFramework::Key
CPAN shell
perl -MCPAN -e shell install DbFramework::Key
For more information on module installation, please visit the detailed CPAN module installation guide.