view release on metacpan or search on metacpan
i18n/Aion/Types.ru-en.po view on Meta::CPAN
msgid "ТолÑко `undef`."
msgstr "Only `undef`."
msgid "ÐÑÑ Ð·Ð° иÑклÑÑением `undef`."
msgstr "Everything except `undef`."
msgid "ÐпÑеделÑннÑе знаÑÐµÐ½Ð¸Ñ Ð±ÐµÐ· ÑÑÑлок."
msgstr "Defined values without references."
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."
lib/Aion/Meta/Util.pm view on Meta::CPAN
if(ref $v eq 'Regexp') {
$v = "$v";
$v =~ s{^\(\?\^?([a-z]*):(.*)\)$}{qr/$2/$1}si;
}
else {
$v = overload::Overloaded($v) && !overload::Method($v, '""')
? join("#", Scalar::Util::reftype($v), Scalar::Util::refaddr($v))
: "$v";
}
$v = substr($v, 0, MAX_SCALAR_LENGTH) . '...'
if length($v) > MAX_SCALAR_LENGTH;
$no_str ? $v : "'${\ $v =~ s/['\\]/\\$&/gr }'"
}
}
1;
__END__
=encoding utf-8
lib/Aion/Type.md view on Meta::CPAN
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
lib/Aion/Type.pm view on Meta::CPAN
sub is_exclude { shift->{name} eq 'Exclude' }
sub is_enum { shift->{name} eq 'Enum' }
sub is_range_type { exists $range_lbound{Scalar::Util::refaddr shift->{coerce}} }
sub range_lbound { $range_lbound{Scalar::Util::refaddr shift->{coerce}} }
sub is_range { shift->range_lbound == '-Inf' }
# ФоÑмиÑÑÐµÑ ÐºÐ»ÑÑ Ñ Ð¾ÑÑоÑÑиÑованнÑми ÑипизиÑованнÑми паÑамеÑÑами
sub typed_sorted_args_key {
my ($self) = @_;
my $coerceaddr = Scalar::Util::refaddr $self->{coerce};
join "-", $coerceaddr, join(",", map { join ":", length($_), $_ } sort map $_->key, @{$self->{args}});
}
# ФоÑмиÑÑÐµÑ ÐºÐ»ÑÑ Ñ Ð¾ÑÑоÑÑиÑованнÑми неÑипизиÑованнÑми паÑамеÑÑами
sub sorted_args_key {
my ($self) = @_;
my $coerceaddr = Scalar::Util::refaddr $self->{coerce};
join "-", $coerceaddr, join(",", map { join ":", length($_), $_ } sort @{$self->{args}});
}
# ÐозвÑаÑÐ°ÐµÑ ÑникалÑнÑй клÑÑ Ð´Ð»Ñ Ñипа, иÑполÑзÑÑÑийÑÑ Ð² Ñ
еÑаÑ
и ÑÑавнениÑ
# Ðолжен бÑÑÑ Ð·Ð°Ð¼ÐµÐ½Ñн на ÑозданнÑе ÑипÑ
my %keyfn;
my $undefined = [];
sub key {
my ($self) = @_;
$self->{key} //= do {
my $coerceaddr = Scalar::Util::refaddr $self->{coerce};
my $keyfn = $keyfn{$coerceaddr};
$keyfn
? $keyfn->($self)
: join "-", $coerceaddr, exists $self->{args} && @{$self->{args}} || exists $self->{N} || exists $self->{M}
? join(",", map {
my $key = UNIVERSAL::isa($_, __PACKAGE__)? $_->key: "" . ($_ // $undefined);
join ":", length($key), $key
} @{$self->{args}})
: ();
};
}
# УÑÑанавливаеÑ/возвÑаÑÐ°ÐµÑ ÑÑнкÑÐ¸Ñ Ð¿Ð¾ÑÑÑÐ¾ÐµÐ½Ð¸Ñ ÐºÐ»ÑÑа Ð´Ð»Ñ Ñипа как клаÑÑа
sub keyfn {
my ($self, $fn) = @_;
if(@_>1) {
$keyfn{Scalar::Util::refaddr $self->{coerce}} = $fn;
lib/Aion/Type.pm view on Meta::CPAN
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)
lib/Aion/Types.pm view on Meta::CPAN
subtype "HasMethods[m...]", as &Like,
where { my $x = $_; all { $x->can($_) } ARGS };
subtype "Overload`[m...]", as &Like,
where { !!overload::Overloaded($_) }
awhere { my $x = $_; all { overload::Method($x, $_) } ARGS };
subtype "InstanceOf[class...]", as &Like, where { my $x = $_; all { $x->isa($_) } ARGS };
subtype "ConsumerOf[role...]", as &Like, where { my $x = $_; all { $x->DOES($_) } ARGS };
subtype "StrLike", as &Like, where { !blessed($_) or !!overload::Method($_, '""') };
subtype "Len[from, to?]", as &StrLike,
init_where { unshift @{&ARGS}, 0 if @{&ARGS} == 1; }
where { A <= length($_) && length($_) <= B };
subtype "NumLike", as &Num | &Object & Overload(["0+"]);
sub Opened($) { Aion::Type::Lim->from(ref $_[0] eq "ARRAY"? $_[0][0]: $_[0]) };
subtype "Range[from, to]", as &NumLike,
init_where {
SELF->{args}[0] = A->inc if UNIVERSAL::isa(A, 'Aion::Type::Lim');
SELF->{args}[1] = B->dec if UNIVERSAL::isa(B, 'Aion::Type::Lim');
}
where { A <= $_ && $_ <= B };
subtype "Float", as Range([-(POSIX::FLT_MAX), POSIX::FLT_MAX]);
lib/Aion/Types.pm view on Meta::CPAN
=head2 Value
Defined values without references.
3 ~~ Value # -> 1
\3 ~~ Value # -> ""
undef ~~ Value # -> ""
=head2 Len[from?, to]
Specifies a length value from C<from> or 0 to C<to>.
"1234" ~~ Len[3] # -> ""
"123" ~~ Len[3] # -> 1
"12" ~~ Len[3] # -> 1
"" ~~ Len[1, 2] # -> ""
"1" ~~ Len[1, 2] # -> 1
"12" ~~ Len[1, 2] # -> 1
"123" ~~ Len[1, 2] # -> ""
Len[3] <= Len[3] # -> 1
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion - поÑÑмодеÑниÑÑÑÐºÐ°Ñ Ð¾Ð±ÑекÑÐ½Ð°Ñ ÑиÑÑема Ð´Ð»Ñ Perl 5, ÑÐ°ÐºÐ°Ñ ÐºÐ°Ðº «Mouse», «Moose», «Moo», «Mo» и «M», но Ñ ÑлÑÑÑениÑми
#
# # VERSION
#
# 2.2
#
# # SYNOPSIS
#
t/aion/meta/feature-construct.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::FeatureConstruct - конÑÑÑÑкÑÐ¾Ñ Ð°ÐºÑеÑÑоÑа, пÑедикаÑа, иниÑиализаÑоÑа и оÑиÑÑиÑелÑ
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Meta::FeatureConstruct;
our $construct = Aion::Meta::FeatureConstruct->new('My::Package', 'my_feature');
t/aion/meta/feature.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::Feature - меÑаопиÑаÑÐµÐ»Ñ ÑиÑи
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Meta::Feature;
our $feature = Aion::Meta::Feature->new("My::Package", "my_feature" => (is => 'rw'));
t/aion/meta/requires-any-function.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::RequiresAnyFunction - опÑеделÑÐµÑ Ð»ÑбÑÑ ÑÑнкÑиÑ, коÑоÑÐ°Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° бÑÑÑ Ð² модÑле
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Meta::RequiresAnyFunction;
my $any_function = Aion::Meta::RequiresAnyFunction->new(
t/aion/meta/requires-feature.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::RequiresFeature - ÑÑебование ÑиÑи Ð´Ð»Ñ Ð¸Ð½ÑеÑÑейÑов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Types qw(Str);
use Aion::Meta::RequiresFeature;
use Aion::Meta::Feature;
t/aion/meta/subroutine.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::Subroutine - опиÑÑÐ²Ð°ÐµÑ ÑÑнкÑÐ¸Ñ Ñ ÑигнаÑÑÑой
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Types qw(Int);
use Aion::Meta::Subroutine;
t/aion/meta/util.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Meta::Util - вÑпомогаÑелÑнÑе ÑÑнкÑии Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð¼ÐµÑа-даннÑÑ
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
package My::Meta::Class {
use Aion::Meta::Util;
t/aion/pleroma.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Pleroma - конÑÐµÐ¹Ð½ÐµÑ Ñонов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Pleroma;
my $pleroma = Aion::Pleroma->new;
t/aion/type.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Type - клаÑÑ Ð²Ð°Ð»Ð¸Ð´Ð°ÑоÑов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Type;
use Aion::Types qw//;
t/aion/type.t view on Meta::CPAN
::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;
t/aion/type/lim.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
#
# Aion::Type::Lim - гÑаниÑа Ñо ÑмеÑением Ð´Ð»Ñ Ð¸Ð½ÑеÑвалов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Type::Lim;
local ($::_g0 = do {Aion::Type::Lim->from(5)}, $::_e0 = "Closed[5]"); ::ok $::_g0 eq $::_e0, 'Aion::Type::Lim->from(5) # => Closed[5]' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {Aion::Type::Lim->from(5)->inc}, $::_e0 = "Opened[5]"); ::ok $::_g0 eq $::_e0, 'Aion::Type::Lim->from(5)->inc # => Opened[5]' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
t/aion/types.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Types - библиоÑека ÑÑандаÑÑнÑÑ
валидаÑоÑов и ÑлÑÐ¶Ð¸Ñ Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð½Ð¾Ð²ÑÑ
валидаÑоÑов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Types;
BEGIN {