Re: Getting a New CDBI object without creating one in db?

[prev] [thread] [next] [Date index for 2004/10/15]

From: Benjamin Noggle
Subject: Re: Getting a New CDBI object without creating one in db?
Date: 00:12 on 15 Oct 2004
It depends on what you need it to do.

When I needed a dummy object, I only needed the accessors so I did something like this:

#!/usr/bin/perl;

package Foo::FakeAssignment;

use base qw(Class::Accessor);

Foo::FakeAssignment->mk_ro_accessors(qw(id description));

1;

-=-=-=-=-=-=-

my $fakeobj = LW::BookKeep::Network::FakeAssignment->new({
	id => '9965',
	description => 'Placeholder';
});

push @CDBIObjects, $fakeobj;

etc.  But then again nothing was checking to make sure it is a CDBI object, just that it could call it accessors.  I'm sure there are other CDBI ways to do it though.

-Ben


On Thu, Oct 14, 2004 at 03:46:54PM -0700, Peter Speltz wrote:
> How do people make a CDBI object without creating one in the database?
> 
> For example i want a Customer object available in my new_customer template so i
> can use methods like Customer::default_type. I tried something like this in my
> code:
> 
> $tmpl_vars->{dumb_cstmr} = bless {}, CDBI::Customer;
> 
> Then in a template:
> 
> <input name='cstmr_type' value="[% dumb_cstmr.default_type %]" />
> 
> But that is not working. So how are other people doing this?
> 
> thanks.
> 
> 
> =====
> pjs
>

(message missing)

domain cross talk...?
Michael Jensen 06:47 on 06 Oct 2004

Re: domain cross talk...?
William McKee 14:41 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 14:47 on 06 Oct 2004

Re: domain cross talk...?
William McKee 14:51 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 15:06 on 06 Oct 2004

Re: domain cross talk...?
William McKee 15:32 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 15:36 on 06 Oct 2004

Re: domain cross talk...?
Michael Jensen 16:03 on 06 Oct 2004

Re: domain cross talk...?
Michael Jensen 16:16 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 16:27 on 06 Oct 2004

Re: domain cross talk...?
Carl Johnstone 23:17 on 06 Oct 2004

Re: domain cross talk...?
William McKee 15:53 on 06 Oct 2004

Re: domain cross talk...?
merlyn (Randal L. Schwartz) 16:17 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 16:31 on 06 Oct 2004

[CDBI] Class::DBI::Loader question
Peter Speltz 00:31 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 02:57 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 04:12 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 18:43 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Clayton L. Scott 17:08 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Peter Speltz 17:32 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 18:58 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 14:26 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 15:17 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Tony Bowden 15:39 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 14:26 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Tim Bunce 16:22 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
merlyn (Randal L. Schwartz) 17:24 on 14 Oct 2004

Re: Getting a New CDBI object without creating one in db?
Benjamin Noggle 00:12 on 15 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52