![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
mojo
mojo
优惠券已抵扣
余额抵扣
还需支付
¥39.90
¥99.00
购买须知?
本专栏为图文内容,最终完结不会低于15篇文章。
订阅专栏,享有专栏所有文章阅读权限。
本专栏为虚拟商品,基于网络商品和虚拟商品的性质和特征,专栏一经购买无正当理由不予退款,不支持升级,敬请谅解。
scan724
这个作者很懒,什么都没留下…
展开
-
接口返回json
use Mojolicious::Lite;use JSON qw/encode_json decode_json/; # /foo?user=sri get '/api' => sub { my $c = shift; my $env = $c->param('env'); if ($env){ use DBI;my原创 2016-03-25 13:41:21 · 727 阅读 · 0 评论 -
测试关闭mojo utf-8
[root@wx03 ~]# cat test.pl use Mojolicious::Lite;use JSON qw/encode_json decode_json/; use Encode;no strict;use JSON; use Data::Dumper;no utf8;# /foo?user=sri get '/admin/api/menu' => sub {原创 2016-06-30 20:11:28 · 446 阅读 · 0 评论 -
perl 定义post接口
use Mojolicious::Lite;use JSON qw/encode_json decode_json/; use Encode;no strict;use JSON; use Data::Dumper;#no utf8;# /foo?user=sri post '/admin/api/menu' => sub { my $c = shift;原创 2016-07-01 10:59:02 · 577 阅读 · 0 评论 -
utf8字节
[root@wx03 0724]# perl a1.pl 112[root@wx03 0724]# perl a1.pl dawe^H^H微信addasuccess[root@wx03 0724]# perl a1.pl 22微信3131 success[root@wx03 0724]# [root@wx03 0724]# cat a1.pl my $a=;my $b='微原创 2016-07-24 13:18:35 · 424 阅读 · 0 评论 -
use utf8
[root@wx03 0724]# cat a2.pl use Encode;my $a=;my $b=encode_utf8('微信');print "\$b is $b\n";if ($a =~/$b/){print "success\n";};[root@wx03 0724]# perl a2.pl 23微信2231$b is 微信[root@wx03 0724原创 2016-07-24 13:43:47 · 420 阅读 · 1 评论 -
Mojo Mysql utf-8字符集 需要{mysql_enable_utf8 => 1}
get '/api/log_mon/get_log' => sub{ my $c = shift; my $env = $c->param('env'); my $host = $c->param('host'); use DBI;my $dbUser='DEVOPS'; my $user="root"; my $passwd="1234567"; my @a原创 2016-06-17 12:36:58 · 733 阅读 · 0 评论 -
Mojo 分析日志接口
#!/usr/bin/perl#取文件行数##循环开始清空文件use POSIX;use DBI;my $dir = '/data01/applog_backup';my $file = "$ARGV[0]";my $SDATE = strftime("%Y-%m-%d",localtime());my $XDATE = strftime("%Y%m%d%H%M%S",local原创 2016-06-17 14:26:21 · 500 阅读 · 0 评论 -
perl 定义post接口
[root@wx03 mojo]# cat a1.pl use Digest::MD5;my $md5 = Digest::MD5->new;$md5->add(1234567);print $md5->hexdigest."\n";[root@wx03 mojo]# perl a1.pl fcea920f7412b5da7be0cf42b8c93759[root@wx03 mo原创 2016-10-21 12:41:57 · 903 阅读 · 0 评论 -
mojo 关闭utf8
[root@wx03 ~]# cat test.pl use Mojolicious::Lite;use JSON qw/encode_json decode_json/; use Encode;no strict;use JSON; use Data::Dumper;#no utf8;# /foo?user=sri get '/admin/api/menu' => sub原创 2016-06-30 19:58:50 · 346 阅读 · 0 评论 -
mojo 默认启用utf-8
[root@dr-mysql01 ~]# cat f1.pl use Encode;print "验证111\n";my $d=encode_utf8('验证');print $d;print "\n";[root@dr-mysql01 ~]# perl f1.pl 验证111éªè¯ [root@dr-mysql01 ~]# mojo 默认开始utf-8 my原创 2016-06-30 19:24:49 · 467 阅读 · 0 评论 -
MojoliciousLite: 实时的web框架 概述
MojoliciousLite: 实时的web框架:SYNOPSIS 简介: # Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features use Mojolicious::Lite; # Route with placeholder get '/api原创 2016-03-25 15:54:50 · 953 阅读 · 0 评论 -
perl 解json数组
http://115.236.160.82:3000/api/bus?bus=307&flag=1返回json是: 其实就是数组的引用编码成json["","黄龙体育中心","教工路花园亭","花园新村","浙江工商大学","保亭巷","教工路塘河路口","大关桥西","长乐路","二纺机总厂","沈塘湾","善贤社区","善贤坝","皋亭坝","李王桥","袁家村","张家园","杭玻原创 2016-03-25 20:26:51 · 825 阅读 · 0 评论 -
mojo 接口示例
use Mojolicious::Lite;use JSON qw/encode_json decode_json/; use Encode;no strict;# /foo?user=sri get '/api/env' => sub { my $c = shift; my $env = $c->param('env'); if ($原创 2016-03-25 16:58:56 · 1411 阅读 · 0 评论 -
perl 使用use utf8
jrhapt12:/home/tomcat> cat a1.pluse Encode;$phone='18072722237';open (LOG1 ,"<",'/usr/local/apache-tomcat-7.0.55_8082/logs/catalina.out') or die $!; while () { #2016-03-0原创 2016-05-01 09:47:22 · 924 阅读 · 0 评论 -
mojo 默认use utf8;
my $endtime=strftime("%Y%m%d%H%M%S",localtime()); my $d=encode_utf8('验证'); if ($a3 =~/$d/){ #$msg->reply("\@$friend $a1-$a3-$a4"); $a3=decode_utf8("$a3"); ##encode("utf8",decode("gbk","格式为:中均原创 2016-05-03 09:02:04 · 460 阅读 · 0 评论 -
mojo 接口返回键值对的json格式
my $c = shift;use DBI;my %hash=(); my $dbUser='zabbix'; my $user="root"; my $passwd="1234567"; my $dbh = DBI->connect("dbi:mysql:database=$dbUser;host=192.168.32.xx;port=3306",$user,$passwd)原创 2016-05-03 12:55:19 · 564 阅读 · 0 评论 -
zabbix 添加主机接口
http://192.168.32.101:3000/api/zabbix/add_Host?env=test&host=zjtest9-app&ip=192.168.32.250&groupid=11&templateid=10001 my $c = shift; my $env = $c->param('env'); my $host = $c->param('host'); m原创 2016-05-03 16:15:05 · 2579 阅读 · 0 评论 -
Mojo 返回一维和二维数组
这种情况不断的网数组@arr2里放入数据,返回的内容为:这种情况是一维数组:while( $selStmt->fetch() ){print "\$a1 is $a1\n";print "\$a2 is $a2\n";print "\$a3 is $a3\n";push (@arr2, "$a1 $a2 $a3" ); }; $c->render(json => \原创 2016-05-04 15:46:30 · 370 阅读 · 0 评论 -
Mojo 自动发布接口
get '/api/auto_publish/publish' => sub{ my $c = shift; my $env = $c->param('env'); my $app = $c->param('app'); my $ip = $c->param('ip'); my $stderr=""; my $stdout=""; my $XDATE = strftime("%Y%m原创 2016-05-05 09:31:37 · 529 阅读 · 0 评论