check_max_len.pl untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 54 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 use strict;
4 use warnings;
5 use 5.010;
6 use utf8;
7 use lib qw(./lib);
8  
9 use Net::MyPeople::Bot;
10 use Data::Printer;
11 use Encode;
12 my $APIKEY = $ENV{MYPEOPLE_APIKEY};
13  
14 my $bot = Net::MyPeople::Bot->new(apikey=>$APIKEY, web_proxy_base=>'http://localhost:8080/proxy/');
15 my $from = 0;
16 my $to = 5000;
17  
18 my $before=0;
19 while($to != $from ){
20 my $half = $from + int(($to - $from) / 2);
21 last if( $before == $half );
22 say "$from..$to - send $half";
23 my $res;
24 my $msg = '한' x $half;
25 $res = $bot->send('BU_wqPHjxmJKIxKcIrAQu-JiA00', $msg, undef, 1 );
26 #$res = $bot->groupSend('GID_WZrl1', 'X' x $half );
27 if( $res->{code} eq '200' ){
28 $from = $half;
29 }
30 else{
31 $to = $half;
32 }
33 $before = $half;
34 }
35 say "MAX LENGTH : ".$before;