[root@yyjk ~/20200424/wx]#cat Client.pm
package Client;
use strict;
use File::Spec;
use Weixin::Util;
use LWP::UserAgent;
use Weixin::UserAgent;
use LWP::Protocol::https;
no strict;
no warnings;
use base qw(blogin login );
my $agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062';
my $tmpdir = File::Spec->tmpdir();
my $cookie_filename = $p{login_file} || "$tmpdir/weixin_client_login.dat";
sub new{
my $class = shift;
my %p = @_;
print %p;
print "\n";
my $self={
Version =>"1.0",
now => time(),
interval =>5,
cookie_jar => HTTP::Cookies->new(hide_cookie2=>1,file=>$cookie_filename,autosave=>1)
};
$self->{ua} = LWP::UserAgent->new(
cookie_jar => $self->{cookie_jar},
agent => $agent,
timeout => 300,
ssl_opts => {verify_hostname => 0});
bless $self,$class;
return $self;
};
1;
[root@yyjk ~/20200424/wx]#cat blogin.pm
package blogin;
sub testfun{
my $self=shift;
my $show_tip = 1;
return 'aaaaaaaaaaaaaa';
1;
[root@yyjk ~/20200424/wx]#cat login.pm
?package login;
use LWP::UserAgent;
use URI::Escape;
use Net::Ping;
use JSON qw(encode_json);
use Socket;
use Net::SMTP;
use LWP;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use URI::Escape;
use URI::URL;
use File::Temp qw/tempfile/;
sub testfun {
my $self=shift;
return 'bbbbbbbbbbbbbbbbbbbb';
};
1;
[root@yyjk ~/20200424/wx]#cat weixin.pl
use lib '/root/20200424/wx';
use Client;
use Data::Dumper;
my $client=Client->new();
print $client->testfun();
#10.4.160.63
[root@yyjk ~/20200424/wx]#perl weixin.pl
aaaaaaaaaaaaaa[root@yyjk ~/20200424/wx]#