Aion-Format
view release on metacpan or search on metacpan
```
## accesslog ($format, @params)
It write in STDOUT `coloring` returns with prefix datetime.
```perl
trappout { accesslog "#{green}ACCESS#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m 6\n
```
## errorlog ($format, @params)
It write in STDERR `coloring` returns with prefix datetime.
```perl
trapperr { errorlog "#{red}ERROR#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n
```
## flesch_index_human ($flesch_index)
Convert flesch index to russian label with step 10.
```perl
flesch_index_human -10 # => неÑвÑзнÑй ÑÑÑÑкий ÑекÑÑ
flesch_index_human -3 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
flesch_index_human 0 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
lib/Aion/Format.md view on Meta::CPAN
```
## accesslog ($format, @params)
It write in STDOUT `coloring` returns with prefix datetime.
```perl
trappout { accesslog "#{green}ACCESS#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m 6\n
```
## errorlog ($format, @params)
It write in STDERR `coloring` returns with prefix datetime.
```perl
trapperr { errorlog "#{red}ERROR#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n
```
## flesch_index_human ($flesch_index)
Convert flesch index to russian label with step 10.
```perl
flesch_index_human -10 # => неÑвÑзнÑй ÑÑÑÑкий ÑекÑÑ
flesch_index_human -3 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
flesch_index_human 0 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
lib/Aion/Format.pm view on Meta::CPAN
sub warncolor(@) {
print STDERR coloring @_
}
# ÐÐ»Ñ ÐºÑона: ÐиÑÐµÑ Ð² STDOUT
sub accesslog(@) {
print "[", POSIX::strftime("%F %T", localtime), "] ", coloring @_;
}
# ÐÐ»Ñ ÐºÑона: ÐиÑÐµÑ Ð² STDIN
sub errorlog(@) {
print STDERR "[", POSIX::strftime("%F %T", localtime), "] ", coloring @_;
}
#@category ÐÑеобÑазованиÑ
# ÐÑÐ¾Ð²Ð¾Ð´Ð¸Ñ ÑооÑвеÑÑÑвиÑ
#
# matches "...", qr/.../ => sub {...}, ...
#
lib/Aion/Format.pm view on Meta::CPAN
As C<coloring>, but print formatted string to C<STDERR>.
trapperr { warncolor "#{green}ACCESS#r %i\n", 6 } # => \e[32mACCESS\e[0m 6\n
=head2 accesslog ($format, @params)
It write in STDOUT C<coloring> returns with prefix datetime.
trappout { accesslog "#{green}ACCESS#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m 6\n
=head2 errorlog ($format, @params)
It write in STDERR C<coloring> returns with prefix datetime.
trapperr { errorlog "#{red}ERROR#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n
=head2 flesch_index_human ($flesch_index)
Convert flesch index to russian label with step 10.
flesch_index_human -10 # => неÑвÑзнÑй ÑÑÑÑкий ÑекÑÑ
flesch_index_human -3 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
flesch_index_human 0 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
flesch_index_human 1 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²
flesch_index_human 15 # => Ð´Ð»Ñ Ð¿ÑоÑеÑÑионалов
t/aion/format.t view on Meta::CPAN
#
# ## accesslog ($format, @params)
#
# It write in STDOUT `coloring` returns with prefix datetime.
#
done_testing; }; subtest 'accesslog ($format, @params)' => sub {
::like scalar do {trappout { accesslog "#{green}ACCESS#r %i\n", 6 }}, qr!\[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m 6\n!, 'trappout { accesslog "#{green}ACCESS#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[32mACCESS\e\[0m ...
#
# ## errorlog ($format, @params)
#
# It write in STDERR `coloring` returns with prefix datetime.
#
done_testing; }; subtest 'errorlog ($format, @params)' => sub {
::like scalar do {trapperr { errorlog "#{red}ERROR#r %i\n", 6 }}, qr!\[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n!, 'trapperr { errorlog "#{red}ERROR#r %i\n", 6 } # ~> \[\d{4}-\d{2}-\d{2} \d\d:\d\d:\d\d\] \e\[31mERROR\e\[0m 6\n';
#
# ## flesch_index_human ($flesch_index)
#
# Convert flesch index to russian label with step 10.
#
done_testing; }; subtest 'flesch_index_human ($flesch_index)' => sub {
::is scalar do {flesch_index_human -10}, "неÑвÑзнÑй ÑÑÑÑкий ÑекÑÑ", 'flesch_index_human -10 # => неÑвÑзнÑй ÑÑÑÑкий ÑекÑÑ';
::is scalar do {flesch_index_human -3}, "Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²", 'flesch_index_human -3 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²';
::is scalar do {flesch_index_human 0}, "Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²", 'flesch_index_human 0 # => Ð´Ð»Ñ Ð°ÐºÐ°Ð´ÐµÐ¼Ð¸ÐºÐ¾Ð²';
( run in 0.618 second using v1.01-cache-2.11-cpan-65fba6d93b7 )