The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Object::Relation::Setup - Set up a Object::Relation Data Store

Synopsis

  use Object::Relation::Setup;
  my $setup = Object::Relation::Setup->new(\%params);
  $setup->setup;

Description

This module is the base class for classes that set up a Object::Relation::Handle data store.

Class Interface

Constructors

new

  my $setup = Object::Relation::Setup->new(\%params);

This factory constructor creates and returns a new setup object. By default, it accepts the following parameters:

class

Determines which subclass of Object::Relation::Setup to use. The class can be specified as a full class name, such as Object::Relation::Setup::DB::Pg, or if it's in the Object::Relation::Setup namespace, you can just use the remainder of the class name, e.g., DB::Pg. Once Object::Relation::Setup has loaded the subclass, it will redispatch to its new() constructor. The class parameter defaults to DB::SQLite unless the constructor is called directly on the subclass, in which case that class will be used.

class_dirs

An array refererence of the classes to search for classes that inherit from Object::Relation::Base. These will be passed to the load_classes method of Object::Relation::Schema; as such, the final value in the list may optionally be a File::Find::Rule object. Defaults to ['lib'] if not specified.

verbose

A boolean value indicating whether or not the setup should be verbose.

Class Methods

schema_class

  my $schema_class = Object::Relation::Setup->schema_class

Returns the name of the Object::Relation::Schema subclass that can be used to generate the schema code to build the data store. By default, this method returns the same name as the name of the Object::Relation::Setup subclass, but with "Store" replaced with "Schema".

store_class

  my $store_class = Object::Relation::Setup->store_class

Returns the name of the Object::Relation::Handle subclass that manages the interface to the data store for Object::Relation applications. By default, this method returns the same name as the name of the Object::Relation::Setup subclass, but with "Build" removed.

Instance Interface

Instance Accessors

verbose

  my $verbose = $setup->verbose;
  $setup->verbose($verbose);

A boolean value idicating whether or not the setup should be verbose.

class_dirs

  my @dirs = $setup->class_dirs;
  $setup->class_dirs(@dirs);

Gets or sets the list of directories that will be searched for classes that inherit from Object::Relation::Base. These will be passed to the load_classes method of Object::Relation::Schema; as such, the final value in the list may optionally be a File::Find::Rule object.

Instance Methods

setup

  $setup->setup;

Sets up the data store. This is an abstract method that must be overridden in the subclasses.

load_schema

  $setup->load_schema;

Loads a Object::Relation::Schema object with all of the libraries found in the path specified by the class_dirs attribute.

Why? This loads an all of the libraries in an already installed Object::Relation platform, including, of course, the Object::Relation system classes. Then a complete database can be built including the system classes and the application classes. That's really only useful for tests, though.

notify

  $setup->nofify('Looking good...', $/);

Outputs setup notification messages. It simply prints all messages to if the verbose attribute is true.

Copyright and License

Copyright (c) 2004-2006 Kineticode, Inc. <info@obj_relode.com>

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.