[RDBO] Read-only objects

2007-04-04 Thread Ovid
My 'read-only' objects now have their very own metadata class. Trying to update from the 'save', 'insert', 'update', etc. now fails. I also have the accessors throwing Exception::Class objects if someone tries to set an attribute value. However, it's a nasty hack because the other code examples

Re: [RDBO] Read-only objects

2007-04-04 Thread Ovid
--- Ovid [EMAIL PROTECTED] wrote: My 'read-only' objects now have their very own metadata class. As a side note, it might be nice if a 'readonly' metadata class were natively available in Rose::DB::Object, with an optional way of allowing it to be read/write. I know I can create said objects

Re: [RDBO] Read-only objects

2007-04-04 Thread Randal L. Schwartz
Ovid == Ovid [EMAIL PROTECTED] writes: Ovid The hack relies on the order of call stack frames being different when Ovid I'm constructing an object or just setting an accessor directly. How Ovid can I do this without relying on the internals like this? It seems like everyone using RDBO

Re: [RDBO] Read-only objects

2007-04-04 Thread Adrian Howard
On 4 Apr 2007, at 17:21, John Siracusa wrote: [snip] The only way to distinguish the two is by calling context. That said, there are (slightly) better ways to detect the context than using caller(). Here's what I suggest: # Override init in you common base class # (See the

Re: [RDBO] Read-only objects

2007-04-04 Thread John Siracusa
On 4/4/07 12:37 PM, Adrian Howard wrote: Since there are at least three folk who have wanted this sort of functionality - would it be worth adding something like is_initialising() to Rose::DB::Object::Util? Just to prevent gratuitous wheel reinvention :-) No, since that'd require extra

Re: [RDBO] Read-only objects

2007-04-04 Thread Jonathan Vanasco
call me lazy-- I just use a bad db handle for all things rose, then have a custom method that pulls a read-only or read/write handle from a db factory as needed. ie, they'll always fail on save, insert, update because they don't have the db permissions