App-Prolix
view release on metacpan or search on metacpan
=head1 VERSION
version 0.03
=head1 SYNOPSIS
# Run spammy_command and log its output, but weed out some output
prolix -b '(spam)' -l auto -- spammy_command cmd_opt1 cmd_opt2
# While it's running, hit enter and add another ignore term at the
# interactive prompt
prolix> ignore_substring (more spam)
# Weed uninteresting fields out of a log file.
# Pipe mode is not interactive; but it accepts the same filtering
# arguments as the full interactive mode.
tail -f error.log | prolix -s 's/^\[(.*?\] ){3}//'
=head1 DESCRIPTION
We'll add facilities for doing this in a more convenient way for structured
lines in future versions. (For example, CSV or Apache CLF.)
=back
=head1 INTERACTIVE MODE
When C<prolix> launches a program itself (as opposed to pipe mode),
pressing B<enter> pauses the display of output from the program, and
you're dropped into a prompt. Here you can add more patterns to ignore
or apply new snippetting rules. These will take effect on subsequent output.
Blank input returns you to the normal running of the command.
The interactive mode has a "help" command listing available commands. Those
that add new filters follow the long command line options. So for example,
saying "ignore_substring temptation" will ignore all lines containing
"temptation".
You can also say "pats" to list all patterns in effect, and "clear_all"
to remove them. (Removing a particular rule is not supported but we can
lib/App/Prolix.pm view on Meta::CPAN
sub _dump_stack {
print Carp::longmess("************");
$SIG{USR1} = \&_dump_stack;
}
sub try_user_input {
my($self) = @_;
return if not defined Term::ReadKey::ReadKey(-1);
# Enter interactive prompt mode. We hope this will be brief, and
# IPC::Run can buffer our watched command in the meanhwile.
say q{Press ENTER to go back, or enter "help" for a list of commands.}
if $self->verbose;
Term::ReadKey::ReadMode("normal");
while (my $cmd = $self->_term->readline("prolix>")) {
$self->_term->addhistory($cmd);
$self->handle_user_input($cmd);
}
( run in 1.432 second using v1.01-cache-2.11-cpan-6aa56a78535 )