cket;
use Data::Dumper;
use lib "./";
use plugin_eng;
use POE qw(Component::Server::TCP);
#use JSON::XS;
use Clone qw(clone);
use Encode;
our @rewrite_g;
our @rewrite_l;
our @rewrite_n;
our %re
!/usr/bin/perl
#词词距离计算
#输入为:
#老虎
#鲜花
#月亮
#狮子
use POSIX;
#use JSON::XS;
use Clone qw(clone);
use MongoDB;
use Smart::Comments;
use lib "/home/wyb/shell/";
#use
#!/usr/bin/perl
#use JSON::XS;
use Clone qw(clone);
use MongoDB;
use Smart::Comments;
use lib "/home/wuyabo/shell/";
use Conn_mongo_jc;
use Data::Dumper;
use IO::File;
#use Add_info;
open(FDst,"al
ActiveModel support for WebAPI::DBIC
=head2 Media Type
These roles respond to the C<application/json> media type.
(This is a very common 'default' media type for web data services.)
=head2 ActiveMo
le::JsonParams;
$WebAPI::DBIC::Role::JsonParams::VERSION = '0.004002';
use Moo::Role;
use Carp qw(croak);
use Hash::MultiValue;
use JSON::MaybeXS qw(JSON);
requires 'request';
my $json = JSON->n
# Note that this is transparent to duplicate query parameter names
# i.e., foo=7&foo=8&foo~json=9 will result in the same set of duplicate
# parameters as if the parameters were foo=7&foo=8
# parameter names with a ~json suffix have JSON encoded values
my $is_json;
(my $key_base = $key_raw) =~ s/~json$//
and $is_json = 1;
for my $v ($raw_para
'WebAPI::DBIC::Role::JsonEncoder',
'WebAPI::DBIC::Resource::Role::Router',
'WebAPI::DBIC::Resource::Role::DBICException',
# for application/hal+json
'WebAPI::DBIC::
IC::Role::JsonEncoder;
$WebAPI::DBIC::Role::JsonEncoder::VERSION = '0.004002';
use JSON::MaybeXS qw(JSON);
use Moo::Role;
has _json_encoder => (
is => 'ro',
builder => '_build_json_encoder',
handles => {
encode_json => 'encode',
decode_json => 'decode',
},
);
sub _build_json_encoder {
my $codec = JSON->new->ascii;
$codec->canonical->pretty if $ENV{WEBAPI_DBIC_D
ad1 NAME
WebAPI::DBIC::Role::JsonEncoder
=head1 VERSION
version 0.004002
=head1 NAME
WebAPI::DBIC::Resource::Role::JsonEncoder - provides encode_json and decode_json methods
=head1 AUTHOR
Tim B
cket;
use Data::Dumper;
use lib "./";
use plugin_eng;
use POE qw(Component::Server::TCP);
#use JSON::XS;
use Clone qw(clone);
use Encode;
our @rewrite_g;
our @rewrite_l;
our @rewrite_n;
our %re
ersion_ok new_version_ok);
use File::Find ();
use File::Spec;
use Encode ();
use HTTP::Tiny;
use JSON::MaybeXS ();
use version ();
use Module::Metadata;
use List::Util;
use CPAN::Meta 2.120920;
use T
my ($module_metadata, $pkg) = @_;
my $res = HTTP::Tiny->new->get("http://cpanidx.org/cpanidx/json/mod/$pkg");
return (0, 'index could not be queried?') if not $res->{success};
my $data =
$data = Encode::decode($charset, $data, Encode::FB_CROAK);
}
my $payload = JSON::MaybeXS::decode_json($data);
return (0, 'invalid payload returned') unless $payload;
return (1, 'no
#!/usr/bin/perl
use Algorithm::Kmeanspp;
#use JSON::XS;
use Clone qw(clone);
use MongoDB;
use Smart::Comments;
use lib "/home/wuyabo/shell/";
use Conn_mongo_jc;
use Data::Dumper;
use IO::File;
#us
ect;
use IO::Socket::INET;
use lib "./";
use plugin_eng;
use POE qw(Component::Server::TCP);
#use JSON::XS;
use Clone qw(clone);
use Encode;
#$tt=seg_txt("我的西瓜很大");
#print $tt."222222222
package Net::Semantics3::Products;
use Moose;
use methods;
use JSON::XS;
use Data::Dumper;
use Net::Semantics3::Error;
extends 'Net::Semantics3';
use constant MAX_LIMIT => 10;
=head1 NAME
Net::Se
( 'products' );
=head3 get_query_json( ENDPOINT )
Returns the JSON string of the constructed query for the specified endpoint.
my $productsJSON = get_query_json( 'products' );
=head3 get_resul
get_results( );
=head3 get_results_json( )
Returns the JSON string of the results from any previously executed query.
my $resultsJSONString = get_results_json( );
=head3 clear( )
Clears previ
del::Role::DBIC::VERSION = '0.004002';
use Carp qw(croak confess);
use Devel::Dwarn;
use JSON::MaybeXS qw(JSON);
use Moo::Role;
requires 'get_url_for_item_relationship';
requires 'render_item_as_p
key = ($self->param('distinct')) ? 'data' : $self->activemodel_type;
my $top_doc = { # http://jsonapi.org/format/#document-structure-top-level
$top_set_key => $set_data,
};
if (ke
SIS
my $st = Hash::Storage->new(
driver => [ OneFile => { serializer => 'JSON', file => '/tmp/t.json' } ]
);
# Store hash by id
$st->set( 'user1' => { name => 'Viktor',
=> 'JSON', file => '/tmp/t.json' } ]
);
$DRIVER - also can be a Hash::Storage driver object
my $drv = Hash::Storage::Driver::OneFile->new({ serializer => 'JSON', file => '/tmp/t.json' }
#!/usr/bin/perl
use JSON::XS;
use Encode;
use Data::Dumper;
use strict;
use warnings;
my $content = "这是一段中文内容";
print "转码前的内部表示:\n";
print Dumper $content, "\n";
pr
int "转码前的JSON:\n";
print JSON::XS->new->utf8->encode({
content => $content
}), "\n";
# 对内容做一次转码就可以正常输出JSON了
$content = decode("utf-8", $content);
print
"转码后的内部表示:\n";
print Dumper $content, "\n";
print "转码后的JSON:\n";
print JSON::XS->new->utf8->encode({
content => $content
}), "\n";
#!/usr/bin/perl
#use JSON::XS;
use Clone qw(clone);
use MongoDB;
use Smart::Comments;
use lib "/home/wuyabo/shell/";
use Conn_mongo_jc;
use Data::Dumper;
use IO::File;
#use Add_info;
open(FDst,"s
#!/usr/bin/perl
use POE qw(Component::Server::TCP);
#use JSON::XS;
use Clone qw(clone);
#use MongoDB;
#use Smart::Comments;
#use lib "/home/wuyabo/shell/";
#use Conn_mongo_jc;
use Data::Dumper;
#u
PSIS
my $st = Hash::Storage->new(
driver => [ OneFile => { serializer => 'JSON', file => '/tmp/t.json' } ]
);
# Store hash by id
$st->set( 'user1' => { name => 'Viktor', gend
r => 'JSON', file => '/tmp/t.json' } ]
);
$DRIVER - also can be a Hash::Storage driver object
my $drv = Hash::Storage::Driver::OneFile->new({ serializer => 'JSON', file => '/tmp/t.json' });
#!/usr/bin/perl
use Encode;
#use JSON::XS;
use Clone qw(clone);
use MongoDB;
use Smart::Comments;
use lib "/home/wuyabo/shell/";
use Conn_mongo_jc;
use Data::Dumper;
use IO::File;
#use Add_info;
ect;
use IO::Socket::INET;
use lib "./";
use plugin_eng;
use POE qw(Component::Server::TCP);
#use JSON::XS;
use Clone qw(clone);
use Encode;
#use MongoDB;
use Smart::Comments;
#use Conn_mongo_jc;