Data::Maker::Value - A value generated by a Data::Maker::Field


Data-Maker documentation Contained in the Data-Maker distribution.

Index


Code Index:

NAME

Top

Data::Maker::Value - A value generated by a Data::Maker::Field

SYNOPSIS

Top

  my $record = $maker->next_record;
  my $first_name = $record->{first_name};   # <=== A Data::Maker::Value object

  # automatic stringification
  print "First name: $first_name\n";

  # or, value() for backwards compatibility
  printf "First name: %s\n", $first_name->value;

DESCRIPTION

Top

This is a lightweight wrapper for Data::Maker field values that allows the Data::Maker internals to run a bit faster than they would without it, at the same time maintaining backward compatibility.

METHODS

value

Returns the boxed value.

AUTHOR

Top

Philip Garrett (philip.garrett@icainformatics.com)

LICENSE

Top

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


Data-Maker documentation Contained in the Data-Maker distribution.

package Data::Maker::Value;
use strict;
use warnings;

our $VERSION = '0.01';

use overload '""' => 'value';

sub new {
  my ($class,$value) = @_;
  return bless \$value, $class;
}

sub value {
  return ${$_[0]};
}

1;