App-Greple
view release on metacpan or search on metacpan
Set same value for all types.
- **--alert** \[ `size`=#, `time`=# \]
Set alert parameter for large file. **Greple** scans whole file
content to know line borders, and it takes several seconds or more if
it contains large number of lines.
By default, if the target file contains more than **512 \* 1024
characters** (_size_), **2 seconds** timer will start (_time_). Alert
message is shown when the timer expired.
To disable this alert, set the size as zero:
--alert size=0
- **-P**\[_n_\], **--parallel**\[=_n_\]
(Experimental) Search multiple patterns in parallel using up to _n_
child processes. When _n_ is omitted or zero, the number of CPU
cores is used. Note that a separate numeric argument following
lib/App/Greple/Grep.pm view on Meta::CPAN
my $alarm_start;
if ($self->{alert_size} and length >= $self->{alert_size}) {
$alarm_start = time;
$SIG{ALRM} = sub {
$SIG{ALRM} = undef;
STDERR->printflush(
$self->{filename} .
": Counting lines, and it may take longer...\n");
};
alarm $self->{alert_time};
warn "alert timer start ($alarm_start)\n" if $debug{a};
}
my @borders = do {
if ($self->{BORDERS_CHILD}) {
my @b = $self->read_borders;
@b ? @b : match_borders $self->{border};
} else {
match_borders $self->{border};
}
};
if (defined $alarm_start) {
if ($SIG{ALRM}) {
alarm 0;
warn "reset alert timer\n" if $debug{a};
} else {
STDERR->printflush(sprintf("Count %d lines in %d seconds.\n",
@borders - 1,
time - $alarm_start));
}
}
@borders;
}
sub result_ref {
script/greple view on Meta::CPAN
=back
=item B<--alert> [ C<size>=#, C<time>=# ]
Set alert parameter for large file. B<Greple> scans whole file
content to know line borders, and it takes several seconds or more if
it contains large number of lines.
By default, if the target file contains more than B<512 * 1024
characters> (I<size>), B<2 seconds> timer will start (I<time>). Alert
message is shown when the timer expired.
To disable this alert, set the size as zero:
--alert size=0
=item B<-P>[I<n>], B<--parallel>[=I<n>]
(Experimental) Search multiple patterns in parallel using up to I<n>
child processes. When I<n> is omitted or zero, the number of CPU
cores is used. Note that a separate numeric argument following
( run in 0.907 second using v1.01-cache-2.11-cpan-6aa56a78535 )