View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Andy Lester > ack-1.96 > App::Ack::Plugin::Basic



Annotate this POD


View/Report Bugs
Source   Latest Release: ack-2.17_02


Container for the Repository and Resources necessary.

App::Ack::Resource::Basic ^


new( $filename )

Opens the file specified by $filename and returns a filehandle and a flag that says whether it could be binary.

If there's a failure, it throws a warning and returns an empty list.


Returns the name of the resource.


Tells whether the resource is binary. If it is, and ack finds a match in the file, then ack will not try to display a match line.

$res->needs_line_scan( \%opts )

API: Tells if the resource needs a line-by-line scan. This is a big optimization because if you can tell from the outset that the pattern is not found in the resource at all, then there's no need to do the line-by-line iteration. If in doubt, return true.

Base: Slurp up an entire file up to 100K, see if there are any matches in it, and if so, let us know so we can iterate over it directly. If it's bigger than 100K or the match is inverted, we have to do the line-by-line, too.


Resets the resource back to the beginning. This is only called if needs_line_scan() is true, but not always if needs_line_scan() is true.


API: Gets the next line of text from the resource. Returns true if there is one, or false if not.

Sets $_ with the line of text, and $. for the ID number of the text. This basically emulates a call to <$fh>.


API: Close the resource.

App::Ack::Repository::Basic ^


Returns a resource object for the next resource in the repository.


Does nothing. For the base repository, the opening & closing are handled at the resource level.

If this repository were, say, an Excel workbook, you'd probably close the file. If it were a database, you'd close the database connection.

syntax highlighting: