From: Vsevolod (S. I. <si...@cs...> - 2003-11-25 15:27:41
|
Chris, Thanks for looking at the setter method. I assume the fix is straightforward (I'd like to start using it asap). You also have a note about this in the SPOPS man page: *** Note that unlike get, You cannot use the shortcut of using the parameter name as a method. So a call like: my $username = $obj->username( 'new_username' ); Will silently ignore any parameters that are passed and simply return the information as get() would. *** > The SPOPS model is one class == one table, so the general answer is no. > It would probably be best to just have SPOPS create a separate class for > every table you want to access. > > (BTW, why do you want to do this?) Paranoia. I had a home-grown security system (SPOPS without steroids :) which at first utilized a single table. A couple of times bugs in the persistence code screwed the whole table up, so I broke up the security info into separate tables. Then yesterday I was changing something in the spops_security table on the mysql command line and made a mistake again. So the old fears flared up. > Something else you could do: each of your SPOPS classes could override > 'global_security_object_class()' and have each call set the table name > in the one security object class. This is very tricky and potentially > bug ridden, but it might look like: > > # 'My::SecurityObject' is your application's security class > # 'my_table' is the table you want to use for this class > > sub global_security_object_class { > my ( $item ) = @_; > My::SecurityObject->CONFIG->{table_name} = 'my_table'; > return 'My::SecurityObject'; > } AFAIU, you call this potentially bug-ridden because this assumes that, if I put this in a superclass, each subclass will have to process its config before next class's global_security_object_class() is invoked? I'll give it a try. Thanks, Simon -- Simon (Vsevolod ILyushchenko) si...@cs... http://www.simonf.com America's business leaders simply don't want to think about complex technology issues - they want to think about golf. Microsoft promises them that. Andrew Grygus, www.aaxnet.com |