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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
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<Term::TtyRec::Plus>.
=cut
=attr ttyrec_file
The name of the file to write to (which can be a named pipe). Defaults to
C<ttyrecord>.
=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<Tie::Handle::TtyRec> instance used to actually write the ttyrec file.
Defaults to an instance created based on the values of C<ttyrec_file> and
C<append>.
=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<system>. The output that
this command writes to the terminal will also be recorded in the file specified
by C<ttyrec_file>.
=cut
__PACKAGE__->meta->make_immutable;
no Moose;
=head1 BUGS
No known bugs.
Please report any bugs through RT: email
C<bug-app-ttyrec at rt.cpan.org>, or browse to
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-Ttyrec>.
=head1 SEE ALSO
L<Term::TtyRec::Plus>
L<Tie::Handle::TtyRec>
L<http://0xcc.net/ttyrec/index.html.en>
=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 * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/App-Ttyrec>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/App-Ttyrec>
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-Ttyrec>
=item * Search CPAN
L<http://search.cpan.org/dist/App-Ttyrec>
=back
=begin Pod::Coverage
munge_output
=end Pod::Coverage
=cut
1;
|