Tie::DataDumper - Stores your object when untied via DataDumper


Tie-SaveLater documentation  | view source Contained in the Tie-SaveLater distribution.

Index


NAME

Top

Tie::DataDumper - Stores your object when untied via DataDumper

SYNOPSIS

Top

  use Tie::DataDumper;
  {
      tie my $scalar => 'Tie::DataDumper', 'scalar.pl';
      $scalar = 42;
  } # scalar is automatically saved as 'scalar.pl'.
  {
      tie my @array => 'Tie::DataDumper', 'array.pl';
      @array = qw(Sun Mon Tue Wed Fri Sat);
  } # array is automatically saved as 'array.pl'.
  {
      tie my %hash => 'Tie::DataDumper', 'hash.pl';
      %hash = (Sun=>0, Mon=>1, Tue=>2, Wed=>3, Thu=>4, Fri=>5, Sat=>6);
  } # hash is automatically saved as 'hash.pl'.
  {
      tie my $object => 'Tie::DataDumper', 'object.pl';
      $object = bless { First => 'Dan', Last => 'Kogai' }, 'DANKOGAI';
  } # You can save an object; just pass a scalar
  {
      tie my $object => 'Tie::DataDumper', 'object.pl';
      $object->{WIFE} =  { First => 'Naomi', Last => 'Kogai' };
      # you can save before you untie like this
      tied($object)->save;
  }

DESCRIPTION

Top

Tie::DataDumper stores tied variables when untied. Usually that happens when you variable is out of scope. You can of course explicitly untie the variable or tied($variable)->save but the whole idea is not to forget to save it.

This module uses DataDumper as its backend so it can store and retrieve anything that DataDumper can.

SECURITY

Top

This module uses eval() on loading saved files. That means there is a security risk of executing malicious codes. DO NOT USE THIS MODULE FOR ANYTHING SERIOUS. This module is just a proof-of-concept, example module to show how to make use of Tie::SaveLater.

SEE ALSO

Top

Tie::SaveLater, Tie::Storable, Tie::YAML

perltie, Tie::Scalar, Tie::Array, Tie::Hash

AUTHOR

Top

Dan Kogai, <dankogai@dan.co.jp>

COPYRIGHT AND LICENSE

Top


Tie-SaveLater documentation  | view source Contained in the Tie-SaveLater distribution.