Handel::Manual::Cookbook::WritingCustomStorage

Handel::Manual::Cookbook::WritingCustomStorage is a step by step example of writing a custom storage class.
Download

Handel::Manual::Cookbook::WritingCustomStorage Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Christopher H. Laco
  • Publisher web site:
  • http://search.cpan.org/~claco/Handel-1.00009/lib/Handel/Manual/QuickStart.pod

Handel::Manual::Cookbook::WritingCustomStorage Tags


Handel::Manual::Cookbook::WritingCustomStorage Description

Handel::Manual::Cookbook::WritingCustomStorage is a step by step example of writing a custom storage class. Handel::Manual::Cookbook::WritingCustomStorage is a step by step example of writing a custom storage class.This document will cover the basic steps needed to write a custom storage class for Handel 1.0. For this exercise, we will write an XML storage class that will store a cart and its items in a single xml file with the ability to do wildcard searches just like our DBIC storage class. The new storage class could be used for order and order items as well.Writing a custom storage class is just a matter of subclassing Handel::Storage and Handel::Storage::Result and implementing the methods necessary to create/delete/search carts and items as well as begin/commit/rollback transactions and update calls.The example code below demonstrates how to write a custom storage class in Handel. While it covers the basic steps, it is by no means a complete implementation of all possible features, including things like column default values, parameter validation, etc. Those are left as an exercise for the reader to implement based on their particular situation and application needs.GETTING STARTEDCreate A Blank XML FileFirst, let's create the xml file we'll use to store shopping carts in: < ?xml version="1.0"? > < carts/ >Save this as carts.xml in a location of your choosing. As we add to this file later, it will take on the following format: < ?xml version="1.0"? > < carts > < cart id="1" shopper="1" name="My Cart" > < item id="1" sku="ABC-123" quantity="1" price="1.23"/ > < /cart > < /cart > Requirements: · Perl


Handel::Manual::Cookbook::WritingCustomStorage Related Software