perl mojo 编码
来源:互联网 发布:类似sketch windows 编辑:程序博客网 时间:2024/06/15 02:35
mojo 默认开启utf8;centos6.5:/root#cat t1.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 { my $c = shift; open (LOG1 ,"<",'11.out') or die $!; while (<LOG1>) { my $phone='18072722237'; #2016-03-09 09:35:12,380 INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:您的验证码为132435,本验证码5分钟内有效。 to phoneNo:18072722237 succeed! my $d='验证'; #my $d='验证'; if ( ($phone) and ($_ =~/$phone/) and ($_ =~/$d/) ){$str=$_; if ($_ =~ /([0-9]{4}-[0-9]{1,2}-[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}.*?)\s+(.*?Send message:)\s*(.*?)(to\s+phoneNo:\s*[0-9]{11}).*/){ $a1=$1; $a2=$2; $a3=$3; $a4=$4; print "\$a1 is $a1\n"; print "\$a2 is $a2\n"; print "\$a3 is $a3\n"; print "\$a4 is $a4\n"; }}; close LOG1; my $a=decode_utf8("测试更健康"); $c->render(text => "$a" ); }; }; app->start; centos6.5:/root#morbo t1.pl Server available at http://127.0.0.1:3000[Thu Mar 9 20:57:25 2017] [debug] GET "/admin/api/menu"[Thu Mar 9 20:57:25 2017] [debug] Routing to a callback$a1 is 2016-03-09 09:35:12,380$a2 is INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:$a3 is 您的验证码为132435,本验证码5分钟内有效。 $a4 is to phoneNo:18072722237[Thu Mar 9 20:57:25 2017] [debug] 200 OK (0.000969s, 1031.992/s)readline() on closed filehandle LOG1 at /root/t1.pl line 31. centos6.5:/root#curl http://127.0.0.1:3000/admin/api/menu测试更健康centos6.5:/root#curl http://127.0.0.1:3000/admin/api/menu测试更健康centos6.5:/root#开启utf8;centos6.5:/root#vim t1.pl use Mojolicious::Lite;use JSON qw/encode_json decode_json/;use Encode;no strict;use JSON;use Data::Dumper;# /foo?user=sri get '/admin/api/menu' => sub { my $c = shift; open (LOG1 ,"<",'11.out') or die $!; while (<LOG1>) { my $phone='18072722237'; #2016-03-09 09:35:12,380 INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:您的验证码为132435,本验证码5分钟内有效。 to phoneNo:18072722237 succeed! my $d='验证'; #my $d='验证'; if ( ($phone) and ($_ =~/$phone/) and ($_ =~/$d/) ){$str=$_; if ($_ =~ /([0-9]{4}-[0-9]{1,2}-[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}.*?)\s+(.*?Send message:)\s*(.*?)(to\s+phoneNo:\s*[0-9]{11}).*/){ $a1=$1; $a2=$2; $a3=$3; $a4=$4; print "\$a1 is $a1\n"; print "\$a2 is $a2\n"; print "\$a3 is $a3\n"; print "\$a4 is $a4\n"; }}; close LOG1; my $a="测试更健康"; $c->render(text => "$a" );};}; app->start; centos6.5:/root#morbo t1.pl Server available at http://127.0.0.1:3000[Thu Mar 9 20:58:47 2017] [debug] GET "/admin/api/menu"[Thu Mar 9 20:58:47 2017] [debug] Routing to a callback[Thu Mar 9 20:58:47 2017] [debug] 200 OK (0.000981s, 1019.368/s)readline() on closed filehandle LOG1 at /root/t1.pl line 30.此时匹配不到/******************centos6.5:/root#cat t1.pl use Mojolicious::Lite; use JSON qw/encode_json decode_json/; use Encode; no strict; use JSON; use Data::Dumper; # /foo?user=sri get '/admin/api/menu' => sub { my $c = shift; open (LOG1 ,"<",'11.out') or die $!; while (<LOG1>) { my $phone='18072722237'; #2016-03-09 09:35:12,380 INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:您的验证码为132435,本验证码5分钟内有效。 to phoneNo:18072722237 succeed! my $d=encode_utf8('验证'); #my $d='验证'; if ( ($phone) and ($_ =~/$phone/) and ($_ =~/$d/) ){$str=$_; if ($_ =~ /([0-9]{4}-[0-9]{1,2}-[0-9]{2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}.*?)\s+(.*?Send message:)\s*(.*?)(to\s+phoneNo:\s*[0-9]{11}).*/){ $a1=$1; $a2=$2; $a3=$3; $a4=$4; print "\$a1 is $a1\n"; print "\$a2 is $a2\n"; print "\$a3 is $a3\n"; print "\$a4 is $a4\n"; }}; close LOG1; my $a="测试更健康"; $c->render(text => "$a" ); }; }; app->start; 此时可以匹配
0 0
- perl mojo 编码
- perl mojo 短信接口自动识别编码
- perl mojo 处理文本
- mojo 编码处理
- 基于Mojo的perl爬虫
- perl mojo use utf8 和no utf8
- Perl中的编码问题
- perl编码转换
- perl 编码转换
- perl编码转换
- perl编码详解
- perl字符编码转化
- perl 网页编码转换
- perl - 设置html编码
- perl lwp编码
- perl中的字符编码
- mojo plugins
- perl文件编码处理问题
- hduoj 2824 The Euler function【欧拉函数 打表】
- Android UI手机用户界面案例及UI概述
- [CRT][中国剩余定理]膜法
- Java运算符优先级
- 【数据分析】图书馆数据-06数据处理过程中的算法
- perl mojo 编码
- 运行mysqli_connect apache报服务器500错误
- 1129第几天
- 无缝轮播图
- PAT甲级1008. Elevator (20)
- Linux中的crontab定时任务详解
- Java 变量
- 详细领悟ThreadLocal变量
- 浅谈进程和线程间的通信方式