Hi, Sorry for the delay, here is my feedback on your notes:
2006/1/11, John Siracusa <[EMAIL PROTECTED]>: > On 1/11/06 12:55 PM, Svilen Ivanov wrote: > > The last email John sent outlines the key steps for creating and > > handling new/custom columns. This is my effort to give you an example > > how I dealt with creating custom column. > > Excellent! Are you interested in starting a Rose/DB/Object/Extending.pod > document? :) Maybe not as writer but as editor - a fresh look from a newbie :) > I have a few pointers and questions about your example. In Metadata.pm: > > # override the blob type with custom storable > my %map = __PACKAGE__->column_type_classes; > $map{'blob'} = 'Fallery::Model::Rose::Metadata::Column::Storable'; > __PACKAGE__->column_type_classes(%map); > > Is there a reason you didn't just do this? > > __PACKAGE__->column_type_class(blob => 'Fallery::...::Storable'); No, no reason - I've missed this column_type_class method. I've updated my code and it worked. Thanks for pointing that out. BTW, this thread inspired me how to solve a puzzle that bothers me since making my own column class - how to specify only certain (not all) columns to use serialization -- well, all I have to do is to come up with custom column name (for e.g. 'serializable') and then in RDBO class, specify set: __PACKAGE__->meta->column(exif_info => { type => 'serializable' }); > As for the UTF8 columns, I know I'm slacking on adding that feature to RDBO > proper...sorry :-/ It's On The List(tm). Thanks, I'm looking forward :) However it is not urgent -- as you see I have decent solution even w/o being core RDBO > In Metadata_Column_Storable.pm: > > Rose::Object::MakeMethods::Generic->make_methods > ( > { preserve_existing => 1 }, > scalar => [ __PACKAGE__->common_method_maker_argument_names ] > ); > > You don't need to do this at all in a column subclass unless you're actually > adding to the list of common_method_maker_argument_names. > > ...and even then, you can just add the methods for the names you do add. > What you copied and pasted is just me being lazy in my own code. It tries > to create scalar methods for all common_method_maker_argument_names, and > will skip any that already exist. I do it that way so I'm sure not to > forget to add a method for a one of the common_method_maker_argument_names. > > Anyway, since you're not adding any, it's not needed at all and can be > deleted. Deleted - thanks! It works fine > Next tip... > > foreach my $type (__PACKAGE__->available_method_types) > { > __PACKAGE__->method_maker_class($type => 'Fallery::...::Storable'); > __PACKAGE__->method_maker_type($type => 'storable'); > } > > You may be surprised to learn that available_method_types contains more than > just get_set by default. The types "get" and "set" are also in there. Your > method maker has to handle them as well. An easy way is to just change this > line in your method maker: > > if ( $interface eq 'get_set' ) { > > To this: > > if ( $interface eq 'get_set' || > $interface eq 'get' || > $interface eq 'set' ) { > > since get_set implements all of the functionality of get and set. Ideally, > you'd define custom-tailored get and set interfaces. The "set" method > should croak if no args are passed, and the "get" method should croak if > args are passed. > > I plan to make a Rose::DB::Object::GetSet, if only as a demo, to prove the > flexibility of the method-making system. Besides, some people like > get_foo() and set_foo() and thing a multi-function foo() is a Bad Idea. I > disagree, but I want RDBO to work for them too :) Good point. I've updated my method maker. I don't have personal preference for get_foo/set_foo so I stick to RDBO convention - get_set. Thanks for your comments, they really improve my RDBO classes. On separate subject, I'm planning to make a presentation on both Catalyst and Rose on Linux-Bulgaria monthly conference (http://conf.linux-bg.org). This event is fairly informal and promotes open source technologies in general. The audience is mostly developers, sys administrators. Regards, Svi ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id865&op=click _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object