=begin metadata

Name: clear
Description: clear the screen
Author: Jeffrey S. Haemer
License: perl

=end metadata


use Term::Cap;
use strict;

my $OSPEED = 9600;
eval {
	require POSIX;
	my $termios = POSIX::Termios->new();
	$OSPEED = $termios->getospeed;

my $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED});
my $cl = "";
eval {
	$cl = $terminal->Tputs('cl', 1);

if ($cl eq "" && $^O eq 'MSWin32') {
    system 'cls';
} else {
    print $cl;

=head1 NAME

clear - clear the screen




=over 2

Look in the termcap database, find the character to clear the screen,
and emit it.

This is a direct lift from Section 15.7, B<Ringing the Terminal Bell>, from
I<Perl Cookbook>, with C<cl> substituted for C<vb>.


=head1 TYPIST

Jeffrey S. Haemer

=head1 BUGS

B<clear> should probably take an argument, like B<yes>, that will
let users send arbitrary termcap sequences, with C<cl> as the default.

=head1 SEE ALSO