Andrew Sterling Hanenkamp > Repository-Simple-0.06 > Repository::Simple::Value

Download:
Repository-Simple-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Repository::Simple::Value - Class for retrieving and setting property values

DESCRIPTION ^

This class is used for access a property value. This class is never instantiated directly, but retrieved from a property via the value() method:

  my $value = $property->value;
  my $scalar = $value->get_scalar;
  my $handle = $handle->get_handle('<');

METHODS

$scalar = $value->get_scalar

Retrieve the value of the property as a scalar value.

$handle = $value->get_handle
$handle = $value->get_handle($mode)

Retrieve the value of the property as an IO handle. The $mode argument is used to specify what kind of handle it is. It should be one of:

  • "<"
  • ">"
  • ">>"
  • "+<"
  • "+>"
  • "+>>"

If the value cannot be returned with a handle in the given mode, the method will croak. If $mode is not given, then "<" is assumed.

$value->set_handle($handle)

Given a ready-to-read IO handle, this method will replace the contents of the value with the contents of the entire file handle. The handle should be passed as a reference to a glob. E.g.,

  $foo = "blah blah";
  $value1->set_handle(\*STDIN);
  $value2->set_handle(IO::Scalar->new(\$foo));

Make sure to call the save() method on the property or a parent node to ensure the change has taken place. The change might take place immediately for some engines, but the change is guaranteed to have happened by the time the save() method returned.

$value->set_value($value)

Replaces the value with the scalar value $value.

Make sure to call the save() method on the property or a parent node to ensure the change has taken place. The change might take place immediately for some engines, but the change is guaranteed to have happened by the time the save() method returned.

AUTHOR ^

Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>

LICENSE AND COPYRIGHT ^

Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.

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

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: