Aion

 view release on metacpan or  search on metacpan

i18n/Aion/Env.ru-en.po  view on Meta::CPAN

msgid "Файл .env:"
msgstr ".env file:"

msgid "В проектах используется конфигурационный файл `.env` для конфигурации проекта, в `Makefile`, для `docker` и `docker compose`. Данный модуль позволяет оф...
msgstr "Projects use the `.env` configuration file for project configuration, in `Makefile`, for `docker` and `docker compose`. This module allows you to design environment variables as constants of `perl` modules."

msgid "Константы инициализируются из `%ENV`, если там нет значения или оно `undef`, то из файла `.env`, а если и там его не будет – из опции `default`."
msgstr "Constants are initialized from `%ENV`, if there is no value there or it is `undef`, then from the `.env` file, and if it is not there, from the `default` option."

msgid "При парсинге файла, ошибка синтаксиса приведёт к исключению."
msgstr "When parsing a file, a syntax error will result in an exception."

msgid "Тип переменной окружения можно проверять с помощью опции `isa`."
msgstr "The type of an environment variable can be checked using the `isa` option."

msgid "Рекомендуется называть переменные окружения используя название модуля в котором она объявлена. Например, пакет `Aion::Type`, тогда имена ...
msgstr "It is recommended to name environment variables using the name of the module in which it is declared. For example, the package is `Aion::Type`, then the names of the environment variables in it are `AION_TYPE_*`."

msgid "Создаёт константу с именем `$name` в пакете из которого вызван.\n"
"Опционально можно передать в `%kw` `isa` и `default`."
msgstr "Creates a constant with the name `$name` in the package from which it is called.\n"

i18n/Aion/Type.ru-en.po  view on Meta::CPAN

msgid "Проверяет, что аргумент не принадлежит классу."
msgstr "Checks that the argument does not belong to the class."

msgid "Привести `$value` к типу, если приведение из типа и функции находится в `$self->{coerce}`."
msgstr "Cast `$value` to type if the cast from type and function is in `$self->{coerce}`."

msgid "Соответствует оператору `>>`."
msgstr "Corresponds to the `>>` operator."

msgid "Формирует сообщение ошибки."
msgstr "Generates an error message."

msgid "Проверяет `$element` и выбрасывает сообщение `detail`, если элемент не принадлежит классу."
msgstr "Checks `$element` and throws a `detail` message if the element does not belong to the class."

msgid "Переводит `$val` в строку."
msgstr "Converts `$val` to a string."

msgid "Определяет, что тип является подтипом другого `$type` по имени типа."
msgstr "Determines that a type is a subtype of another `$type` by type name."

i18n/Aion/Type.ru-en.po  view on Meta::CPAN

msgid "Список аргументов."
msgstr "List of arguments."

msgid "Имя типа."
msgstr "Type name."

msgid "Родительский тип."
msgstr "Parent type."

msgid "Акцессор сообщения. Использует `&message` для генерации сообщения об ошибке."
msgstr "Message accessor. Uses `&message` to generate an error message."

msgid "Акцессор заголовка (используется для создания схемы **swagger**)."
msgstr "Header accessor (used to create the **swagger** schema)."

msgid "Акцессор описания (используется для создания схемы **swagger**)."
msgstr "Description accessor (used to create a **swagger** schema)."

msgid "Акцессор примера (используется для создания схемы **swagger**)."
msgstr "Example accessor (used to create the **swagger** schema)."

i18n/Aion/Types.ru-en.po  view on Meta::CPAN

msgid "Четвёртый аргумент типа."
msgstr "The fourth type argument."

msgid "`M` и `N` сокращение для `SELF->{M}` и `SELF->{N}`."
msgstr "`M` and `N` are shorthand for `SELF->{M}` and `SELF->{N}`."

msgid "Сокращение для `SELF->{N}`."
msgstr "Shorthand for `SELF->{N}`."

msgid "Используется с `subtype` для вывода сообщения об ошибке, если значение исключает тип. В `$code` используется: `SELF` - текущий тип, `ARGS`, `A`, `B`, `C`, `D...
msgstr "Used with `subtype` to print an error message if the value excludes the type. `$code` uses: `SELF` - the current type, `ARGS`, `A`, `B`, `C`, `D` - type arguments (if any) and a test value in `$_`. It can be converted to a string using `SELF-...

msgid "Добавляет новое приведение (`$via`) к `$type` из `$from` типа."
msgstr "Adds a new cast (`$via`) to `$type` from `$from` type."

msgid "Может использовать параметры типа:"
msgstr "Can use parameters like:"

msgid "`coerce` выбрасывает исключения:"
msgstr "`coerce` throws exceptions:"

i18n/Aion/Types.ru-en.po  view on Meta::CPAN

msgid "Определяет значение длины от `from` или 0 до `to`."
msgstr "Specifies a length value from `from` or 0 to `to`."

msgid "Perl версии."
msgstr "Perl version."

msgid "Строки, включая числа."
msgstr "Strings, including numbers."

msgid "Строки Unicode с флагом utf8 или если декодирование в utf8 происходит без ошибок."
msgstr "Unicode strings with the utf8 flag or if decoding to utf8 occurs without errors."

msgid "Бинарные строки без флага utf8 и октетов с номерами меньше 128."
msgstr "Binary strings without the utf8 flag and octets with numbers less than 128."

msgid "Строка начинается с `begin`."
msgstr "The line starts with `begin`."

msgid "Строка заканчивается на `end`."
msgstr "The line ends with `end`."

lib/Aion/Type.md  view on Meta::CPAN


Если указан `init` то при каждом использовании подпрограммы будет создаваться тип и инициализироваться.

```perl
eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@ # ~> init_where won't work in Rim
```

Если подпрограмма не может быть создана, то выбрасывается исключение.

```perl
eval { Aion::Type->new(name=>"Rim")->make }; $@ # ~> syntax error
```

## make_arg ($pkg)

Создает подпрограмму с аргументами, которая возвращает тип.

```perl
BEGIN {
	Aion::Type->new(name=>"Len", test => sub {
		$Aion::Type::SELF->{args}[0] <= length($_) && length($_) <= $Aion::Type::SELF->{args}[1]
	})->make_arg(__PACKAGE__, 1);
}

"IX" ~~ Len[2,2] # => 1
```

Если подпрограмма не может быть создана, то выбрасывается исключение.

```perl
eval { Aion::Type->new(name=>"Rim")->make_arg }; $@ # ~> syntax error
```

## make_maybe_arg ($pkg)

Создает подпрограмму с аргументами или без.

```perl
BEGIN {
	Aion::Type->new(
		name => "Enum123",

lib/Aion/Type.md  view on Meta::CPAN

}

3 ~~ Enum123        # -> 1
3 ~~ Enum123[4,5,6] # -> ""
5 ~~ Enum123[4,5,6] # -> 1
```

Если подпрограмма не может быть создана, то выбрасывается исключение.

```perl
eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@ # ~> syntax error
```

## args ()

Список аргументов.

## name ()

Имя типа.

lib/Aion/Type.pm  view on Meta::CPAN

	
	push @{$Int->{coerce}}, [$Bool, sub { 0+$_ }];
	push @{$Int->{coerce}}, [$Num, sub { int($_+.5) }];
	
	$Int->coerce(5.5)	 # => 6
	$Int->coerce(undef)  # => 0
	$Int->coerce("abc")  # => abc

=head2 detail ($element, $feature)

Generates an error message.

	my $Int = Aion::Type->new(name => "Int");
	
	$Int->detail(-5, "Feature car") # => Feature car must have the type Int. The it is -5!
	
	my $Num = Aion::Type->new(name => "Num", message => sub {
		"Error: $_ is'nt $Aion::Type::SELF->{property}!"
	});
	
	$Num->detail("x", "car") # => Error: x is'nt car!

lib/Aion/Type.pm  view on Meta::CPAN

	}
	
	"IX" ~~ Rim	 # => 1

If C<init> is specified, then each time the subroutine is used, a type will be created and initialized.

	eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@ # ~> init_where won't work in Rim

If the routine cannot be created, an exception is thrown.

	eval { Aion::Type->new(name=>"Rim")->make }; $@ # ~> syntax error

=head2 make_arg ($pkg)

Creates a subroutine with arguments that returns a type.

	BEGIN {
		Aion::Type->new(name=>"Len", test => sub {
			$Aion::Type::SELF->{args}[0] <= length($_) && length($_) <= $Aion::Type::SELF->{args}[1]
		})->make_arg(__PACKAGE__, 1);
	}
	
	"IX" ~~ Len[2,2] # => 1

If the routine cannot be created, an exception is thrown.

	eval { Aion::Type->new(name=>"Rim")->make_arg }; $@ # ~> syntax error

=head2 make_maybe_arg ($pkg)

Creates a subroutine with or without arguments.

	BEGIN {
		Aion::Type->new(
			name => "Enum123",
			test => sub { $_ ~~ [1,2,3] },
			a_test => sub { $_ ~~ $Aion::Type::SELF->{args} },
		)->make_maybe_arg(__PACKAGE__);
	}
	
	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 args ()

List of arguments.

=head2 name ()

Type name.

=head2 as ()

Parent type.

=head2 message (;&message)

Message accessor. Uses C<&message> to generate an error message.

=head2 title (;$title)

Header accessor (used to create the B<swagger> schema).

=head2 description (;$description)

Description accessor (used to create a B<swagger> schema).

=head2 example (;$example)

lib/Aion/Types.pm  view on Meta::CPAN

	"Hi my dear!" ~~ BeginAndEnd["Hi,", "!"];  # -> ""
	
	"" . BeginAndEnd["Hi,", "!"] # => BeginAndEnd['Hi,', '!']

=head2 N

Shorthand for C<< SELF-E<gt>{N} >>.

=head2 message ($code)

Used with C<subtype> to print an error message if the value excludes the type. C<$code> uses: C<SELF> - the current type, C<ARGS>, C<A>, C<B>, C<C>, C<D> - type arguments (if any) and a test value in C<$_>. It can be converted to a string using C<< S...

=head2 coerce ($type, from => $from, via => $via)

Adds a new cast (C<$via>) to C<$type> from C<$from> type.

	BEGIN {
		subtype Four => where {4 eq $_};
	}
	
	"4a" ~~ Four # -> ""

lib/Aion/Types.pm  view on Meta::CPAN

=head2 Str

Strings, including numbers.

	1.1 ~~ Str   # -> 1
	"" ~~ Str    # -> 1
	1.1.0 ~~ Str # -> ""

=head2 Uni

Unicode strings with the utf8 flag or if decoding to utf8 occurs without errors.

	"↭" ~~ Uni # -> 1
	123 ~~ Uni # -> ""
	do {no utf8; "↭" ~~ Uni} # -> 1

=head2 Bin

Binary strings without the utf8 flag and octets with numbers less than 128.

	123 ~~ Bin # -> 1

t/aion/type.t  view on Meta::CPAN

# 
# Если указан `init` то при каждом использовании подпрограммы будет создаваться тип и инициализироваться.
# 

::like scalar do {eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@}, qr{init_where won't work in Rim}, 'eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@ # ~> init_where won\'t work in Rim'...

# 
# Если подпрограмма не может быть создана, то выбрасывается исключение.
# 

::like scalar do {eval { Aion::Type->new(name=>"Rim")->make }; $@}, qr{syntax error}, 'eval { Aion::Type->new(name=>"Rim")->make }; $@ # ~> syntax error'; undef $::_g0; undef $::_e0;

# 
# ## make_arg ($pkg)
# 
# Создает подпрограмму с аргументами, которая возвращает тип.
# 
::done_testing; }; subtest 'make_arg ($pkg)' => sub { 
BEGIN {
	Aion::Type->new(name=>"Len", test => sub {
		$Aion::Type::SELF->{args}[0] <= length($_) && length($_) <= $Aion::Type::SELF->{args}[1]
	})->make_arg(__PACKAGE__, 1);
}

local ($::_g0 = do {"IX" ~~ Len[2,2]}, $::_e0 = "1"); ::ok $::_g0 eq $::_e0, '"IX" ~~ Len[2,2] # => 1' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;

# 
# Если подпрограмма не может быть создана, то выбрасывается исключение.
# 

::like scalar do {eval { Aion::Type->new(name=>"Rim")->make_arg }; $@}, qr{syntax error}, 'eval { Aion::Type->new(name=>"Rim")->make_arg }; $@ # ~> syntax error'; undef $::_g0; undef $::_e0;

# 
# ## make_maybe_arg ($pkg)
# 
# Создает подпрограмму с аргументами или без.
# 
::done_testing; }; subtest 'make_maybe_arg ($pkg)' => sub { 
BEGIN {
	Aion::Type->new(
		name => "Enum123",

t/aion/type.t  view on Meta::CPAN

}

local ($::_g0 = do {3 ~~ Enum123}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '3 ~~ Enum123        # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {3 ~~ Enum123[4,5,6]}, $::_e0 = do {""}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '3 ~~ Enum123[4,5,6] # -> ""' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {5 ~~ Enum123[4,5,6]}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '5 ~~ Enum123[4,5,6] # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;

# 
# Если подпрограмма не может быть создана, то выбрасывается исключение.
# 

::like scalar do {eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@}, qr{syntax error}, 'eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@ # ~> syntax error'; undef $::_g0; undef $::_e0;

# 
# ## args ()
# 
# Список аргументов.
# 
# ## name ()
# 
# Имя типа.
# 



( run in 1.611 second using v1.01-cache-2.11-cpan-4ac696b4eb4 )