blib/lib/DBI/Gofer/Transport/stream.pm

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 2 SCAR 17.9
CC
2
Cov
0%
run_stdio_hex
6.0
CRAP 6.0
« blib/lib/DBD/NullP.pm ↑ Summary blib/lib/DBD/Mem.pm »
1 package DBI::Gofer::Transport::stream;
2  
3 # $Id: stream.pm 12536 2009-02-24 22:37:09Z Tim $
4 #
5 # Copyright (c) 2007, Tim Bunce, Ireland
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9  
10 use strict;
11 use warnings;
12  
13 use DBI qw(dbi_time);
14 use DBI::Gofer::Execute;
15  
16 use base qw(DBI::Gofer::Transport::pipeone Exporter);
17  
18 our $VERSION = "0.012537";
19  
20 our @EXPORT = qw(run_stdio_hex);
21  
22 my $executor = DBI::Gofer::Execute->new();
23  
24 sub run_stdio_hex {
25  
26 0 ▶ my $transport = DBI::Gofer::Transport::stream->new();
Subroutine run_stdio_hex: not called CC=2 SCAR=17.9
Pod undocumented
27 0 local $| = 1;
28  
29 0 DBI->trace_msg("$0 started (pid $$)\n");
30  
31 0 local $\; # OUTPUT_RECORD_SEPARATOR
32 0 local $/ = "\012"; # INPUT_RECORD_SEPARATOR
33 0 ▶ while ( defined( my $encoded_request = <STDIN> ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $encoded_request = readline STDIN)) 0 0 0
34 0 my $time_received = dbi_time();
35 0 $encoded_request =~ s/\015?\012$//;
36  
37 0 my $frozen_request = pack "H*", $encoded_request;
38 0 my $request = $transport->thaw_request( $frozen_request );
39  
40 0 my $response = $executor->execute_request( $request );
41  
42 0 my $frozen_response = $transport->freeze_response($response);
43 0 my $encoded_response = unpack "H*", $frozen_response;
44  
45 0 print $encoded_response, "\015\012"; # autoflushed due to $|=1
46  
47 # there's no way to access the stats currently
48 # so this just serves as a basic test and illustration of update_stats()
49 0 $executor->update_stats($request, $response, $frozen_request, $frozen_response, $time_received, 1);
50 }
51 0 DBI->trace_msg("$0 ending (pid $$)\n");
52 }
53  
54 1;
55 __END__
« blib/lib/DBD/NullP.pm ↑ Summary blib/lib/DBD/Mem.pm »