12 Jan 2007 11:36:09 UTC
- Distribution: EnsEMBL-Web-Record
- Module version: 1.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (0 / 526 / 1)
- KwaliteeBus factor: 0
- 11.30% Coverage
- License: unknown
- Activity24 month
- Download (6.22KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionMJW Matt Wood
- COPYRIGHT & LICENSE
EnsEMBL::Web::Record - A family of modules used for managing a user's persistant data in a database.
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).
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.
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 ));
Marks a particular collection of records for an update. Tainted records are updated in the database when the Record's save method is called.
Uses Data::Dumper to format a record's data for storage, and also handles escaping of quotes to avoid SQL errors
Accessor for the fields property.
Accessor for the records property.
Accessor for the type property.
Accessor for the tainted property.
Accessor for the tainted property.
Accessor for the parameter_set property.
Accessor for the id property.
Accessor for the created_at property.
Accessor for the modified_at property.
Returns an array of records, that match a particular type.
Returns an array of records. This method is called by the autoloading mechanism, and is not intended for public use.
Accessor for the owner property.
Called automatically by Perl when object reference count reaches zero.
<mjw at cpan.org>
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.
You can find documentation for this module with the perldoc command.
You can also look for information at: http://www.ensembl.org
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
Many thanks to everyone on the Ensembl team, in particular James Smith, Anne Parker, Fiona Cunningham and Beth Prichard.
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 email@example.com 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.
Module Install Instructions
To install EnsEMBL::Web::Record, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install EnsEMBL::Web::Record
For more information on module installation, please visit the detailed CPAN module installation guide.