Aion-Format

 view release on metacpan or  search on metacpan

lib/Aion/Format.pm  view on Meta::CPAN

no strict; no warnings; no diagnostics;
use common::sense;

our $VERSION = "0.1.0";

require POSIX;
require Term::ANSIColor;

use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
	*{$Aion::Format::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} keys %Aion::Format::;


#@category Вывод структур

use DDP qw//;

sub _extends_ddp_properties {
	my ($properties) = @_;
	+{

lib/Aion/Format/Html.pm  view on Meta::CPAN

package Aion::Format::Html;

use common::sense;

use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
	*{$Aion::Format::Html::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} keys %Aion::Format::Html::;

# Экранирует символы html
my %HTML_SIM = (qw/< &lt; > &gt; & &amp; \' &apos; " &quot;/, "\n" => '<br>', "\t" => '&emsp;');
sub to_html (;$) {
	my ($s) = @_? @_: $_;
	$s =~ s/[<>&\'\"]/$HTML_SIM{$&}/ge;
	$s
}

lib/Aion/Format/Json.pm  view on Meta::CPAN

package Aion::Format::Json;

use common::sense;
use JSON::XS qw//;

use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
    *{$Aion::Format::Json::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} keys %Aion::Format::Json::;

#@category json

# Настраиваем json
our $JSON = JSON::XS->new->allow_nonref->indent(1)->space_after(1)->canonical(1);

# Ð’ json
sub to_json(;$) {
	$JSON->encode(@_ == 0? $_: @_)

lib/Aion/Format/Url.pm  view on Meta::CPAN

package Aion::Format::Url;

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
} keys %Aion::Format::Url::;


#@category escape url

use constant UNSAFE_RFC3986 => qr/[^A-Za-z0-9\-\._~]/;

# Эскейпит значение
sub to_url_param(;$) {
	my ($param) = @_ == 0? $_: @_;

lib/Aion/Format/Yaml.pm  view on Meta::CPAN

package Aion::Format::Yaml;

use common::sense;
use YAML::Syck qw//;

use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
    *{$Aion::Format::Yaml::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} keys %Aion::Format::Yaml::;

#@category yaml

# Настраиваем yaml
$YAML::Syck::Headless = 1;
$YAML::Syck::SortKeys = 1;
$YAML::Syck::ImplicitTyping = 1;
$YAML::Syck::ImplicitUnicode = 1;
$YAML::Syck::ImplicitBinary = 1;

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
# } keys %Aion::Format::Url::;
# 
# 
# #@category escape url
# 
# use constant UNSAFE_RFC3986 => qr/[^A-Za-z0-9\-\._~]/;
# 
# # Эскейпит значение
# sub to_url_param(;$) {
# 	my ($param) = @_ == 0? $_: @_;



( run in 0.823 second using v1.01-cache-2.11-cpan-30a0b3e4e11 )