From 0f592e5cc31a442e282c29352082b0478c8878ab Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 18 Apr 2010 16:53:00 -0500 Subject: add ttyrec streamer --- bin/stream_ttyrec | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 bin/stream_ttyrec diff --git a/bin/stream_ttyrec b/bin/stream_ttyrec new file mode 100644 index 0000000..13e0635 --- /dev/null +++ b/bin/stream_ttyrec @@ -0,0 +1,50 @@ +#!/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"; + +=head1 NAME + +stream_ttyrec - play a ttyrec to a termcast channel + +=head1 SYNOPSIS + + stream_ttyrec [options] [ttyrec_file] + +=head1 DESCRIPTION + +See L for options documentation. 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. + +=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}); +} + +=head1 AUTHOR + + Jesse Luehrs + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2009-2010 by Jesse Luehrs. + +This is free software; you can redistribute it and/or modify it under +the same terms as perl itself. -- cgit v1.2.3-54-g00ecf