Summary
In this chapter, we saw how to communicate with a terminal, real or virtual, and learned how to determine whether a script is interactive. Controlling terminal input using the Term::ReadKey module was covered, as well as how to read individual characters from the keyboard (or any input device) interactively, without waiting for the Return key to be pressed. After this, we moved on to reading complete lines and looked at the various ways the Term::ReadLine module expands the capabilities of Perl’s built-in readline operator to handle passwords and invisible input, serial connections, line ending translation, and control characters. We also looked at interrogating the terminal to discover its size.
The latter part of the chapter discussed terminal capabilities and the creation of terminal objects, their supported features, and maintaining a history of command lines. We also looked at the Term::Screen module, saw how to write in colors and use ornaments, and then looked at the Curses library, the basis for many terminal-oriented applications. Finally, we explored ways to program a terminal directly via POSIX, when no higher-level interface can do the job.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2005 Peter Wainwright
About this chapter
Cite this chapter
(2005). Terminal Input and Output. In: Pro Perl. Apress. https://doi.org/10.1007/978-1-4302-0014-7_15
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0014-7_15
Publisher Name: Apress
Print ISBN: 978-1-59059-438-4
Online ISBN: 978-1-4302-0014-7
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books