|
Revision 64, 0.6 kB
(checked in by sky, 4 years ago)
|
r67@crucially-3 (orig r995): btrott | 2005-10-11 13:37:08 -0700
Removed username
|
-
Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | package Recipe; |
|---|
| 4 | use strict; |
|---|
| 5 | use base qw( Data::ObjectDriver::BaseObject ); |
|---|
| 6 | |
|---|
| 7 | use Data::ObjectDriver::Driver::DBI; |
|---|
| 8 | |
|---|
| 9 | __PACKAGE__->install_properties({ |
|---|
| 10 | columns => [ 'id', 'cluster_id', 'title' ], |
|---|
| 11 | datasource => 'recipes', |
|---|
| 12 | primary_key => 'id', |
|---|
| 13 | driver => Data::ObjectDriver::Driver::DBI->new( |
|---|
| 14 | dsn => 'dbi:SQLite:dbname=global.db', |
|---|
| 15 | ), |
|---|
| 16 | }); |
|---|
| 17 | |
|---|
| 18 | sub insert { |
|---|
| 19 | my $obj = shift; |
|---|
| 20 | ## Choose a cluster for this recipe. This isn't a very solid way of |
|---|
| 21 | ## doing this, but it works for testing. |
|---|
| 22 | $obj->cluster_id(int(rand 2) + 1); |
|---|
| 23 | $obj->SUPER::insert(@_); |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | 1; |
|---|