> > classes are automatically generated and adding the
> functions to the Extra.pm
> > doesn't work.
>
> Why not?

Well I don't really understand properly how this Extra.pm file works so am
probably doing something wrong then, but I just added the functions in the
file viz:
package GARD::Book::Extra;

sub F_numpublishyear {
....
}

sub numeric_hist_year {
.....
}

sub F_sourceyear {
....
}

GARD::Book->meta->initialize(preserve_existing => 1);

[ I realise that the bottom line probably doesn't do anything but it's just
there for consistency in case in the future, I add a
GARD::Book->meta->add_relationships(...) line.]

Then, I ran my usual module generating script that does the following...
my $loader = Rose::DB::Object::Loader->new(
        db           => GARD::DB->new(),
        class_prefix => 'GARD::',
        module_dir => $modulesgendir,
        );
$loader->post_init_hook(
        sub {
        my $meta = shift;
        # For class My::Product, try to load My::Product::Extra
        my $extra_pm = $meta->class .'::Extra';
        eval "require $extra_pm";
        });
my @classes = $loader->make_modules;

and then copies the modules to the right place.

looking in the Book.pm module afterwards, it has the auto-generated
use base qw(GARD::DB::Object::AutoBase1);
__PACKAGE__->meta->setup(...)

stuff in it, as normal but no functions.


-------------------------------------------------------------------------
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