Container

ROLE

role Config::BINDish::AST::Container - common declarations for any kind of value containers

DESCRIPTION

This role defines the interface and implementation of a container which is characterized by the value it contains and a type name associated with the value.

ATTRIBUTES

Mu $.payload

The actual value.

This attribute handles all stadndard coercion methods found on Match and Str classes. So, it is possible to coerce a container like this:

my Int(Config::BINDish::AST::Container:D) $some-count = $container;

or even easier:

my Int $some-count = Int($container);

Str:D $.type-name

The type name describing $.payload. Normally borrowed from Config::BINDish::Grammar::Value.

Defaults to "any".

METHODS

node-name()

Returns node class shortname.

COERCIONS

The role supports specialized coercion from Config::BINDish::Grammar::Value:

my Config::BINDish::AST::Container $c = Config::BINDish::AST::Value($grammar-value);

In this case new container's payload and type name are set from corresponding attributes of Config::BINDish::Grammar::Value instance. The payload is obtained using the coerced method of Config::BINDish::Grammar::Value.

For any other kind of value it is stored in the $.payload attribute. And the type name is set to lowercased name of the value's class. The only exception is any of Stringy-consuming class for which the type name is set to "sq-string".

multi ACCEPTS(Config::BINDish::AST::Container:D $val)

Matches $val.payload against our $.payload

multi ACCEPTS(Any:D $val)

Matches $val against our $.payload.

SEE ALSO

COPYRIGHT

(c) 2023, Vadim Belman <[email protected]>

LICENSE

Artistic License 2.0

See the LICENSE file in this distribution.

Config::BINDish v0.0.18

Extensible BIND9-like Configuration Files Support

Authors

  • Vadim Belman

License

Artistic-2.0

Dependencies

AttrX::Mooish:auth<zef:vrurg>:ver<1.0.0+>:api<1.0.*>IP::AddrTest::Async:auth<zef:vrurg>:ver<0.1.2+>

Test Dependencies

Provides

  • Config::BINDish
  • Config::BINDish::AST
  • Config::BINDish::Actions
  • Config::BINDish::Expandable
  • Config::BINDish::Grammar
  • Config::BINDish::INET
  • Config::BINDish::Ops
  • Config::BINDish::Test
  • Config::BINDish::X

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.