zoukankan      html  css  js  c++  java
  • perl 中的对象 bless

    [root@dr-mysql01 ~]# cat aa.pl 
    use  LWP::UserAgent;
    use Data::Dumper; 
    my $ua = LWP::UserAgent->new;
    $phone=$ARGV[0];
    $cc=$ARGV[1];
    $ua->timeout(10);
    $ua->env_proxy;
    $ua->agent("Mozilla/8.0");
    $host = "xxxxxxxx";
    my $response = $ua->get($host);
    
     my $var= Dumper($ua);
    print $var;
    print "
    ";
    
    
     my $var= Dumper($response);
    print $var;
    print "
    ";
      $ua->default_headers;
    if ($response->is_success) {
     print $response->decoded_content;  # or whatever
    }
    else {
     die $response->status_line;
    }
    [root@dr-mysql01 ~]# set -o vi
    [root@dr-mysql01 ~]# perl aa.pl  180722722237 test
    $VAR1 = bless( {
                     'max_redirect' => 7,
                     'protocols_forbidden' => undef,
                     'show_progress' => undef,
                     'handlers' => {
                                     'response_header' => bless( [
                                                                   {
                                                                     'owner' => 'LWP::UserAgent::parse_head',
                                                                     'callback' => sub { "DUMMY" },
                                                                     'm_media_type' => 'html',
                                                                     'line' => '/usr/share/perl5/LWP/UserAgent.pm:609'
                                                                   }
                                                                 ], 'HTTP::Config' )
                                   },
                     'no_proxy' => [],
                     'protocols_allowed' => undef,
                     'use_eval' => 1,
                     'requests_redirectable' => [
                                                  'GET',
                                                  'HEAD'
                                                ],
                     'timeout' => 10,
                     'def_headers' => bless( {
                                               'user-agent' => 'Mozilla/8.0'
                                             }, 'HTTP::Headers' ),
                     'proxy' => {},
                     'max_size' => undef
                   }, 'LWP::UserAgent' );
    
    			   
    			   
    $VAR1 = bless( {
                     '_protocol' => 'HTTP/1.1',
                     '_content' => '<?xml version="1.0" encoding="utf-8" ?><returnsms>
     <returnstatus>Success</returnstatus>
     <message>ok</message>
     <remainpoint>31686</remainpoint>
     <taskID>5352823</taskID>
     <successCounts>1</successCounts></returnsms>',
                     '_rc' => '200',
                     '_headers' => bless( {
                                            'x-powered-by' => 'ASP.NET',
                                            'client-response-num' => 1,
                                            'cache-control' => 'private',
                                            'set-cookie' => 'ASP.NET_SessionId=d2iytlqkqwu00f55ds3aukug; path=/; HttpOnly',
                                            'date' => 'Wed, 06 Jan 2016 09:17:22 GMT',
                                            'client-peer' => '211.149.197.95:8888',
                                            'content-length' => '217',
                                            'x-aspnet-version' => '2.0.50727',
                                            'client-date' => 'Wed, 06 Jan 2016 09:14:14 GMT',
                                            'content-type' => 'text/xml; charset=UTF-8',
                                            'server' => 'Microsoft-IIS/6.0'
                                          }, 'HTTP::Headers' ),
                     '_msg' => 'OK',
                     '_request' => bless( {
                                            '_content' => '',
                                            '_uri' => bless( do{(my $o = 'http://211.149.197.95:8888/sms.aspx?action=send&userid=74&account=SDK&password=9&mobile=18072722237&content=test&sendTime=&extno=')}, 'URI::http' ),
                                            '_headers' => bless( {
                                                                   'user-agent' => 'Mozilla/8.0'
                                                                 }, 'HTTP::Headers' ),
                                            '_method' => 'GET',
                                            '_uri_canonical' => $VAR1->{'_request'}{'_uri'}
                                          }, 'HTTP::Request' )
                   }, 'HTTP::Response' );
    

  • 相关阅读:
    C++输入与输出
    数组与指针
    MFC+WinPcap编写一个嗅探器之零(目录)
    netty源码分析之揭开reactor线程的面纱(二)
    netty源码分析之揭开reactor线程的面纱(一)
    Vert.x 线程模型揭秘
    理解 RxJava 的线程模型
    Java RESTful 框架的性能比较
    Java借助CountDownLatch完成异步回调
    在 Java 中运用动态挂载实现 Bug 的热修复
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351106.html
Copyright © 2011-2022 走看看