Dave Rolsky > Class-AlzaboWrapper > Class::AlzaboWrapper

Download:
Class-AlzaboWrapper-0.14.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.14   Source  

NAME ^

Class::AlzaboWrapper - Higher level wrapper around Alzabo Row and Table objects

SYNOPSIS ^

  package WebTalk::User;
  use base 'Class::AlzaboWrapper';

  __PACKAGE->SetAlzaboTable( $schema->table('User') );
  __PACKAGE->MakeColumnMethods();

DESCRIPTION ^

This module is intended for use as a base class when you are writing a class that wraps Alzabo's table and row classes.

It also provides a way to generate some methods specific to your subclass.

USAGE ^

Our usage examples will assume that there is database containing tables named "User" and "UserComment", and that the subclass we are creating is called WebTalk::User.

Exceptions

This module throws exceptions when invalid parameters are given to methods. The exceptions it throws are objects which inherit from Exception::Class::Base, just as with Alzabo itself.

SetAlzaboTable()

This method must be called by your subclass or almost none of the methods provided by Class::AlzaboWrapper will work.

Inherited methods

Subclasses inherit a number of method from Class::AlzaboWrapper.

Class methods

Object methods

MakeColumnMethods(...)

If you call this method on your subclass, then for each column in the associated table, a method will be created in your subclass that selects that column's value from the underlying row for an object.

For example, if our User table contained "username" and "email" columns, then our WebTalk::User object would have username() and email() methods generated.

The MakeColumnMethods() method accepts a "skip" parameter which can be either a scalar or array reference. This is a list of columns for which methods should not be generated.

Class::AlzaboWrapper methods

The Class::AlzaboWrapper module has a method it provides:

Cursors

When using this module, you need to use the Class::AlzaboWrapper::Cursor module to wrap Alzabo's cursor objects, so that objects the cursor returns are of the appropriate subclass, not plain Alzabo::Runtime::Row objects. The Cursor() method provides some syntactic sugar for creating Class::AlzaboWrapper::Cursor objects.

Attributes created by subclasses

If you want to record the accessor methods your subclass makes so they are available via AlzaboAttributes(), you can call the _RecordAttributeCreation() method, which expects two arguments. The first argument is the class for which the method was created and the second is the name of the method.

SUPPORT ^

The Alzabo docs are conveniently located online at http://www.alzabo.org/docs/.

There is also a mailing list. You can sign up at http://lists.sourceforge.net/lists/listinfo/alzabo-general.

Please don't email me directly. Use the list instead so others can see your questions.

SEE ALSO ^

VegGuide.Org is a site I created which actually uses this code as part of the application. Its source is available from the web site.

COPYRIGHT ^

Copyright (c) 2002-2005 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

AUTHOR ^

Dave Rolsky, <autarch@urth.org>

syntax highlighting: