6 |
use IO::Socket::INET; |
use IO::Socket::INET; |
7 |
use Data::Dumper; |
use Data::Dumper; |
8 |
use Carp qw/confess/; |
use Carp qw/confess/; |
9 |
|
use Encode; |
10 |
|
|
11 |
=head1 NAME |
=head1 NAME |
12 |
|
|
78 |
sub AUTOLOAD { |
sub AUTOLOAD { |
79 |
my $self = shift; |
my $self = shift; |
80 |
|
|
81 |
|
use bytes; |
82 |
|
|
83 |
my $sock = $self->{sock} || die "no server connected"; |
my $sock = $self->{sock} || die "no server connected"; |
84 |
|
|
85 |
my $command = $AUTOLOAD; |
my $command = $AUTOLOAD; |
118 |
} |
} |
119 |
|
|
120 |
my $result = <$sock> || die "can't read socket: $!"; |
my $result = <$sock> || die "can't read socket: $!"; |
121 |
|
Encode::_utf8_on($result); |
122 |
warn "<< $result" if $self->{debug}; |
warn "<< $result" if $self->{debug}; |
123 |
my $type = substr($result,0,1); |
my $type = substr($result,0,1); |
124 |
$result = substr($result,1,-2); |
$result = substr($result,1,-2); |
158 |
my $v; |
my $v; |
159 |
if ( $len > 0 ) { |
if ( $len > 0 ) { |
160 |
read($self->{sock}, $v, $len) || die $!; |
read($self->{sock}, $v, $len) || die $!; |
161 |
|
Encode::_utf8_on($v); |
162 |
warn "<< ",Dumper($v),$/ if $self->{debug}; |
warn "<< ",Dumper($v),$/ if $self->{debug}; |
163 |
} |
} |
164 |
my $crlf; |
my $crlf; |