File Coverage

blib/lib/X11/Protocol/Connection/UNIXSocket.pm
Criterion Covered Total %
statement 22 24 91.6
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 31 34 91.1


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package X11::Protocol::Connection::UNIXSocket;
4              
5             # Copyright (C) 1997 Stephen McCamant. All rights reserved. This program
6             # is free software; you can redistribute and/or modify it under the same
7             # terms as Perl itself.
8              
9 1     1   666 use X11::Protocol::Connection::Socket;
  1         3  
  1         27  
10 1     1   5 use IO::Socket;
  1         2  
  1         6  
11 1     1   712 use Socket;
  1         2  
  1         1069  
12 1     1   6 use Carp;
  1         1  
  1         52  
13 1     1   11 use strict;
  1         1  
  1         36  
14 1     1   5 use vars qw($VERSION @ISA);
  1         1  
  1         195  
15              
16             @ISA = ('X11::Protocol::Connection::Socket');
17              
18             $VERSION = 0.01;
19              
20             sub open {
21 1     1 1 2 my($pkg) = shift;
22 1         2 my($host, $dispnum) = @_;
23 1         11 my($sock) = IO::Socket::UNIX->new('Type' => SOCK_STREAM(),
24             'Peer' => "/tmp/.X11-unix/X$dispnum");
25 1 50       737 croak "Can't connect to display `unix:$dispnum': $!" unless $sock;
26 0           $sock->autoflush(0);
27 0           return bless \$sock, $pkg;
28             }
29             1;
30             __END__