Aion
view release on metacpan or search on metacpan
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
```
ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
```perl
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
```
## isa => $type
УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
* `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
* СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
i18n/Aion/Type.ru-en.po view on Meta::CPAN
msgid "СвойÑÑво `init` не Ð¼Ð¾Ð¶ÐµÑ Ð¸ÑполÑзоваÑÑÑÑ Ñ `make`."
msgstr "The `init` property cannot be used with `make`."
msgid "Ð¡Ð¾Ð·Ð´Ð°ÐµÑ Ð¿Ð¾Ð´Ð¿ÑогÑÐ°Ð¼Ð¼Ñ Ñ Ð°ÑгÑменÑами, коÑоÑÐ°Ñ Ð²Ð¾Ð·Ð²ÑаÑÐ°ÐµÑ Ñип."
msgstr "Creates a subroutine with arguments that returns a type."
msgid "ÐÑли подпÑогÑамма не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ñоздана, Ñо вÑбÑаÑÑваеÑÑÑ Ð¸ÑклÑÑение."
msgstr "If the routine cannot be created, an exception is thrown."
msgid "Ð¢Ð¸Ð¿Ñ ÑавнÑ, еÑли они имеÑÑ Ð¾Ð´Ð¸Ð½Ð°ÐºÐ¾Ð²Ð¾Ðµ имÑ, одинаковое колиÑеÑÑво аÑгÑменÑов, ÑодиÑелÑÑкий ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð¸ аÑгÑменÑÑ ÑавнÑ."
msgstr "Types are equal if they have the same name, the same number of arguments, the parent element, and the arguments are equal."
msgid "ÐбÑаÑÐ½Ð°Ñ Ð¾Ð¿ÐµÑаÑÐ¸Ñ Ðº `equal`."
msgstr "The reverse operation of `equal`."
msgid "СпиÑок аÑгÑменÑов."
msgstr "List of arguments."
msgid "ÐÐ¼Ñ Ñипа."
msgstr "Type name."
lib/Aion.md view on Meta::CPAN
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
```
ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
```perl
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
```
## isa => $type
УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
* `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
* СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
lib/Aion.pm view on Meta::CPAN
ExIs->new(ro => 10)->ro # -> 10
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
The function with C<*> does not hold the meaning:
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
=head2 isa => $type
Indicates the type, or rather - a validator, feature.
Can take:
=over
=item * C<Aion::Type> â Aion immediately imports all types from L<Aion::Types> into the package.
lib/Aion/Type.pm view on Meta::CPAN
3 ~~ Enum123 # -> 1
3 ~~ Enum123[4,5,6] # -> ""
5 ~~ Enum123[4,5,6] # -> 1
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@ # ~> syntax error
=head2 equal ($type)
Types are equal if they have the same name, the same number of arguments, the parent element, and the arguments are equal.
my $Int = Aion::Type->new(name => "Int");
my $PositiveInt = Aion::Type->new(name => "PositiveInt", as => $Int);
my $AnotherInt = Aion::Type->new(name => "Int");
my $IntWithArgs = Aion::Type->new(name => "Int", args => [1, 2]);
my $AnotherIntWithArgs = Aion::Type->new(name => "Int", args => [1, 2]);
my $IntWithDifferentArgs = Aion::Type->new(name => "Int", args => [3, 4]);
my $Str = Aion::Type->new(name => "Str");
$Int->equal($Int) # -> 1
local ($::_g0 = do {ExIs->new(ro => 10)->wo(30)->has_wo}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'ExIs->new(ro => 10)->wo(30)->has_wo # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0...
eval {ExIs->new(ro => 10)->wo}; local ($::_g0 = $@, $::_e0 = 'Feature wo cannot be get!'); ok defined($::_g0) && $::_g0 =~ /^${\quotemeta $::_e0}/, 'ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!' or ::diag ::_string_diff($::_g0, $::_e0, 1);...
local ($::_g0 = do {ExIs->new(ro => 10)->rw(30)->rw}, $::_e0 = do {30}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'ExIs->new(ro => 10)->rw(30)->rw # -> 30' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
#
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
local ($::_g0 = do {$node->parent->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
undef $root;
local ($::_g0 = do {$node->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
# And by setter:
$node->parent($root = Node->new);
local ($::_g0 = do {$node->parent->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
undef $root;
local ($::_g0 = do {$node->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## isa => $type
#
# УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
#
# ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
#
# * `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
# * СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
( run in 1.570 second using v1.01-cache-2.11-cpan-5735350b133 )