[CDBI] Turning Class::DBI on its side

Bill Moseley moseley at hank.org
Wed Jul 25 15:34:15 BST 2007


On Wed, Jul 25, 2007 at 02:32:42PM +0100, Duncan Ferguson wrote:

> Table: prefs
> +----+------------------+----------------------------+
> | id | name             | value                      |
> +----+------------------+----------------------------+
> |  0 | filename         | /path/to/file.txt          |
> |  1 | item_enabled     | 1                          |
> |  2 | task_name        | something                  |
> +----+------------------+----------------------------+


> 
> so instead of doing
> 
> my $row=DB::Prefs->search({ name => " filename}})->first;
> print $row->value,$/;
> $row->value("/new/path/to/file");
> 
> I can do
> 
> print DB::Prefs->filename,$/;
> 
> or
> 
> DB::Prefs->filename("/new/path/to/file");

sub AUTOLOAD {}


-- 
Bill Moseley
moseley at hank.org




More information about the ClassDBI mailing list