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.0.10";

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 {
	colored => 1,
	class => {
		expand => "all",
		inherited => "all",

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; \' &#39; " &quot;/;
sub to_html (@) {
	local $_ = join "", @_;
	s/[<>&\'\"]/$HTML_SIM{$&}/ge;
	$_
}

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 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? $_: @_;
	$param =~ s/${\ UNSAFE_RFC3986}/$& eq " "? "+": sprintf "%%%02X", ord $&/age;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 2.159 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )