Re: [RDBO] Read-only objects

2007-04-16 Thread Ovid
--- Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > I think you *should* be able to just: > a- create a view that selects from the db and returns the same cols Except that this has the same problem as a database handle with only SELECT permissions: the actual failure could occur far away fro

Re: [RDBO] Read-only objects

2007-04-16 Thread Jonathan Vanasco
On Apr 6, 2007, at 12:04 PM, Ovid wrote: > On a side note, the code you posted for making things 'read only' > seemed a bit complicated for me. I simply do something similar to > this: > > package My::DataCentre; > > use base 'My::Rose::DB::Object'; > > sub meta_class { 'My::Rose::DB::Meta

Re: [RDBO] Read-only objects

2007-04-06 Thread Jonathan Vanasco
On Apr 6, 2007, at 12:04 PM, Ovid wrote: > On a side note, the code you posted for making things 'read only' > seemed a bit complicated for me. I simply do something similar to > this: > > package My::DataCentre; > > use base 'My::Rose::DB::Object'; > > sub meta_class { 'My::Rose::DB::Meta

Re: [RDBO] Read-only objects

2007-04-06 Thread Ovid
--- Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > Sorry, Let me clarify: > > Ovid - you have the seed of this readonly class... john mentioned > what needs to happen for it to get rolled into rose. any chance > that might happen? I can give you a definite possibility of a firm "maybe

Re: [RDBO] Read-only objects

2007-04-06 Thread Jonathan Vanasco
On Apr 6, 2007, at 10:01 AM, John Siracusa wrote: > On 4/5/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: >> Any chance of these features being pushed back into rose? > > The first thing you're likely to see is support for triggers on save, > insert, update, and delete because overriding some of

Re: [RDBO] Read-only objects

2007-04-06 Thread John Siracusa
On 4/5/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > Any chance of these features being pushed back into rose? The first thing you're likely to see is support for triggers on save, insert, update, and delete because overriding some of those "correctly" (handling transactions and so on) takes s

Re: [RDBO] Read-only objects

2007-04-05 Thread Jonathan Vanasco
On Apr 5, 2007, at 4:06 AM, Ovid wrote: > That's an important backup and one I recommend. However, I don't want > to see a permissions error hundreds of lines and several modules away > from the actual cause: > > $mc->hammer("can't touch this"); > > It's important to have the exceptions thrown

Re: [RDBO] Read-only objects

2007-04-05 Thread Randal L. Schwartz
> "Tim" == Tim Bunce <[EMAIL PROTECTED]> writes: Tim> If it's to hide the sub from caller(), why bother? OCD, probably. :) I like a clean backtrace when I can get it. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Un

Re: [RDBO] Read-only objects

2007-04-05 Thread Ovid
--- Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > 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 permissio

Re: [RDBO] Read-only objects

2007-04-05 Thread Tim Bunce
On Wed, Apr 04, 2007 at 09:20:30AM -0700, Randal L. Schwartz wrote: > > Here's what I did for my readonly class, based on discussions with jcs > six months ago: > > sub insert { > die "cannot insert" unless our $READWRITE; > goto &{$_[0]->can("SUPER::insert")}; > } Hi Randal.

Re: [RDBO] Read-only objects

2007-04-05 Thread Ovid
--- "Randal L. Schwartz" wrote: > sub insert { > die "cannot insert" unless our $READWRITE; > goto &{$_[0]->can("SUPER::insert")}; > } > > sub update { > die "cannot update" unless our $READWRITE; > goto &{$_[0]->can("SUPER::update")}; > } > > sub dele

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 ---

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 ove

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:05 PM, Ovid wrote: > Note the 'return' condition. I found that if I didn't have that in, > the following would throw an exception: > > my $os = Donhost::OS->new( os => 'ubuntu' ); > > The hack guarantees that only things like the following throwing > exceptions: > > $os->os('wi

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 R

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 object