"Fossies" - the Fresh Open Source Software Archive

Member "mod_perl-2.0.11/t/response/TestAPR/socket.pm" (5 Oct 2019, 1248 Bytes) of package /linux/www/apache_httpd_modules/mod_perl-2.0.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "socket.pm": 2.0.8_vs_2.0.9.

    1 # please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
    2 package TestAPR::socket;
    3 
    4 # more tests in t/protocol/TestProtocol/echo_*.pm
    5 
    6 use strict;
    7 use warnings FATAL => 'all';
    8 
    9 use Apache::Test;
   10 use Apache::TestUtil;
   11 
   12 use Apache2::RequestRec ();
   13 use Apache2::Connection ();
   14 use APR::Socket ();
   15 
   16 use Apache2::Const -compile => 'OK';
   17 use APR::Const -compile => 'EMISMATCH';
   18 
   19 sub handler {
   20     my $r = shift;
   21 
   22     my $tests = 5;
   23 
   24     plan $r, tests => $tests;
   25 
   26     my $c = $r->connection;
   27     my $socket = $c->client_socket;
   28 
   29     ok $socket;
   30 
   31     # in microseconds
   32     my $orig_val = $socket->timeout_get();
   33     t_debug "orig timeout was: $orig_val";
   34     ok $orig_val;
   35 
   36     my $new_val = 30_000_000; # 30 secs
   37     $socket->timeout_set($new_val);
   38     ok t_cmp($socket->timeout_get(), $new_val, "timeout_get()");
   39 
   40     # reset the timeout
   41     $socket->timeout_set($orig_val);
   42     ok t_cmp($socket->timeout_get(), $orig_val, "timeout_get()");
   43 
   44     skip $^O=~/mswin/i ? 'APR::Socket->fileno is not implemented on MSWin' : '',
   45         sub {
   46             t_debug "client socket fd=".$socket->fileno;
   47             $socket->fileno>0
   48         };
   49 
   50     Apache2::Const::OK;
   51 }
   52 
   53 1;