package App::Ttyrec; use Moose; # ABSTRACT: record interactive terminal sessions use Tie::Handle::TtyRec 0.04; with 'Term::Filter'; =head1 SYNOPSIS use App::Ttyrec; App::Ttyrec->new( ttyrec_file => 'nethack.ttyrec', )->run('nethack'); =head1 DESCRIPTION This module handles setting up and running a terminal session which records its output to a ttyrec file. These files can then be later read via software such as L. =cut =attr ttyrec_file The name of the file to write to (which can be a named pipe). Defaults to C. =cut has ttyrec_file => ( is => 'ro', isa => 'Str', default => 'ttyrecord', ); =attr append Whether or not to append to the ttyrec file. Defaults to false. =cut has append => ( is => 'ro', isa => 'Bool', default => 0, ); =attr ttyrec The L instance used to actually write the ttyrec file. Defaults to an instance created based on the values of C and C. =cut has ttyrec => ( is => 'ro', isa => 'FileHandle', lazy => 1, default => sub { my $self = shift; Tie::Handle::TtyRec->new($self->ttyrec_file, append => $self->append) }, ); sub munge_output { my $self = shift; my ($got) = @_; syswrite $self->ttyrec, $got; $got; } =method run(@cmd) Run the command specified by C<@cmd>, as though via C. The output that this command writes to the terminal will also be recorded in the file specified by C. =cut __PACKAGE__->meta->make_immutable; no Moose; =head1 BUGS No known bugs. Please report any bugs to GitHub Issues at L. =head1 SEE ALSO L L L =head1 SUPPORT You can find this documentation for this module with the perldoc command. perldoc App::Ttyrec You can also look for information at: =over 4 =item * MetaCPAN L =item * Github L =item * RT: CPAN's request tracker L =item * CPAN Ratings L =back =begin Pod::Coverage munge_output =end Pod::Coverage =cut 1;