Data::ObjectDriver

Simple, transparent data interface, with caching
Download

Data::ObjectDriver Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Benjamin Trott
  • Publisher web site:
  • http://search.cpan.org/~btrott/

Data::ObjectDriver Tags


Data::ObjectDriver Description

Simple, transparent data interface, with caching Data::ObjectDriver is an object relational mapper, meaning that it maps object-oriented design concepts onto a relational database.Data::ObjectDriver is inspired by, and descended from, the MT::ObjectDriver classes in Six Apart's Movable Type and TypePad weblogging products. But it adds in caching and partitioning layers, allowing you to spread data across multiple physical databases, without your application code needing to know where the data is stored.It's currently considered ALPHA code. The API is largely fixed, but may seen some small changes in the future. For what it's worth, the likeliest area for changes are in the syntax for the search method, and would most likely not break much in the way of backwards compatibility.SYNOPSIS ## Set up your database driver code. package FoodDriver; sub driver { Data::ObjectDriver::Driver::DBI->new( dsn => 'dbi:mysql:dbname', username => 'username', password => 'password', ) } ## Set up the classes for your recipe and ingredient objects. package Recipe; use base qw( Data::ObjectDriver::BaseObject ); __PACKAGE__->install_properties({ columns => , datasource => 'recipe', primary_key => 'recipe_id', driver => FoodDriver->driver, }); package Ingredient; use base qw( Data::ObjectDriver::BaseObject ); __PACKAGE__->install_properties({ columns => , datasource => 'ingredient', primary_key => , driver => FoodDriver->driver, }); ## And now, use them! my $recipe = Recipe->new; $recipe->title('Banana Milkshake'); $recipe->save; my $ingredient = Ingredient->new; $ingredient->recipe_id($recipe->id); $ingredient->name('Bananas'); $ingredient->quantity(5); $ingredient->save; ## Needs more bananas! $ingredient->quantity(10); $ingredient->save; ## Shorthand constructor my $ingredient = Ingredient->new(recipe_id=> $recipe->id, name => 'Milk', quantity => 2); Requirements: · Perl


Data::ObjectDriver Related Software