Group
Extension

Matches 4

MooseX-Attribute-Deflator ( P/PE/PERLER/MooseX-Attribute-Deflator-2.2.2.tar.gz, PERLER, 2012; MetaCPAN )
MooseX-Attribute-Deflator/README.pod ( view source; MetaCPAN )
 Loading L<MooseX::Attribute::Deflator::Moose>
will cause HashRefs and ArrayRefs to be encoded as JSON strings. However, you can simply overwrite
those deflators (and inflators) to deflate to somethin
C<benchmark.pl> tests three ways of deflating the value of a HashRef attribute
to a json encoded string (using L<JSON>).

 my $obj     = MyBenchmark->new( hashref => { foo => 'bar' } );
 my $attr    =
ate($obj); 

Using the deflate attribute method, supplied by this module.

=item accessor

 JSON::encode_json($obj->hashref);

If the attribute comes with an accessor, you can use this
method, to defl
MooseX-Attribute-Deflator ( P/PE/PERLER/MooseX-Attribute-Deflator-2.2.2.tar.gz, PERLER, 2012; MetaCPAN )
MooseX-Attribute-Deflator/lib/MooseX/Attribute/Deflator/Moose.pm ( view source; MetaCPAN )
eX::Attribute::Deflator;
use JSON;

if($ENV{HARNESS_ACTIVE}) {
    deflate [qw(ArrayRef HashRef)], via { JSON->new->utf8->canonical->encode($_) },
        inline_as {'JSON->new->utf8->canonical->encod
ef)], via { JSON->new->utf8->canonical->decode($_) },
        inline_as {'JSON->new->utf8->canonical->decode($value)'};
} else {
    deflate [qw(ArrayRef HashRef)], via { JSON::encode_json($_) },
    
    inline_as {'JSON::encode_json($value)'};
    inflate [qw(ArrayRef HashRef)], via { JSON::decode_json($_) },
        inline_as {'JSON::decode_json($value)'};
}


deflate 'ScalarRef', via {$$_}, inl
MooseX-Attribute-Deflator ( P/PE/PERLER/MooseX-Attribute-Deflator-2.2.2.tar.gz, PERLER, 2012; MetaCPAN )
MooseX-Attribute-Deflator/lib/MooseX/Attribute/Deflator.pm ( view source; MetaCPAN )
 Loading L<MooseX::Attribute::Deflator::Moose>
will cause HashRefs and ArrayRefs to be encoded as JSON strings. However, you can simply overwrite
those deflators (and inflators) to deflate to somethin
C<benchmark.pl> tests three ways of deflating the value of a HashRef attribute
to a json encoded string (using L<JSON>).

 my $obj     = MyBenchmark->new( hashref => { foo => 'bar' } );
 my $attr    =
ate($obj); 

Using the deflate attribute method, supplied by this module.

=item accessor

 JSON::encode_json($obj->hashref);

If the attribute comes with an accessor, you can use this
method, to defl
MooseX-Attribute-Deflator ( P/PE/PERLER/MooseX-Attribute-Deflator-2.2.2.tar.gz, PERLER, 2012; MetaCPAN )
MooseX-Attribute-Deflator/benchmark.pl ( view source; MetaCPAN )
ware, licensed under:
#
#   The (three-clause) BSD License
#
package MyBenchmark;

use Moose;
use JSON;
use DateTime;

use MooseX::Attribute::Deflator::Moose;
use MooseX::Attribute::Deflator;

has has
flator'],
    default => sub { { foo => 'bar' } }
);

package main;
use strict;
use warnings;
use JSON;
use Benchmark qw(:all);

my $obj  = MyBenchmark->new;
my $attr = $obj->meta->get_attribute('hash
> sub {
            $attr->deflate($obj);
        },
        get_value => sub {
            JSON::encode_json( $attr->get_value( $obj, 'hashref' ) );
        },
        accessor => sub {
            m

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.