blob: 6998974492840062cef7abe3e9137e179b0d5251 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/usr/bin/env perl
use strict;
use warnings;
use App::Termcast;
eval { require Term::TtyRec::Plus }
|| die "This script requires the Term::TtyRec::Plus module";
# PODNAME: stream_ttyrec
# ABSTRACT: play a ttyrec to a termcast channel
=head1 SYNOPSIS
stream_ttyrec [options] [ttyrec_file]
=head1 DESCRIPTION
This program will stream a ttyrec file to the given termcast channel. The
ttyrec file may be given on the command line, or it will be read from STDIN.
See L<App::Termcast> for options documentation.
=cut
my $tc = App::Termcast->new_with_options;
my ($file) = @{ $tc->extra_argv };
my $fh;
if (defined($file)) {
open $fh, '<', $file or die "Couldn't open ttyrec $file for reading: $!";
}
else {
$fh = \*STDIN;
}
my $ttyrec = Term::TtyRec::Plus->new(filehandle => $fh);
while (my $frame = $ttyrec->next_frame) {
select undef, undef, undef, $frame->{diff};
$tc->write_to_termcast($frame->{data});
}
|