Help for this page

Select Code to Download


  1. or download this
    package Person;
    use base 'MyCDBI';
    ...
    #   PRIMARY KEY (id),
    #   UNIQUE (name)
    # );
    
  2. or download this
    package Person::Relationship;
    use base 'MyCDBI';
    ...
    #   child int NOT NULL REFERENCES people,
    #   PRIMARY KEY (parent,child)
    # );
    
  3. or download this
    Person->has_many(children => [ Person::Relationship => child ]);
    Person->has_many(parents => [ Person::Relationship => parent ]);
    
  4. or download this
    Person->has_many({ self_id => parent }, children => [ Person::Relation
    +ship => child ]);
    Person->has_many({ self_id => child }, parents => [ Person::Relationsh
    +ip => parent ]);