NAME

Alias - provide a "symbolic link" type capability for Devices (and Collections?) in the database.


MODULE

base


SYNOPSIS

  use Alias;
  $a = Alias->new({name=>"thing"});
  $a->isa("Alias");  # returns true
  $a->target("realnode1");
  $target_name = $a->target;
  # assuming "realnode1" is of type Device::Node...
  $a->isa("Device::Node");  # returns true
  $obj = $a;
  $obj->some_method; # calls some_method() for target object


DESCRIPTION

This package provides the "Alias" object type for use in a CIToolkit database, which can reference any other existing object (Device or (Collection?))

Only the name and target methods (and isa if no target is yet defined) will act on the Alias itself. All other methods will behave as if called from the target object.

Also, after a target object method is called, the object handle will be changed to reference the target. This means that name, and target if defined, will subsequently act on the target, NOT THE Alias.


METHODS

new - create a new Alias object
Can pass in name and target parameters as follows: $a = Alias->new({name=>"thing", target=>"node1"});

name - get/set the name for this Alias
If passed no arguments, simply returns the current name. If passed a scalar, then the name is set to that value.

target - get/set the target for this Alias
If passed no arguments, simply returns the current target. If passed a scalar, then the target is set to that value.

isa - override UNIVERSAL::isa
Called with one argument, requested object type.

If target is defined, returns true if the target type matches the requested object type; otherwise returns false.

If target is NOT defined, performs a normal "isa" on the Alias object.

ANY OTHER METHOD - act on the target
Modifies the object reference so that it points to the target, instead of the Alias object. Then the method of the target is called, assuming it exists. Makes all future object calls refer to the target as well.


SEE ALSO

MyDB

Device

Collection