3 # This spec file was automatically generated by cpan2rpm [ver: 2.027]
4 # The following arguments were used:
5 # --spec-only --version=2.30 '--author=Jonathan Stowe' TermReadKey-2.30.tar.gz
6 # For more information on cpan2rpm please visit: http://perl.arix.com/
9 %define pkgname TermReadKey
10 %define filelist
%{pkgname}-%{version}-filelist
11 %define NVR
%{pkgname}-%{version}-%{release}
14 name
: perl
-TermReadKey
15 summary
: TermReadKey
- A perl module
for simple terminal control
18 vendor
: Jonathan Stowe
19 packager
: Arix International
<cpan2rpm@arix.com
>
21 group
: Applications
/CPAN
22 url
: http
://www.cpan.org
23 buildroot
: %{_tmppath}/%{name}-%{version}-%
(id
-u
-n
)
24 prefix
: %
(echo %{_prefix})
25 source: TermReadKey
-2.30.tar.gz
28 Term
::ReadKey is a compiled perl module dedicated to providing simple
29 control over terminal driver modes
(cbreak
, raw
, cooked
, etc.
,) support
for
30 non
-blocking reads
, if the architecture allows
, and some generalized handy
31 functions
for working with terminals. One of the main goals is to have the
32 functions as portable as possible
, so you can just plug
in "use
33 Term
::ReadKey" on any architecture and have a good likelyhood of it working.
37 =item ReadMode MODE
[, Filehandle
]
39 Takes an integer argument
, which can currently be one of the following
42 0 Restore original settings.
43 1 Change to cooked mode.
44 2 Change to cooked mode with
echo off.
46 3 Change to cbreak mode.
48 5 Change to ultra
-raw mode.
49 (LF to CR
/LF translation turned off
)
51 Or
, you may use the synonyms
:
60 These functions are automatically applied to the STDIN handle
if no
61 other handle is supplied. Modes
0 and
5 have some special properties
62 worth mentioning
: not only will mode
0 restore original settings
, but it
63 cause the next ReadMode call to save a new
set of default settings. Mode
64 5 is similar to mode
4, except no CR
/LF translation is performed
, and
if
65 possible
, parity will be disabled
(only
if not being used by the terminal
,
66 however. It is no different from mode
4 under Windows.
)
68 If you are executing another program that may be changing the terminal mode
,
69 you will either want to say
72 system
('someprogram'
);
75 which resets the settings after the program has run
, or
:
79 system
('someprogram'
);
82 which records any changes the program may have made
, before resetting the
85 =item ReadKey MODE
[, Filehandle
]
87 Takes an integer argument
, which can currently be one of the following
90 0 Perform a normal
read using getc
91 -1 Perform a non
-blocked
read
92 >0 Perform a timed
read
94 (If the filehandle is not supplied
, it will default to STDIN.
) If there is
95 nothing waiting
in the buffer during a non
-blocked
read, then undef will be
96 returned. Note that
if the OS does not provide any known mechanism
for
97 non
-blocking reads
, then a "ReadKey
-1" can die with a fatal error. This
98 will hopefully not be common.
100 If MODE is greater
then zero
, then ReadKey will use it as a timeout value
in
101 seconds
(fractional seconds are allowed
), and won't
return "undef"
until
102 that
time expires.
(Note
, again
, that some OS's may not support this timeout
103 behaviour.
) If MODE is less
then zero
, then this is treated as a timeout
104 of zero
, and thus will
return immediately
if no character is waiting. A MODE
105 of zero
, however
, will act like a normal getc.
107 There are currently some limitations with this call under Windows. It may be
108 possible that non
-blocking reads will fail when reading repeating keys from
109 more
then one console.
111 =item ReadLine MODE
[, Filehandle
]
113 Takes an integer argument
, which can currently be one of the following
116 0 Perform a normal
read using scalar
(<FileHandle
>)
117 -1 Perform a non
-blocked
read
118 >0 Perform a timed
read
120 If there is nothing waiting
in the buffer during a non
-blocked
read, then
121 undef will be returned. Note that
if the OS does not provide any known
122 mechanism
for non
-blocking reads
, then a "ReadLine
1" can die with a fatal
123 error. This will hopefully not be common. Note that a non
-blocking
test is
124 only performed
for the first character
in the line
, not the entire line.
125 This call will probably not
do what you assume
, especially with
126 ReadMode's higher
then 1. For example
, pressing Space and
then Backspace
127 would appear to leave you where you started
, but any timeouts would now
130 This call is currently not available under Windows.
132 =item GetTerminalSize
[Filehandle
]
134 Returns either an empty array
if this operation is unsupported
, or a four
135 element array containing
: the width of the terminal
in characters
, the
136 height of the terminal
in character
, the width
in pixels
, and the height
in
137 pixels.
(The pixel size will only be valid
in some environments.
)
139 Under Windows
, this
function must be called with an "output" filehandle
,
140 such as STDOUT
, or a handle opened to CONOUT$.
142 =item SetTerminalSize WIDTH
,HEIGHT
,XPIX
,YPIX
[, Filehandle
]
144 Return
-1 on failure
, 0 otherwise. Note that this terminal size is only
for
145 informative value
, and changing the size via this mechanism will not
146 change the size of the screen. For example
, XTerm uses a call like this when
147 it resizes the screen. If any of the new measurements vary from the old
, the
148 OS will probably send a SIGWINCH signal to anything reading that tty or pty.
150 This call does not work under Windows.
152 =item GetSpeeds
[, Filehandle
]
154 Returns either an empty array
if the operation is unsupported
, or a two
155 value array containing the terminal
in and out speeds
, in decimal. E.g
,
156 an
in speed of
9600 baud and an out speed of
4800 baud would be returned as
157 (9600,4800). Note that currently the
in and out speeds will always be
158 identical
in some OS's. No speeds are reported under Windows.
160 =item GetControlChars
[, Filehandle
]
162 Returns an array containing key
/value pairs suitable
for a
hash. The pairs
163 consist of a key
, the name of the control character
/signal
, and the value
164 of that character
, as a single character. This call does nothing under Windows.
166 Each key will be an entry from the following list
:
188 Thus
, the following will always
return the current interrupt character
,
189 regardless of platform.
191 %keys = GetControlChars
;
192 $int
= $keys
{INTERRUPT
};
194 =item SetControlChars
[, Filehandle
]
196 Takes an array containing key
/value pairs
, as a
hash will produce. The pairs
197 should consist of a key that is the name of a legal control
198 character
/signal
, and the value should be either a single character
, or a
199 number
in the range
0-255. SetControlChars will die with a runtime error
if
200 an invalid character name is passed or there is an error changing the
201 settings. The list of valid names is easily available via
203 %cchars = GetControlChars
();
204 @cnames
= keys
%cchars;
206 This call does nothing under Windows.
211 # This package was generated automatically with the cpan2rpm
212 # utility. To get this software or for more information
213 # please visit: http://perl.arix.com/
217 %setup -q
-n
%{pkgname}-%{version}
218 chmod
-R u
+w
%{_builddir}/%{pkgname}-%{version}
221 grep
-rsl '^
#!.*perl' . |
222 grep
-v '.bak$' |xargs
--no
-run
-if-empty \
223 %__perl -MExtUtils
::MakeMaker
-e 'MY
->fixin
(@ARGV
)'
224 CFLAGS
="$RPM_OPT_FLAGS"
225 %{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}|
if \$ExtUtils
::MakeMaker
::VERSION
=~
/5\
.9[1-6]|
6\
.0[0-5]/ '`
232 [ "
%{buildroot}" != "/" ] && rm -rf %{buildroot}
234 %{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '`
236 cmd
=/usr
/share
/spec
-helper
/compress_files
237 [ -x $cmd
] || cmd
=/usr
/lib
/rpm
/brp
-compress
241 if [ -e
/etc
/SuSE
-release
-o
-e
/etc
/UnitedLinux
-release
]
243 %{__mkdir_p} %{buildroot}/var
/adm
/perl
-modules
244 %{__cat} `find %{buildroot} -name "perllocal.pod"` \
245 |
%{__sed} -e s+%{buildroot}++g \
246 > %{buildroot}/var/adm/perl-modules/%{name}
249 # remove special files
250 find
%{buildroot} -name "perllocal.pod" \
251 -o
-name ".packlist" \
255 # no empty directories
256 find
%{buildroot}%{_prefix} \
258 -exec rmdir {} \
; 2>/dev
/null
260 %{__perl} -MFile
::Find
-le '
261 find
({ wanted
=> \
&wanted
, no_chdir
=> 1}, "
%{buildroot}"
);
263 for my $x
(sort @
dirs, @files
) {
264 push @ret
, $x unless indirs
($x
);
266 print join "\n"
, sort @ret
;
271 local $_
= $File
::Find
::name
;
272 my $f
= $_
; s|^\Q
%{buildroot}\E||
;
273 return unless length
;
274 return $files
[@files
] = $_
if -f $f
;
277 /\Q$d\E
/ && return for reverse sort @INC
;
278 $d
=~
/\Q$_\E
/ && return
279 for qw|
/etc
%_prefix/man
%_prefix/bin
%_prefix/share|
;
286 $x
=~
/^\Q$_\E\
// && $x ne $_
&& return 1 for @
dirs;
290 [ -z
%filelist ] && {
291 echo "ERROR
: empty
%files listing"
296 [ "
%{buildroot}" != "/" ] && rm -rf %{buildroot}
299 %defattr(-,root
,root
)
302 * Tue Dec
19 2006 root@dca02