| Next: Singleton::Memcache | Previous: Singleton::CGI | [Table of Contents] |
Singleton::DBI - A singleton wrapper around the DBI object.
#!/usr/bin/perl -w
use Singleton::DBI;
use strict;
my $db = Singleton::DBI->instance();
$db->do( "UPDATE users SET cool=1 WHERE username='steve'" );
This object is a Singleton wrapper around the DBI database module. This allows all areas of the code to perform queries against the database without having to explicitly connect and disconnect themselves.
Gain access to the single instance of our database connection.
Create a new instance of this object. This is only ever called once since this object is used as a Singleton.
Steve Kemp
http://www.steve.org.uk/
Copyright (c) 2005-2007 by Steve Kemp. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license.