The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Maker::Field::Initials - A Data::Maker field class that generates its data from the initials of either the the value of a single field, or the value of multiple fields, previously determined in the same record. This class is a subclass of Data::Maker::Field::Code.

SYNOPSIS

There are two ways to use the Initials class:

Derive the initials from one field

The initials will be derived from the first letter of each word in the last value generated for the given field.

  use Data::Maker;
  use Data::Maker::Field::Lorem;
  use Data::Maker::Field::Initials;

  my $maker = Data::Maker->new(
    record_count => 10,
    fields => [
      {
        name => 'foo',
        class => 'Data::Maker::Field::Lorem',
        args => {
          words => 5
        }
      },
      {
        name => 'foo_initials',
        class => 'Data::Maker::Field::Initials',
        args => {
          from_field => 'foo'
        }
      },
    ]
  );

Derive the initials from multiple fields

The initials will be derived from the first letter of the last value generated for the each field.

  use Data::Maker;
  use Data::Maker::Field::Person;
  use Data::Maker::Field::Initials;

  my $maker = Data::Maker->new(
    record_count => 10,
    fields => [
      {
        name => 'firstname',
        class => 'Data::Maker::Field::Person::FirstName'
      },
      {
        name => 'lastname',
        class => 'Data::Maker::Field::Person::LastName'
      },
      {
        name => 'initials',
        class => 'Data::Maker::Field::Initials',
        args => {
          from_field_set => [ 'firstname', 'lastname']
        }
      },
    ]
  );

DESCRIPTION

Data::Maker::Field::Initials takes one of two arguments:

from_field NAME

Takes the name of the field from which the initials will be derived, based on the first letter of each word of the last value generated for the named field.

from_field ARRAYREF

Takes the a list of fields from which the initials will be derived, based on the first letters of the last values generated for each field in the list.

AUTHOR

John Ingram (john@funnycow.com)

LICENSE

Copyright 2010 by John Ingram. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.