Hi Folks

I'm effectively trying to replicate the code in the synopsis of
Rose::DB::Object::Manager, using my own data.

The error msg is:
Can't locate object method "meta" via package "State" at
d:/Perl/site/lib/Rose/DB/Object/Manager.pm line 786.

which is being generated by the call to get_club_iterator() below, but I can't
see what's wrong with it.

Note: A call to build_club_list() in the demo program works perfectly.

(Aussi stands for Australian Union of Senior Swimmers International).

Club.pm:
-----><8-----
package Aussi::Rose::Club;

use strict;

use base qw(Aussi::Rose::Base::Object);

use Aussi::Rose::State;

# -----------------------------------------------

sub build_club_list
{
        my($self) = @_;

        return
        {
                map{($_ -> id(), $_ -> code() )} @{Aussi::Rose::Club::Manager ->
get_club(select => 'id, code')}
        };

}       # End of build_club_list.

# -----------------------------------------------

sub build_club_state_list
{
        my($self)               = @_;
        my($iterator)   = Aussi::Rose::Club::Manager -> get_club_iterator
        (
                select                  => 't1.id, t1.code, t1.name, t2.id, 
t2.code',
                with_objects    => ['state'],
        );

        my($club);
        my(@data);

        while ($club = $iterator -> next() )
        {
                push @data, [$club -> state() -> code(), $club -> id(), $club 
-> code(), $club
-> name()];
        }

        return [EMAIL PROTECTED];

}       # End of build_club_state_list.

# -----------------------------------------------

__PACKAGE__->meta->setup
(
    table   => 'club',

    columns =>
    [
        id       => { type => 'integer', not_null => 1 },
        state_id => { type => 'integer', default => '', not_null => 1 },
        code     => { type => 'character', default => '', length => 2, not_null
=> 1 },
        name     => { type => 'varchar', default => '', length => 255, not_null
=> 1 },
    ],

    primary_key_columns => [ 'id' ],

        foreign_keys =>
        [
                state =>
                {
                        class           => 'State',
                        key_columns     => {state_id => 'id'},
                },
        ],
  );

__PACKAGE__ -> meta -> make_manager_class('club');

# -----------------------------------------------

1;
-----><8------

TIA.
--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html




_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to