#!/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 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}); }