John Millaway > DBomb > DBomb::Tie::PrimaryKeyList

Download:
DBomb-0.20.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: $Revision: 1.4 $   Source  

NAME ^

DBomb::Tie::PrimaryKeyList - A list of primary keys that auto creates objects when fetched.

SYNOPSIS ^

  tie @ids, 'DBomb::Tie::PrimaryKeyList', 'MyPackage::Customer';

  ## store plain ids, or PrimaryKey objects in the list
  for (@{$dbh->selectrow_arrayref("SELECT id FROM Customer")){
      push @ids, $_; ## Stores the [id] key.
  }

  ## Later, fetch the ids as objects.
  $customer = $ids[0];
  print $customer-name;
syntax highlighting: