Aion-Env

 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. It accepts a subroutine or object with the `${}` operator overloaded. In this case, the value will be passed to `$_`. If the object has a `validate` method, like `Aion...

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/Env/Etc.ru-en.po  view on Meta::CPAN

"* `key` – ключ из конфигурационных файлов. По умолчанию к нему преобразуется имя константы (переводится в нижний регистр и подчёрки заменя...
msgstr ""
"* `isa` – tester routine or `Aion::Type` object for type checking.\n"
"* `default` – default value.\n"
"* `key` – key from configuration files. By default, the name of the constant is converted to it (translated to lower case and underscores are replaced with dots)."

msgid "Считывает и парсит конфигурационный файл в формате `yaml`. `${ID}` заменяются на значения из `%ENV`, а если там нет, то из файла `.env`. Парсит файÐ...
msgstr "Reads and parses a configuration file in `yaml` format. `${ID}` are replaced with values from `%ENV`, and if not there, then from the `.env` file. Parses files in `include` recursively."

msgid "Обединяет два хеша рекурсивно. Если в совпадающих ключах не хеши, то выбрасывает ошибку с `$file` и `$path`, где `$file` – подключающийся файл, Ð...
msgstr "Concatenates two hashes recursively. If the matching keys do not have hashes, then it throws an error with `$file` and `$path`, where `$file` is the connecting file, and `$path` is the path from the keys through the dot."

msgid "Добавляет бэкслеши. Используется для эскейпинга энвиронментов."
msgstr "Adds backslashes. Used for escaping environments."

msgid "Получить значение по ключу из хеша."
msgstr "Get the value by key from the hash."

msgid "âš– **Perl5**"
msgstr "âš– **Perl5**"

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

	eval 'use Aion::Env NN_TEST => ()'; $@; # ^-> NN_TEST is'nt defined!
	eval 'use Aion::Env NN_TEST => (nouname => 1)'; $@; # ^-> Unknown aspect: nouname
	eval 'use Aion::Env NN_TEST => (nouname1 => 1, nouname2 => 2)'; $@; # ^-> Unknown aspects: nouname1, nouname2

=head1 DESCRIPTION

Projects use the C<.env> configuration file for project configuration, in C<Makefile>, for C<docker> and C<docker compose>. This module allows you to design environment variables as constants of C<perl> modules.

Constants are initialized from C<%ENV>, if there is no value there or it is C<undef>, then from the C<.env> file, and if it is not there, from the C<default> option.

When parsing a file, a syntax error will result in an exception.

The type of an environment variable can be checked using the C<isa> option. It accepts a subroutine or object with the C<${}> operator overloaded. In this case, the value will be passed to C<$_>. If the object has a C<validate> method, like C<Aion::T...

It is recommended to name environment variables using the name of the module in which it is declared. For example, the package is C<Aion::Type>, then the names of the environment variables in it are C<AION_TYPE_*>.

=head1 SUBROUTINES

=head2 import ($cls, $name, %kw)

Creates a constant with the name C<$name> in the package from which it is called.

lib/Aion/Env/Etc.pm  view on Meta::CPAN

=item * C<key> – key from configuration files. By default, the name of the constant is converted to it (translated to lower case and underscores are replaced with dots).

=back

=head2 parse ($path)

Reads and parses a configuration file in C<yaml> format. C<${ID}> are replaced with values from C<%ENV>, and if not there, then from the C<.env> file. Parses files in C<include> recursively.

=head2 merge_hashes ($file, $path, $x, $y)

Concatenates two hashes recursively. If the matching keys do not have hashes, then it throws an error with C<$file> and C<$path>, where C<$file> is the connecting file, and C<$path> is the path from the keys through the dot.

=head2 val ($s)

Adds backslashes. Used for escaping environments.

	my $escape_string = "\\\"\\'\\\\\\t\\r\\n";
	Aion::Env::Etc::val("\"'\\\t\r\n") # -> $escape_string

=head2 by_key ($hash, $path)



( run in 0.819 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )