view release on metacpan or search on metacpan
```
Файл lib/Role/Values/Stringify.pm:
```perl
package Role::Values::Stringify;
use Aion -role;
sub valsify {
my ($self) = @_;
join ", ", map $self->{$_}, sort keys %$self;
}
1;
```
Файл lib/Class/All/Stringify.pm:
```perl
package Class::All::Stringify;
use Aion;
lib/Aion.md view on Meta::CPAN
```
Файл lib/Role/Values/Stringify.pm:
```perl
package Role::Values::Stringify;
use Aion -role;
sub valsify {
my ($self) = @_;
join ", ", map $self->{$_}, sort keys %$self;
}
1;
```
Файл lib/Class/All/Stringify.pm:
```perl
package Class::All::Stringify;
use Aion;
lib/Aion.pm view on Meta::CPAN
local $" = ", ";
die "@fakekeys is'nt features!"
}
return $self;
}
}
END
my @destroyers;
my $initializers = join "", map {
push @destroyers, $_->{construct}->destroyer if $_->{cleaner};
$_->{construct}->initializer
} sort { $a->{order} <=> $b->{order} } values %$FEATURE;
my %var = (
cls => $cls,
initializers => $initializers,
);
$new =~ s/%\((\w+)\)s/$var{$1}/ge;
lib/Aion.pm view on Meta::CPAN
1;
File lib/Role/Values/Stringify.pm:
package Role::Values::Stringify;
use Aion -role;
sub valsify {
my ($self) = @_;
join ", ", map $self->{$_}, sort keys %$self;
}
1;
File lib/Class/All/Stringify.pm:
package Class::All::Stringify;
use Aion;
lib/Aion/Meta/Feature.pm view on Meta::CPAN
package Aion::Meta::Feature;
use common::sense;
use Aion::Meta::Util qw//;
use Aion::Meta::FeatureConstruct;
use List::Util qw/pairmap/;
Aion::Meta::Util::create_getters(qw/pkg name opt has construct order/);
Aion::Meta::Util::create_accessors(qw/
required excessive isa
lazy builder default trigger release cleaner
make_reader make_writer make_predicate make_clearer
/);
# ÐонÑÑÑÑкÑоÑ
sub new {
lib/Aion/Meta/Feature.pm view on Meta::CPAN
has => \@has,
construct => Aion::Meta::FeatureConstruct->new($pkg, $name),
order => scalar keys %{$meta->{feature}},
stash => {},
}, ref $cls || $cls;
}
# СÑÑоковое пÑедÑÑавление ÑиÑи
sub stringify {
my ($self) = @_;
my $has = join ', ', pairmap { "$a => ${\
Aion::Meta::Util::val_to_str($b)
}" } @{$self->{has}};
return "has $self->{name} => ($has) of $self->{pkg}";
}
# СоздаÑÑ ÑвойÑÑво
sub mk_property {
my ($self) = @_;
my $meta = $Aion::META{$self->pkg};
lib/Aion/Meta/RequiresFeature.pm view on Meta::CPAN
package Aion::Meta::RequiresFeature;
use common::sense;
use Aion::Meta::Util qw//;
use List::Util qw/pairmap/;
use Scalar::Util qw/looks_like_number reftype blessed refaddr/;
Aion::Meta::Util::create_getters(qw/pkg name opt has/);
# ÐонÑÑÑÑкÑоÑ
sub new {
my ($cls, $pkg, $name, @has) = @_;
bless {pkg => $pkg, name => $name, opt => {@has}, has => \@has}, ref $cls || $cls;
}
# СÑÑоковое пÑедÑÑавление ÑиÑи
sub stringify {
my ($self) = @_;
my $has = join ', ', pairmap { "$a => ${\
Aion::Meta::Util::val_to_str($b)
}" } @{$self->{has}};
return "req $self->{name} => ($has) of $self->{pkg}";
}
# СÑÐ°Ð²Ð½Ð¸Ð²Ð°ÐµÑ Ñ ÑиÑей, но ÑолÑко знаÑÐµÐ½Ð¸Ñ ÐºÐ¾ÑоÑÑе еÑÑÑ Ð² ÑÑой
sub compare {
my ($self, $feature) = @_;
die "Requires ${\$self->stringify}" unless UNIVERSAL::isa($feature, 'Aion::Meta::Feature');
lib/Aion/Meta/Util.pm view on Meta::CPAN
sub val_to_str($;$);
sub val_to_str($;$) {
my ($v, $depth) = @_;
if (!defined $v) { 'undef' }
elsif (ref $v eq 'ARRAY') {
if($depth > MAX_DEPTH) { '[...]' }
else {
$depth++;
join '', '[', join(', ', map({ val_to_str($_, $depth) } (
@$v > MAX_ARRAY_SIZE ? @$v[0..MAX_ARRAY_SIZE] : @$v
)), @$v > MAX_ARRAY_SIZE ? '...' : ()), ']';
}
}
elsif (ref $v eq 'HASH') {
if($depth > MAX_DEPTH) { '{...}' }
else {
$depth++;
join '', '{', join(', ', map({
qq{$_ => ${\val_to_str($v->{$_}, $depth)}} } (
keys %$v > MAX_HASH_SIZE
? (sort keys %$v)[0..MAX_HASH_SIZE]
: sort keys %$v
)), keys %$v > MAX_HASH_SIZE ? '...' : ()), '}';
}
}
else {
my $no_str = ref $v || Scalar::Util::looks_like_number($v);
lib/Aion/Type.pm view on Meta::CPAN
# * me (Str) â ТолÑко Ð´Ð»Ñ Ñипа Me: Ð¿Ð°ÐºÐµÑ Ð² коÑоÑом он бÑл обÑÑвлен.
sub new {
my $cls = shift;
bless {@_}, $cls;
}
# СÑÑоковое пÑедÑÑавление
sub stringify {
my ($self) = @_;
my @args = map {
UNIVERSAL::isa($_, __PACKAGE__)?
$_->stringify:
Aion::Meta::Util::val_to_str($_)
} @{$self->{args}};
$self->{name} eq "Union"? join "", "( ", join(" | ", @args), " )":
$self->{name} eq "Intersection"? join "", "( ", join(" & ", @args), " )":
$self->{name} eq "Exclude"? (
@args == 1? join "", "~", @args:
join "", "~( ", join(" | ", @args), " )"
lib/Aion/Types.pm view on Meta::CPAN
grep { /^Isa\((.*)\)\z/s? do { _Isa($pkg, $referent, $1); 0 }: 1 } @attributes
}
sub _Isa {
my ($pkg, $referent, $data) = @_;
my $subname = Sub::Util::subname $referent;
$subname =~ s/^.*:://;
die "Anonymous subroutine cannot use :Isa!" if $subname eq '__ANON__';
my @signature = eval "package $pkg; map { UNIVERSAL::isa(\$_, 'Aion::Type')? \$_: __PACKAGE__->can(\$_)? __PACKAGE__->can(\$_)->(): Aion::Types::External([\$_]) } ($data)";
die if $@;
die "$pkg\::$subname has no return type!" if @signature == 0;
require Aion::Meta::Subroutine;
my $subroutine = Aion::Meta::Subroutine->new(
pkg => $pkg,
subname => $subname,
signature => \@signature,
referent => $referent,
lib/Aion/Types.pm view on Meta::CPAN
my $overload = $Aion::META{$pkg}{subroutine}{$subname};
$overload->compare($subroutine) if $overload;
$subroutine->wrap_sub;
}
}
BEGIN {
my $TRUE = sub {1};
my $INIT_ARGS = sub { @{&ARGS} = map External([$_]), @{&ARGS} };
my $INIT_KW_ARGS = sub { @{&ARGS} = List::Util::pairmap { $a => External([$b]) } @{&ARGS} };
# Создание Ñипа
sub subtype(@) {
my $subtype = shift;
my %o = @_;
my ($as, $init_where, $where, $awhere, $message) = delete @o{qw/as init_where where awhere message/};
$as = External([$as]) if defined $as;
lib/Aion/Types.pm view on Meta::CPAN
subtype "LValueRef", as &Ref, where { ref $_ eq "LVALUE" };
subtype "FormatRef", as &Ref, where { ref $_ eq "FORMAT" };
subtype "CodeRef", as &Ref, where { ref $_ eq "CODE" };
subtype "NamedCode[subname]", as &CodeRef, where { Sub::Util::subname($_) ~~ A };
subtype "ProtoCode[prototype]", as &CodeRef, where { Sub::Util::prototype($_) ~~ A };
subtype "ForwardRef", as &CodeRef, where { !subref_is_reachable($_) };
subtype "ImplementRef", as &CodeRef, where { subref_is_reachable($_) };
subtype "Isa[type...]", as &CodeRef,
init_where {
my $pkg = caller(2);
SELF->{args} = [ map { External([UNIVERSAL::isa($_, 'Aion::Type')? $_: $pkg->can($_)? $pkg->can($_)->(): $_]) } ARGS ]
}
where {
my $subroutine = $Aion::Isa{pack "J", refaddr $_} or return "";
my $signature = $subroutine->{signature};
my $args = ARGS;
return "" if @$signature != @$args;
my $i = 0;
for my $type (@$args) {
return "" unless $signature->[$i++] eq $type;
}
#@< EOF
#
# Файл lib/Role/Values/Stringify.pm:
#@> lib/Role/Values/Stringify.pm
#>> package Role::Values::Stringify;
#>>
#>> use Aion -role;
#>>
#>> sub valsify {
#>> my ($self) = @_;
#>> join ", ", map $self->{$_}, sort keys %$self;
#>> }
#>>
#>> 1;
#@< EOF
#
# Файл lib/Class/All/Stringify.pm:
#@> lib/Class/All/Stringify.pm
#>> package Class::All::Stringify;
#>>
#>> use Aion;
t/aion/meta/requires-feature.pm view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp 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; BEGIN { $SIG{__DIE__} = sub ...
#
# use common::sense;
#
# use Aion::Meta::Util qw//;
# use List::Util qw/pairmap/;
# use Scalar::Util qw/looks_like_number reftype blessed refaddr/;
#
# Aion::Meta::Util::create_getters(qw/pkg name opt has/);
#
# # ÐонÑÑÑÑкÑоÑ
# sub new {
# my ($cls, $pkg, $name, @has) = @_;
# bless {pkg => $pkg, name => $name, opt => {@has}, has => \@has}, ref $cls || $cls;
# }
#
# # СÑÑоковое пÑедÑÑавление ÑиÑи
# sub stringify {
# my ($self) = @_;
# my $has = join ', ', pairmap { "$a => ${\
# Aion::Meta::Util::val_to_str($b)
# }" } @{$self->{has}};
# return "req $self->{name} => ($has) of $self->{pkg}";
# }
#
# # СÑÐ°Ð²Ð½Ð¸Ð²Ð°ÐµÑ Ñ ÑиÑей, но ÑолÑко знаÑÐµÐ½Ð¸Ñ ÐºÐ¾ÑоÑÑе еÑÑÑ Ð² ÑÑой
# sub compare {
# my ($self, $feature) = @_;
#
# die "Requires $self" unless UNIVERSAL::isa($feature, 'Aion::Meta::Feature');