Jochen Wiedmann > Wizard > Wizard::SaveAble

Download:
Wizard-0.1006.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

    Wizard::SaveAble - A package for automatically saved objects.

SYNOPSIS ^

    # Tell a SaveAble object that it's modified
    $obj->Modified(1);

    # Tell the SaveAble object to store itself back to disk
    $obj->Store();

DESCRIPTION ^

An object of the class Wizard::SaveAble is something that knows whether it has to be saved or not. To that end it offers methods like Modified and Store.

CLASS INTERFACE ^

All methods are throwing a Perl exception in case of errors.

Constructors

  # Create an empty SaveAble object and associate a file name to it.
  my $obj = Wizard::SaveAble->new('file' => $file);

  # Load a SaveAble object from a file.
  my $obj = Wizard::SaveAble->new($file);

  # Same thing, but creating an empty object if $file doesn't exist
  my $obj = Wizard::SaveAble->new('file' => $file, 'load' => 1);

(Class method) There are two possible constructors for the Wizard::SaveAble class: The first is creating an empty object, you typically use a subclass of Wizard::SaveAble here. The most important attribute is the file name where the object should later be stored.

The other constructor is loading an already existing object from a file. The object is automatically blessed into the same class again, typically a subclass of Wizard::SaveAble.

Setting and Querying an objects status

  # Tell an object that it's modified
  $obj->Modified(1);
  # Query whether an object is modified
  $modified = $obj->Modified()

(Instance methods) The Modified method is used to determine whether an object needs to be saved or not.

Setting and Querying an objects file name

  # Set the objects associated file
  $obj->File($file);
  # Query the objects associated file
  $file = $obj->File();

(Instance methods) The Modified method is used to determine whether an object needs to be saved or not.

Storing an object to disk

  $obj->Store();

(Instance Method) The object is stored back to disk into the file that was fixed within the constructor.

AUTHORS AND COPYRIGHT ^

This module is

  Copyright (C) 1999     Jochen Wiedmann
                         Am Eisteich 9
                         72555 Metzingen
                         Germany

                         Email: joe@ispsoft.de
                         Phone: +49 7123 14887

                 and     Amarendran R. Subramanian
                         Grundstr. 32
                         72810 Gomaringen
                         Germany

                         Email: amar@ispsoft.de
                         Phone: +49 7072 920696

All Rights Reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

SEE ALSO ^

Wizard(3), Wizard::State(3)

syntax highlighting: