Author image Matt Wood

NAME

EnsEMBL::Web::Record - A family of modules used for managing a user's persistant data in a database.

VERSION

Version 1.01

SYNOPSIS

    Many web sites now encourage users to register and login to access
    more advanced features, and to customise a site to their needs.

    The EnsEMBL::Web::Record group of Perl modules is design to manage
    any arbitrary type of user created data in an SQL database. This
    module follows the Active Record design pattern, in that each new
    instantiated Record object represents a single row of a database.
    That object can be manipulated programatically, and any changes made
    can be stored in the database with a single record->save function
    call.

    Because arbitrary Perl data structures can be stored in this
    manner, EnsEMBL::Web::Record allows user preferences to be easily
    saved, and allows developers to implement new featurs quickly.

    This module was first used (and has been abstracted from) the
    Ensembl genome browser (http://www.ensembl.org).

    New user data can be added to the database:

    use EnsEMBL::Web::Record;

    my $bookmark = EnsEMBL::Web::Record->new();
    $bookmark->url('http://www.ensembl.org');
    $bookmark->name('Ensembl');
    $bookmark->save;
    ...
 
    The Record can be associated with an user id:

    $record->user($id);

    The same record can also be removed:

    $bookmark->delete;

    EnsEMBL::Web::Record also provides a number of methods for getting
    collections of records from the database, using a field selector.
 
    EnsEMBL::Web::Record::find_bookmarks_by_user_id($id).

METHODS

AUTOLOAD

The AUTOLOAD method allows EnsEMBL::Web::Record to automatically provide getter and setter functionality for an arbitrary set of fields. It also automatically dispatches find_by requests.

Field attributes are not validated against the database.

new

Creates a new Record object. This module follows the Active Record pattern: it contains both the domain logic required to create and manipulate a piece of persistent data, and the information necessary to maintain this data in a database.

You should pass in a valid database adaptor, which contains the necessary sql requests. An example adaptor can be found in the distribution.

$record = EnsEMBL::Web::Record->new(( adaptor => $adaptor ));

taint

Marks a particular collection of records for an update. Tainted records are updated in the database when the Record's save method is called.

dump_data

Uses Data::Dumper to format a record's data for storage, and also handles escaping of quotes to avoid SQL errors

fields

Accessor for the fields property.

records

Accessor for the records property.

type

Accessor for the type property.

tainted

Accessor for the tainted property.

adaptor

Accessor for the tainted property.

parameter_set

Accessor for the parameter_set property.

id

Accessor for the id property.

created_at

Accessor for the created_at property.

modified_at

Accessor for the modified_at property.

records_of_type

Returns an array of records, that match a particular type.

find_records

Returns an array of records. This method is called by the autoloading mechanism, and is not intended for public use.

owner

Accessor for the owner property.

DESTROY

Called automatically by Perl when object reference count reaches zero.

AUTHOR

Matt Wood, <mjw at cpan.org>

BUGS

Please report any bugs or feature requests to bug-ensembl-web-record at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=EnsEMBL-Web-Record.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc EnsEMBL::Web::Record

You can also look for information at: http://www.ensembl.org

ACKNOWLEDGEMENTS

Many thanks to everyone on the Ensembl team, in particular James Smith, Anne Parker, Fiona Cunningham and Beth Prichard.

COPYRIGHT & LICENSE

Copyright (c) 1999-2006 The European Bioinformatics Institute and Genome Research Limited, and others. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
   3. The name Ensembl must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact ensembl-dev@ebi.ac.uk
   4. Products derived from this software may not be called "Ensembl" nor may "Ensembl" appear in their names without prior written permission of the Ensembl developers.
   5. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by Ensembl (http://www.ensembl.org/).

THIS SOFTWARE IS PROVIDED BY THE ENSEMBL GROUP "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ENSEMBL GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.