Kazuhiro Osawa > Data-Model-0.00007 > Data::Model::Mixin::FindOrCreate

Download:
Data-Model-0.00007.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  2
View/Report Bugs
Source   Latest Release: Data-Model-0.00008

NAME ^

Data::Model::Mixin::FindOrCreate - add find_or_create method

SYNOPSIS ^

  use Data::Model::Mixin modules => ['FindOrCreate'];

  $model->find_or_create(
      tablename => key => {
          field1 => 'value',
          field2 => 'value',
      }
  );

  $model->find_or_create(
      tablename => [qw/ key1 key2 /] => {
          field1 => 'value',
          field2 => 'value',
      }
  );

  # using unique index, but not use normal index
  $model->find_or_create(
      tablename => { unique_idx => 'key' } => {
          field1 => 'value',
          field2 => 'value',
      }
  );

  $model->find_or_create(
      tablename => { unique_idx => [qw/ key1 key2 /] } => {
          field1 => 'value',
          field2 => 'value',
      }
  );

SEE ALSO ^

Data::Model::Mixin

AUTHOR ^

Kazuhiro Osawa <yappo <at> shibuya <döt> pl>

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: