view release on metacpan or search on metacpan
i18n/Aion/Format.ru-en.po view on Meta::CPAN
msgstr "The constant is equal to one gibibyte."
msgid "ÐонÑÑанÑа Ñавна Ð¾Ð´Ð½Ð¾Ð¼Ñ Ð¼ÐµÐ±Ð¸Ð±Ð°Ð¹ÑÑ."
msgstr "The constant is equal to one mebibyte."
msgid "ÐонÑÑанÑа Ñавна Ð¾Ð´Ð½Ð¾Ð¼Ñ ÐºÐ¸Ð±Ð¸Ð±Ð°Ð¹ÑÑ."
msgstr "The constant is equal to one kibibyte."
msgid "ÐакÑималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° даннÑÑ
LongText mysql и mariadb.\n"
"L - large."
msgstr "Maximum length of LongText mysql and mariadb data.\n"
"L - large."
msgid "ÐакÑималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° даннÑÑ
MediumText mysql и mariadb.\n"
"M - medium."
msgstr "Maximum length of MediumText mysql and mariadb data.\n"
"M - medium."
msgid "ÐакÑималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° ÑекÑÑа даннÑÑ
mysql и mariadb.\n"
"R - regularity."
msgstr "Maximum text length of mysql and mariadb data.\n"
"R - regularity."
msgid "ÐакÑималÑÐ½Ð°Ñ Ð´Ð»Ð¸Ð½Ð° даннÑÑ
TinyText mysql и mariadb.\n"
"S - small."
msgstr "Maximum length of TinyText mysql and mariadb data.\n"
"S - small."
msgid "ÐÑеобÑазование в ÑÑÑÐ¾ÐºÑ Perl без инÑеÑполÑÑии."
msgstr "Convert to Perl string without interpolation."
msgid "ÐÑеобÑазование из ÑÑÑоки Perl без инÑеÑполÑÑии."
msgstr "Conversion from Perl string without interpolation."
msgid "â **GPLv3**"
msgstr "â **GPLv3**"
lib/Aion/Format.pm view on Meta::CPAN
"!\"#\$%&'()*+,./:;<=>?\@[\\]^`{|}~", # ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð¿ÑнкÑÑаÑии ASCII
" ", # пÑобел
(map chr, 0 .. 0x1F, 0x7F), # ÑпÑавлÑÑÑие ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ ASCII
# Ñимвол 152 (0x98) в cp1251 оÑÑÑÑÑÑвÑеÑ.
;
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð½Ð°ÑÑÑалÑное ÑиÑло в заданнÑÑ ÑиÑÑÐµÐ¼Ñ ÑÑиÑлениÑ
sub to_radix($;$) {
use bigint;
my ($n, $radix) = @_;
$radix //= 64;
die "to_radix: The number system $radix is too large. Use NS before " . (1 + length $CIF) if $radix > length $CIF;
$n+=0; $radix+=0;
my $x = "";
for(;;) {
my $cif_idx = $n % $radix;
my $cif = substr $CIF, $cif_idx, 1;
$x =~ s/^/$cif/;
last unless $n = int($n / $radix);
}
return $x;
}
# ÐаÑÑÐ¸Ñ Ð½Ð°ÑÑÑалÑное ÑиÑло в Ñказанной ÑиÑÑеме ÑÑиÑлениÑ
sub from_radix(@) {
use bigint;
my ($s, $radix) = @_;
$radix //= 64;
$radix+=0;
die "from_radix: The number system $radix is too large. Use NS before " . (1 + length $CIF) if $radix > length $CIF;
my $x = 0;
for my $ch (split "", $s) {
$x = $x*$radix + index $CIF, $ch;
}
return $x;
}
# ÐкÑÑглÑÐµÑ Ð´Ð¾ Ñказанного ÑазÑÑда ÑиÑла
sub round($;$) {
my ($x, $dec) = @_;
lib/Aion/Format.pm view on Meta::CPAN
return num(round($n)) . "b";
}
# ÐÑÑавлÑÐµÑ $n ÑиÑÑ Ð´Ð¾ и поÑле ÑоÑки: 10.11 = 10, 0.00012 = 0.00012, 1.2345 = 1.2, еÑли $n = 2
sub sround($;$) {
my ($number, $digits) = @_;
$digits //= 2;
my $num = sprintf("%.100f", $number);
$num =~ /^-?0?(\d*)\.(0*)[1-9]/;
return "" . round($num, $digits + length $2) if length($1) == 0;
my $k = $digits - length $1;
return "" . round($num, $k < 0? 0: $k);
}
# ÐибибайÑ
sub KiB() { 2**10 }
# ÐебибайÑ
sub MiB() { 2**20 }
# ÐибибайÑ
lib/Aion/Format.pm view on Meta::CPAN
MiB # -> 2**20
=head2 KiB ()
The constant is equal to one kibibyte.
KiB # -> 2**10
=head2 xxL ()
Maximum length of LongText mysql and mariadb data.
L - large.
xxL # -> 4*GiB-1
=head2 xxM ()
Maximum length of MediumText mysql and mariadb data.
M - medium.
xxM # -> 16*MiB-1
=head2 xxR ()
Maximum text length of mysql and mariadb data.
R - regularity.
xxR # -> 64*KiB-1
=head2 xxS ()
Maximum length of TinyText mysql and mariadb data.
S - small.
xxS # -> 255
=head2 to_str (;$scalar)
Convert to Perl string without interpolation.
to_str "a'\n" # => 'a\\'\n'
[map to_str, "a'\n"] # --> ["'a\\'\n'"]
lib/Aion/Format/Html.pm view on Meta::CPAN
my $re_proposal = qr/[.?!â¦]/;
my @S; # маÑÑив оÑкÑÑваÑÑиÑ
Ñегов [tag, '<tag ...>']
# ФÑнкÑÐ¸Ñ ÑикÑиÑÑÐµÑ ÑÑÑаниÑÑ Ð¸ ÑбÑаÑÑÐ²Ð°ÐµÑ ÑÑÑÑÑики
my $make_page = sub {
push @pages, join "", @page, map { "</$_->[0]>" } reverse @S;
$i_page = $c = $is_proposal = 0;
@page = map $_->[1], @S;
};
for(grep length, split m{(
<[a-z] [^<>]* >
| </ \s* [a-z]\w* \s* >
| &(?: [a-z]\w* | \# \d+ | \#x[0-9a-f]+ ) ;?
| \n # ÐбзаÑ
| $re_proposal+ # ÐÑедложение
| \b # Слово
)}xiu, $html) {
if(/^&/) {$c++} # html-Ñимвол
elsif(/^<\/\s*([a-z]\w*)/) { # закÑÑваÑÑий Ñег
my $tag = lc $1;
eval { out_tag @S, $tag };
next if $@;
# </p> пÑевÑаÑаем в <p></p>
$_ = "<p></p>" if $tag eq "p";
}
elsif(/^<([a-z]\w*)/) { in_tag @S, lc $1, $_ } # Ñег
else {$c += length} # ÑекÑÑ
push @page, $_; # накапливаем ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð² маÑÑиве @page
next if $c < $symbols_on_page; # ÑÑÑаниÑÑ Ð½Ðµ набÑали - Ñогда на next
$c_page = $c, $i_page = @page if !$i_page;
# ÐÑоÑмаÑÑиваем впеÑÑд пока не найдÑм гÑаниÑÑ Ð¸Ð»Ð¸ не доÑÑигнем огÑаниÑениÑ
if(/^\n/) { $make_page->() } # ÐбзаÑ
elsif(!$is_proposal && /^$re_proposal/) { $i_page = @page; $c_page = $c; $is_proposal = 1 }
elsif($c >= $max) {
# ÐÑли ÑледÑÑÑий за пÑедложением или Ñловом ÑÐ»ÐµÐ¼ÐµÐ½Ñ - пÑобелÑ, Ñо добавлÑем иÑ
к ÑÑÑаниÑе
$c_page -= length $page[$i_page++] if $page[$i_page] =~ /^\s/;
my @x = splice @page, $i_page;
$make_page->();
push @page, @x;
$c -= $c_page;
}
}
$make_page->() if @page;
# ÐÑли ÑÐ°Ð·Ð¼ÐµÑ Ð¿Ð¾Ñледней ÑÑÑаниÑÑ Ð¼ÐµÐ½ÑÑе Ñем 2/3, Ñо добавлÑем ÐµÑ Ðº пÑедпоÑледней
$pages[$#pages - 1] .= pop @pages if @pages > 1 and length($pages[$#pages]) < $symbols_on_page * 2 / 3;
#my $len = 0; $len += length for @pages;
#die "СÑммаÑнÑй ÑÐ°Ð·Ð¼ÐµÑ ÑÑÑÐ°Ð½Ð¸Ñ Ð½Ðµ изменилÑÑ: " . length($html) . " == $len pages=" . @pages . " ->\n\n$html" if $len == length $html;
my ($end1) = $html =~ m!([^<>\s]{1,13})\s*(</?\w[^<>]*>\s*)*$!a;
my ($end2) = $pages[$#pages] =~ m!([^<>\s]{1,13})\s*(</?\w[^<>]*>\s*)*$!a;
die "ÐонÑÑ ÑекÑÑа и поÑледней ÑÑÑаниÑÑ Ð½Ðµ ÑÑ
одÑÑÑÑ! `$end1` <> `$end2`" if $end1 ne $end2;
return @pages;
}
our %TAG2SPACE = (
"br" => "\n",
lib/Aion/Format/Url.pm view on Meta::CPAN
join "&", @R
}
# ÐпÑеделÑÐµÑ ÐºÐ¾Ð´Ð¸ÑовкÑ. Ð koi8-r и в cp1251 болÑÑие и малÑе бÑÐºÐ²Ñ ÐºÐ°Ðº Ð±Ñ Ð¿Ð¾Ð¼ÐµÐ½ÑлиÑÑ Ð¼ÐµÑÑами, поÑÑÐ¾Ð¼Ñ Ñ Ð¿ÑавилÑной кодиÑовки Ð²ÐµÑ Ð±ÑÐ´ÐµÑ Ð±Ð¾Ð»ÑÑе
sub _bohemy {
my ($s) = @_;
my $c = 0;
while($s =~ /[а-ÑÑ]+/gi) {
my $x = $&;
if($x =~ /^[Ð-ЯÐа-ÑÑ][а-ÑÑ]*$/) { $c += length $x } else { $c -= length $x }
}
$c
}
sub from_url_param(;$) {
my ($param) = @_ == 0? $_: @_;
utf8::encode($param) if utf8::is_utf8($param);
{
lib/Aion/Format/Url.pm view on Meta::CPAN
$link{path} = "/";
} else { delete $link{path} }
$link{orig} = $orig;
$link{onpage} = $onpage;
$link{link} = join "", $link{proto}, "://",
exists $link{user} || exists $link{pass}? ($link{user},
exists $link{pass}? ":$link{pass}": (), '@'): (),
$link{dom},
$link{path},
length($link{query})? ("?", $link{query}): (),
length($link{hash})? ("#", $link{hash}): (),
;
return \%link;
}
# ÐоÑмализÑÐµÑ url
sub normalize_url($;$$) {
parse_url($_[0], $_[1], $_[2])->{link}
}
t/aion/format.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::Format - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п.
#
# # VERSION
#
# 0.1.1
#
# # SYNOPSIS
#
t/aion/format/html.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::Format::Html - библиоÑека Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ HTML
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Html;
local ($::_g0 = do {from_html "<b>!</b>"}, $::_e0 = "!"); ::ok $::_g0 eq $::_e0, 'from_html "<b>!</b>" # => !' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
t/aion/format/json.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::Format::Json - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ JSON
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Json;
local ($::_g0 = do {to_json {a => 10}}, $::_e0 = "{\n \"a\": 10\n}\n"); ::ok $::_g0 eq $::_e0, 'to_json {a => 10} # => {\n "a": 10\n}\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
t/aion/format/url.pm 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...
#
# use common::sense;
#
# use List::Util qw//;
# use Encode qw//;
#
# use Exporter qw/import/;
# our @EXPORT = our @EXPORT_OK = grep {
# ref \$Aion::Format::Url::{$_} eq "GLOB"
# && *{$Aion::Format::Url::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
t/aion/format/url.pm view on Meta::CPAN
#
# join "&", @R
# }
#
# # ÐпÑеделÑÐµÑ ÐºÐ¾Ð´Ð¸ÑовкÑ. Ð koi8-r и в cp1251 болÑÑие и малÑе бÑÐºÐ²Ñ ÐºÐ°Ðº Ð±Ñ Ð¿Ð¾Ð¼ÐµÐ½ÑлиÑÑ Ð¼ÐµÑÑами, поÑÑÐ¾Ð¼Ñ Ñ Ð¿ÑавилÑной кодиÑовки Ð²ÐµÑ Ð±ÑÐ´ÐµÑ Ð±Ð¾Ð»ÑÑе
# sub _bohemy {
# my ($s) = @_;
# my $c = 0;
# while($s =~ /[а-ÑÑ]+/gi) {
# my $x = $&;
# if($x =~ /^[Ð-ЯÐа-ÑÑ][а-ÑÑ]*$/) { $c += length $x } else { $c -= length $x }
# }
# $c
# }
#
# sub from_url_param(;$) {
# my ($param) = @_ == 0? $_: @_;
#
# utf8::encode($param) if utf8::is_utf8($param);
#
# {
t/aion/format/url.pm view on Meta::CPAN
# $link{path} = "/";
# } else { delete $link{path} }
#
# $link{orig} = $orig;
# $link{onpage} = $onpage;
# $link{link} = join "", $link{proto}, "://",
# exists $link{user} || exists $link{pass}? ($link{user},
# exists $link{pass}? ":$link{pass}": (), '@'): (),
# $link{dom},
# $link{path},
# length($link{query})? ("?", $link{query}): (),
# length($link{hash})? ("#", $link{hash}): (),
# ;
#
# return \%link;
# }
#
# # ÐоÑмализÑÐµÑ url
# sub normalize_url($;$$) {
# parse_url($_[0], $_[1], $_[2])->{link}
# }
#
t/aion/format/url.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::Format::Url - ÑÑилиÑÑ Ð´Ð»Ñ ÐºÐ¾Ð´Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¸ декодиÑÐ¾Ð²Ð°Ð½Ð¸Ñ URL-адÑеÑов
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Url;
local ($::_g0 = do {to_url_params {a => 1, b => [[1,2],3,{x=>10}]}}, $::_e0 = "a&b[][]&b[][1]=2&b[1]=3&b[2][x]=10"); ::ok $::_g0 eq $::_e0, 'to_url_params {a => 1, b => [[1,2],3,{x=>10}]} # => a&b[][]&b[][1]=2&b[1]=3&b[2][x]=10' or ::diag ::_string_d...
t/aion/format/yaml.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::Format::Yaml - конвеÑÑÐµÑ Ð¸Ð·/в yaml
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Yaml qw/from_yaml to_yaml/;
local ($::_g0 = do {to_yaml {foo => 'bar'}}, $::_e0 = do {"foo: bar\n"}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'to_yaml {foo => \'bar\'} # -> "foo: bar\n"' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;