Connector

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

values of all keys (including undef elements if they are explicitly given).

    my @keys = $connector->get_keys( 'smartcard.owners.tokens.bob' );

If the node does not exist, an empty list is returned.

## get\_reference \[deprecated\]

Rarely used, returns the value of a reference node. Currently used by
Connector::Multi in combination with Connector::Proxy::Config::Versioned
to create internal links and cascaded connectors. See Connector::Multi
for details.

## set

The set method is a "all in one" implementation, that is used for either type
of value. If the value is not a scalar, it must be passed by reference.

    $connector->set('smartcard.owners.tokenid.bob', $value, $params);

The _value_ parameter holds a scalar or ref to an array/hash with the data to

lib/Connector.pm  view on Meta::CPAN

values of all keys (including undef elements if they are explicitly given).

  my @keys = $connector->get_keys( 'smartcard.owners.tokens.bob' );

If the node does not exist, an empty list is returned.

=head2 get_reference [deprecated]

Rarely used, returns the value of a reference node. Currently used by
Connector::Multi in combination with Connector::Proxy::Config::Versioned
to create internal links and cascaded connectors. See Connector::Multi
for details.

=head2 set

The set method is a "all in one" implementation, that is used for either type
of value. If the value is not a scalar, it must be passed by reference.

  $connector->set('smartcard.owners.tokenid.bob', $value, $params);

The I<value> parameter holds a scalar or ref to an array/hash with the data to

t/01-multi.t  view on Meta::CPAN


is( $conn->get_meta('meta.inner' )->{TYPE} , 'hash', 'inner hash node');
is( $conn->get_meta('meta.inner.hash' )->{TYPE} , 'hash', 'outer hash node');
is( $conn->get_meta('meta.inner.hash.key2' )->{TYPE} , 'scalar', 'hash leaf');
is( $conn->get_meta('meta.inner.list' )->{TYPE} , 'list', 'outer list');
is( $conn->get_meta('meta.inner.list.0' )->{TYPE} , 'scalar', 'scalar leaf');
is( $conn->get_meta('meta.inner.single' )->{TYPE} , 'list', 'one item list');
is( $conn->get_meta('meta.inner.single.0' )->{TYPE} , 'scalar', 'scalar leaf');

is( $conn->get_hash('leafref.hash')->{bob}, '007', 'hash with reference in leaf' );
is( $conn->get('cascaded.reference.bob'), 'token_1', 'reference over connector' );
is( $conn->get_hash('cascaded.reference')->{bob}, 'token_1', 'reference over connector with hash' );

is( $conn->get('cascaded.walkover.source.joe.tokenid'), 'token_1', 'reference with walkover' );

my @owners = $conn->get_keys('cascaded.connector.hook.owners');
ok( grep("joe", @owners), 'Hash contains joe' );
is( scalar @owners, 2, 'Hash has two items' );

ok ($conn->exists('smartcards.puk'), 'Exists reference');
ok ($conn->exists('smartcards.owners.joe'), 'connector node exists');
ok ($conn->exists('smartcards.owners.joe.tokenid'), 'connector leaf exists');
ok ($conn->exists( [ 'smartcards', 'owners', 'joe' ] ), 'node exists Array');
ok (!$conn->exists('smartcards.owners.jeff'), 'connector node not exists');

$ENV{OXI_TEST_FOOBAR} = "foobar";

t/config/01-multi-sym1.conf  view on Meta::CPAN

0 = item1
1 = item2

[meta.inner.single]
0 = item1

[leafref.hash]
alice= 0815
bob@ = smartcards.puk

[cascaded.reference]
bob@ = smartcards.owners.joe.tokenid

[cascaded.walkover]
source@ = smartcards.owners

[cascaded.connector.hook]
owners@ = connector:cascaded.connector.base

# Seed the location of the base connector from
# the result of the location connector
[cascaded.connector.base]
class = Connector::Proxy::YAML
LOCATION@ = connector:cascaded.connector.location

[cascaded.connector.location]
class = Connector::Builtin::Static
LOCATION = t/config/01-multi-symlink-owners.yaml

[envvar.foo]
bar@ = env:OXI_TEST_FOOBAR

[cache_test.branch1]
foo@ = connector:connectors.cache_test

[cache_test.branch2]

t/config/01-multi-sym1.yaml  view on Meta::CPAN

      1: item2

    single:
      0: item1

leafref:
  hash:
    alice: 0815
    bob@: "connector:smartcards.puk"

cascaded:
  reference:
    bob@: "connector:smartcards.owners.joe.tokenid"

  walkover:
    source@: "connector:smartcards.owners"

  connector:
    hook:
      owners@: "connector:cascaded.connector.base"
    # Seed the location of the base connector from
    # the result of the location connector
    base:
      class: Connector::Proxy::YAML
      LOCATION@: "connector:cascaded.connector.location"

    location:
      class: Connector::Builtin::Static
      LOCATION: t/config/01-multi-symlink-owners.yaml

envvar:
  foo:
  bar@: env:OXI_TEST_FOOBAR

cache_test:



( run in 0.949 second using v1.01-cache-2.11-cpan-49f99fa48dc )