15.7. Ringing the Terminal BellProblemYou want to sound an alarm on the user's terminal. Solution
Print the print "\aWake up!\n";
Or, use the use Term::Cap; $OSPEED = 9600; eval { require POSIX; my $termios = POSIX::Termios->new(); $termios->getattr; $OSPEED = $termios->getospeed; }; $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED}); $vb = ""; eval { $terminal->Trequire("vb"); $vb = $terminal->Tputs('vb', 1); }; print $vb; # ring visual bell Discussion
The
Not every terminal supports the
visual bell, which is why we
There's a better approach to the bell issue in graphical terminal systems like
xterm
. Many of these let you enable the visual bell from the enclosing application itself, allowing all programs that blindly output a See AlsoThe section on "String Literals" in Chapter 2 of Programming Perl or the section on "Quote and Quote-like Operators" in perlop (1); the documentation for the standard Term::Cap module Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|