From: Chris W. <ch...@cw...> - 2003-11-19 20:16:08
|
Andreas Nolte wrote: >... > is not a good idea. Today we build separete classes that ( most of the > times ) inherit from SPOPS and put the functionality in them. This on > one side lets you use the functionality in scripts without a GUI, but > also gives you the full power directly within the templates ! A slight sidenote here: I think this pattern is one I'm going to encourage much more explicitly in OI2. That is, something like: # in spops.ini ---------------------------------------- [myobject] # This is the generated class class = My::ObjectPersist # This is what OI2 will return on a call of: # my $object_class = CTX->lookup_object( 'myobject' ); alias_class = My::Object ... ---------------------------------------- And then you'd create: ---------------------------------------- package My::Object; use strict; @My::Object::ISA = qw( My::ObjectPersist ); sub my_custom_functionality { my ( $self ) = @_; $self->{my_field} = 'foo'; $self->save; } ... ---------------------------------------- This is in-place of using the 'code_class' element in the SPOPS configuration, which I've always considered very hackish. This also fits in with the philosophy that you can just add in persistence behavior to an existing object, implementing your normal object behavior (plus any additional persistence behavior like canned queries) in code and your persistence in configuration. Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |