File Coverage

blib/lib/X11/Protocol/Ext/MIT_SUNDRY_NONSTANDARD.pm
Criterion Covered Total %
statement 10 22 45.4
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 0 1 0.0
total 14 32 43.7


line stmt bran cond sub pod time code
1             # Copyright 2011, 2012, 2013, 2014 Kevin Ryde
2              
3             # This file is part of X11-Protocol-Other.
4             #
5             # X11-Protocol-Other is free software; you can redistribute it and/or
6             # modify it under the terms of the GNU General Public License as published
7             # by the Free Software Foundation; either version 3, or (at your option) any
8             # later version.
9             #
10             # X11-Protocol-Other is distributed in the hope that it will be useful,
11             # but WITHOUT ANY WARRANTY; without even the implied warranty of
12             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13             # Public License for more details.
14             #
15             # You should have received a copy of the GNU General Public License along
16             # with X11-Protocol-Other. If not, see .
17              
18 1     1   391 BEGIN { require 5 }
19             package X11::Protocol::Ext::MIT_SUNDRY_NONSTANDARD;
20 1     1   3 use strict;
  1         1  
  1         18  
21 1     1   2 use Carp;
  1         1  
  1         56  
22              
23 1     1   3 use vars '$VERSION', '@CARP_NOT';
  1         1  
  1         288  
24             $VERSION = 30;
25             @CARP_NOT = ('X11::Protocol');
26              
27             # uncomment this to run the ### lines
28             #use Smart::Comments;
29              
30              
31             # /usr/include/X11/extensions/mitmiscproto.h
32             # /usr/include/X11/extensions/mitmiscconst.h
33             # Protocol.
34             #
35             # /usr/include/X11/extensions/MITMisc.h
36             # Xlib.
37              
38              
39             my $reqs =
40             [
41             ["MitSundryNonstandardSetBugMode", # 0
42             sub {
43             my ($X, $onoff) = @_;
44             return pack 'Cxxx', $onoff;
45             } ],
46              
47             ["MitSundryNonstandardGetBugMode", # 1
48             \&_request_empty,
49             sub {
50             my ($X, $data) = @_;
51             return unpack 'xC', $data;
52             }],
53             ];
54              
55             sub _request_empty {
56 0 0   0     if (@_ > 1) {
57 0           croak "No parameters in this request";
58             }
59 0           return '';
60             }
61              
62             sub new {
63 0     0 0   my ($class, $X, $request_num, $event_num, $error_num) = @_;
64             ### MIT-SUNDRY-NONSTANDARD new()
65              
66 0           _ext_requests_install ($X, $request_num, $reqs);
67 0           return bless { }, $class;
68             }
69              
70             sub _ext_requests_install {
71 0     0     my ($X, $request_num, $reqs) = @_;
72              
73 0           $X->{'ext_request'}->{$request_num} = $reqs;
74 0           my $href = $X->{'ext_request_num'};
75 0           my $i;
76 0           foreach $i (0 .. $#$reqs) {
77 0           $href->{$reqs->[$i]->[0]} = [$request_num, $i];
78             }
79             }
80              
81             1;
82             __END__