Aion-Format
view release on metacpan or search on metacpan
```
# DESCRIPTION
УÑилиÑÑ Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п.
# SUBROUTINES
## coloring ($format, @params)
РаÑкÑаÑÐ¸Ð²Ð°ÐµÑ ÑекÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ escape-поÑледоваÑелÑноÑÑей, а заÑем заменÑÐµÑ ÑоÑÐ¼Ð°Ñ Ð½Ð° `sprintf`. ÐÐ°Ð·Ð²Ð°Ð½Ð¸Ñ ÑвеÑов иÑполÑзÑÑÑÑÑ Ð¸Ð· модÑÐ»Ñ `Term::ANSIColor...
```perl
coloring "#{BOLD RED}###r %i", 6 # => \e[1;31m##\e[0m 6
```
## printcolor ($format, @params)
Ðак `coloring`, но пеÑаÑÐ°ÐµÑ Ð¾ÑÑоÑмаÑиÑованнÑÑ ÑÑÑÐ¾ÐºÑ Ð½Ð° ÑÑандаÑÑнÑй вÑвод.
## warncolor ($format, @params)
i18n/Aion/Format.ru-en.po view on Meta::CPAN
msgid "Aion::Format - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п."
msgstr "Aion::Format - a Perl extension for formatting numbers, coloring output, etc."
msgid "УÑилиÑÑ Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п."
msgstr "Utilities for formatting numbers, coloring output, etc."
msgid "РаÑкÑаÑÐ¸Ð²Ð°ÐµÑ ÑекÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ escape-поÑледоваÑелÑноÑÑей, а заÑем заменÑÐµÑ ÑоÑÐ¼Ð°Ñ Ð½Ð° `sprintf`. ÐÐ°Ð·Ð²Ð°Ð½Ð¸Ñ ÑвеÑов иÑполÑзÑÑÑÑÑ Ð¸Ð· модÑÐ»Ñ `Term::AN...
msgstr "Colorizes text using escape sequences and then replaces the format with `sprintf`. The color names are used from the `Term::ANSIColor` module. For **RESET** use `#r` or `#R`."
msgid "Ðак `coloring`, но пеÑаÑÐ°ÐµÑ Ð¾ÑÑоÑмаÑиÑованнÑÑ ÑÑÑÐ¾ÐºÑ Ð½Ð° ÑÑандаÑÑнÑй вÑвод."
msgstr "Like `coloring`, but prints the formatted string to standard output."
msgid "Ðак `coloring`, но пеÑаÑÐ°ÐµÑ Ð¾ÑÑоÑмаÑиÑованнÑÑ ÑÑÑÐ¾ÐºÑ Ð² `STDERR`."
msgstr "Like `coloring`, but prints the formatted string to `STDERR`."
msgid "ÐиÑÐµÑ Ð² STDOUT иÑполÑзÑÑ Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑÑнкÑÐ¸Ñ `coloring` и добавлÑÐµÑ Ð¿ÑеÑÐ¸ÐºÑ Ñ Ð´Ð°Ñой-вÑеменем."
msgstr "Writes to STDOUT using the `coloring` function for formatting and adds a date-time prefix."
lib/Aion/Format.md view on Meta::CPAN
```
# DESCRIPTION
УÑилиÑÑ Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п.
# SUBROUTINES
## coloring ($format, @params)
РаÑкÑаÑÐ¸Ð²Ð°ÐµÑ ÑекÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ escape-поÑледоваÑелÑноÑÑей, а заÑем заменÑÐµÑ ÑоÑÐ¼Ð°Ñ Ð½Ð° `sprintf`. ÐÐ°Ð·Ð²Ð°Ð½Ð¸Ñ ÑвеÑов иÑполÑзÑÑÑÑÑ Ð¸Ð· модÑÐ»Ñ `Term::ANSIColor...
```perl
coloring "#{BOLD RED}###r %i", 6 # => \e[1;31m##\e[0m 6
```
## printcolor ($format, @params)
Ðак `coloring`, но пеÑаÑÐ°ÐµÑ Ð¾ÑÑоÑмаÑиÑованнÑÑ ÑÑÑÐ¾ÐºÑ Ð½Ð° ÑÑандаÑÑнÑй вÑвод.
## warncolor ($format, @params)
lib/Aion/Format.pm view on Meta::CPAN
use DDP qw//;
sub _extends_ddp_properties {
my ($properties) = @_;
+{
colored => 1,
deparse => 1,
show_unicode => 1,
show_readonly => 1,
print_escapes => 1,
show_refcount => 1,
show_memsize => eval { require Devel::Size; 1 },
caller_info => 1,
#output => 'stdout',
unicode_charnames => 1,
%$properties,
class => {
expand => "all",
inherited => "all",
show_reftype => 1,
lib/Aion/Format.pm view on Meta::CPAN
local *STDOUT;
open STDOUT, '>:utf8', \my $f; my $guard = Guard::guard { close STDOUT };
$sub->();
undef $guard;
utf8::decode($f) unless utf8::is_utf8($f);
$f
}
#@category ЦвеÑ
# ÐолоÑизиÑÑÐµÑ ÑекÑÑ escape-поÑледоваÑелÑноÑÑÑми: coloring("#{BOLD RED}ya#{}100!#RESET"), а заÑем - заменÑÐµÑ ÑоÑÐ¼Ð°Ñ sprintf-ом
sub coloring(@) {
my $s = shift;
$s =~ s!#\{(?<x>[\w \t]*)\}|#(?<x>\w+)!
my $x = $+{x};
$x = "RESET" if $x ~~ [qw/r R/];
Term::ANSIColor::color($x)
!nge;
sprintf $s, @_
}
lib/Aion/Format.pm view on Meta::CPAN
trappout { printcolor "#red ⬠#r\n" } # => \e[31m ⬠\e[0m\n
=head1 DESCRIPTION
Utilities for formatting numbers, coloring output, etc.
=head1 SUBROUTINES
=head2 coloring ($format, @params)
Colorizes text using escape sequences and then replaces the format with C<sprintf>. The color names are used from the C<Term::ANSIColor> module. For B<RESET> use C<#r> or C<#R>.
coloring "#{BOLD RED}###r %i", 6 # => \e[1;31m##\e[0m 6
=head2 printcolor ($format, @params)
Like C<coloring>, but prints the formatted string to standard output.
=head2 warncolor ($format, @params)
Like C<coloring>, but prints the formatted string to C<STDERR>.
lib/Aion/Format/Url.pm view on Meta::CPAN
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
} keys %Aion::Format::Url::;
#@category escape url
use constant UNSAFE_RFC3986 => qr/[^A-Za-z0-9\-\._~]/;
# ÐÑÐºÐµÐ¹Ð¿Ð¸Ñ Ð·Ð½Ð°Ñение
sub to_url_param(;$) {
my ($param) = @_ == 0? $_: @_;
use bytes;
$param =~ s/${\ UNSAFE_RFC3986}/$& eq " "? "+": sprintf "%%%02X", ord $&/ge;
$param
}
t/aion/format.t view on Meta::CPAN
#
# # DESCRIPTION
#
# УÑилиÑÑ Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑел, ÑаÑкÑаÑÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ñвода и Ñ.п.
#
# # SUBROUTINES
#
# ## coloring ($format, @params)
#
# РаÑкÑаÑÐ¸Ð²Ð°ÐµÑ ÑекÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ escape-поÑледоваÑелÑноÑÑей, а заÑем заменÑÐµÑ ÑоÑÐ¼Ð°Ñ Ð½Ð° `sprintf`. ÐÐ°Ð·Ð²Ð°Ð½Ð¸Ñ ÑвеÑов иÑполÑзÑÑÑÑÑ Ð¸Ð· модÑÐ»Ñ `Term::ANSICol...
#
::done_testing; }; subtest 'coloring ($format, @params)' => sub {
local ($::_g0 = do {coloring "#{BOLD RED}###r %i", 6}, $::_e0 = "\e[1;31m##\e[0m 6"); ::ok $::_g0 eq $::_e0, 'coloring "#{BOLD RED}###r %i", 6 # => \e[1;31m##\e[0m 6' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## printcolor ($format, @params)
#
# Ðак `coloring`, но пеÑаÑÐ°ÐµÑ Ð¾ÑÑоÑмаÑиÑованнÑÑ ÑÑÑÐ¾ÐºÑ Ð½Ð° ÑÑандаÑÑнÑй вÑвод.
#
# ## warncolor ($format, @params)
t/aion/format/url.pm view on Meta::CPAN
# 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
# } keys %Aion::Format::Url::;
#
#
# #@category escape url
#
# use constant UNSAFE_RFC3986 => qr/[^A-Za-z0-9\-\._~]/;
#
# # ÐÑÐºÐµÐ¹Ð¿Ð¸Ñ Ð·Ð½Ð°Ñение
# sub to_url_param(;$) {
# my ($param) = @_ == 0? $_: @_;
# use bytes;
# $param =~ s/${\ UNSAFE_RFC3986}/$& eq " "? "+": sprintf "%%%02X", ord $&/ge;
# $param
# }
( run in 2.542 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )