|  |  
 |   |   
 NAMERose::DB::Object::MakeMethods::Std - Create object methods related to Rose::DB::Object::Std-derived objects. SYNOPSIS  package Category;
  our @ISA = qw(Rose::DB::Object::Std);
  ...
  package Color;
  our @ISA = qw(Rose::DB::Object::Std);
  ...
  package Product;
  our @ISA = qw(Rose::DB::Object);
  ...
  use Rose::DB::Object::MakeMethods::Std
  (
    object_by_id => 
    [
      color => { class => 'Color' },
      category => 
      {
        class     => 'Category',
        id_method => 'cat_id',
        share_db  => 0,
      },
    ],
  );
  ...
  $prod = Product->new(...);
  $color = $prod->color;
  # $prod->color call is roughly equivalent to:
  #
  # $color = Color->new(id => $prod->color_id, 
  #                     db => $prod->db);
  # $ret = $color->load;
  # return $ret  unless($ret);
  # return $color;
  $cat = $prod->category;
  # $prod->category call is roughly equivalent to:
  #
  # $cat = Category->new(id => $prod->cat_id);
  # $ret = $cat->load;
  # return $ret  unless($ret);
  # return $cat;
DESCRIPTION"Rose::DB::Object::MakeMethods::Std" creates methods related to Rose::DB::Object::Std-derived objects. It inherits from Rose::Object::MakeMethods. See the Rose::Object::MakeMethods documentation to learn about the interface. The method types provided by this module are described below. All method types defined by this module are designed to work with objects that are subclasses of (or otherwise conform to the interface of) Rose::DB::Object. In particular, the object is expected to have a "db" method that returns a Rose::DB-derived object. See the Rose::DB::Object::Std documentation for more details. METHODS TYPES
 
 
 Example:     package Category;
    our @ISA = qw(Rose::DB::Object::Std);
    ...
    package Color;
    our @ISA = qw(Rose::DB::Object::Std);
    ...
    package Product;
    our @ISA = qw(Rose::DB::Object);
    ...
    use Rose::DB::Object::MakeMethods::Std
    (
      object_by_id => 
      [
        color => { class => 'Color' },
        category => 
        {
          class     => 'Category',
          id_method => 'cat_id',
          share_db  => 0,
        },
      ],
    );
    ...
    $prod = Product->new(...);
    $color = $prod->color;
    # $prod->color call is roughly equivalent to:
    #
    # $color = Color->new(id => $prod->color_id, 
    #                     db => $prod->db);
    # $ret = $color->load;
    # return $ret  unless($ret);
    # return $color;
    $cat = $prod->category;
    # $prod->category call is roughly equivalent to:
    #
    # $cat = Category->new(id => $prod->cat_id);
    # $ret = $cat->load;
    # return $ret  unless($ret);
    # return $cat;
AUTHORJohn C. Siracusa (siracusa@gmail.com) LICENSECopyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 
 
 |