I was messing around with extending Rose::DB::Object::Helpers trying to add a column_values_as_xml function. The problem I ran into involved adding my new function to the 'all' export tag. To add my new function I had to create my own export_tags function that listed all of the current functions and my new function. I'd like to be able to just add my custom function to whatever core 'all' functions already exist (in the event more core functions are added to all in the future).
Here is the Class I created -------------- package Oasis::Model::Asset::Object::Helpers; use XML::Simple; use base qw(Rose::DB::Object::Helpers); __PACKAGE__->export_tags ( all => [ __PACKAGE__->get_default_all_tag, 'column_values_as_xml' ], # This exists for the benefit of the test suite all_noprereq => [ __PACKAGE__->get_default_all_noprereq_tag ], ); sub column_values_as_xml { local $_[0]{__PACKAGE__->SUPER::STATE_SAVING()} = 1; XMLout(scalar Rose::DB::Object::Helpers::column_value_pairs(shift)) } sub get_default_all_tag { return qw (clone clone_and_reset load_or_insert load_or_save insert_or_update insert_or_update_on_duplicate_key load_speculative column_value_pairs column_accessor_value_pairs column_mutator_value_pairs column_values_as_yaml column_values_as_json init_with_yaml init_with_json init_with_column_value_pairs has_loaded_related strip) } sub get_default_all_noprereq_tag { return qw(clone clone_and_reset load_or_insert load_or_save insert_or_update insert_or_update_on_duplicate_key load_speculative column_value_pairs column_accessor_value_pairs column_mutator_value_pairs init_with_column_value_pairs has_loaded_related strip) } 1; ----------------------- So my questions are: 1. Is this the right way to extend Rose::DB::Object::Helpers? 2. If so could the get_default_all_tag and get_default_all_noprereq_tag (or similar functions) be added to the base Rose::DB::Object::Helpers class? Thanks, Kevin McGrath ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object