Oh, and of course you can always use Rose::Object::MakeMethods::* to
make new attributes.  So long as none of the created methods conflict
with existing methods in a class, you'll be fine--and you won't have
to know anything about the internals :)  Example (mostly from the POD
synopsis for this module):

    package My::DB::Whatever;
    ...
    __PACKAGE__->meta->setup(...);

    # This will die if there are any method name conflicts
    Rose::Object::MakeMethods::Generic->make_methods
    (
      scalar =>
      [
        'myattr1',
        'myattr2',
        ...
      ],

      boolean =>
      [
        'is_red',
        'is_happy' => { default => 1 },
      ],

      array =>
      [
        jobs       => {},
        job        => { interface => 'get_set_item', hash_key => 'jobs' },
        clear_jobs => { interface => 'clear', hash_key => 'jobs' },
        reset_jobs => { interface => 'reset', hash_key => 'jobs' },
      ],

      hash =>
      [
        param        => { hash_key => 'params' },
        params       => { interface => 'get_set_all' },
        param_names  => { interface => 'keys', hash_key => 'params' },
        param_values => { interface => 'values', hash_key => 'params' },
        param_exists => { interface => 'exists', hash_key => 'params' },
        delete_param => { interface => 'delete', hash_key => 'params' },

        clear_params => { interface => 'clear', hash_key => 'params' },
        reset_params => { interface => 'reset', hash_key => 'params' },
      ],
    );

This, incidentally, is pretty much what I do in my code (although I
usually "use" the method-maker module so the methods get created at
compile-time instead of runtime--but with the added caveat that name
conflicts will then appear when setup() is called, which can make
debugging harder).

Also, since you can always specify the hash key in these method-maker
calls, you can still use the unique prefixing discussed in my last
post.

Anyway, you can read more about this family of method-makers here:

    http://search.cpan.org/dist/Rose-Object/

Many others exist on CPAN.  As long as the method names and hash keys
don't conflict with any columns, fks, or relationships, you'll be fine
no matter which you choose.

-John

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to