Ack.3pm

Langue: en

Version: 2007-12-20 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

NAME

App::Ack - A container for functions for the ack program

VERSION

Version 1.76

SYNOPSIS

If you want to know about the ack program, see the ack file itself.

No user-serviceable parts inside. ack is all that should use this.

FUNCTIONS


read_ackrc

Reads the contents of the .ackrc file and returns the arguments.

get_command_line_options()

Gets command-line arguments and does the Ack-specific tweaking.

skipdir_filter

Standard filter to pass as a File::Next descend_filter. It returns true if the directory is any of the ones we know we want to skip.

filetypes( $filename )


filetypes( $filename )

Returns a list of types that $filename could be. For example, a file foo.pod could be ``perl'' or ``parrot''.

The filetype will be "undef" if we can't determine it. This could be if the file doesn't exist, or it can't be read.

It will be 'skipped' if it's something that ack should always ignore, even under -a.

is_searchable( $filename )


is_searchable( $filename )

Returns true if the filename is one that we can search, and false if it's one that we should ignore like a coredump or a backup file.

Recognized files:
  /~$/            - Unix backup files
  /#.+#$/         - Emacs swap files
  /[._].*\.swp$/  - Vi(m) swap files
  /core\.\d+$/    - core dumps

build_regex( $str, \%opts )


build_regex( $str, \%opts )

Returns a regex object based on a string and command-line options.

warn( @_ )


warn( @_ )

Put out an ack-specific warning.

die( @_ )


die( @_ )

Die in an ack-specific way.

filetypes_supported()

Returns a list of all the types that we can detect.

show_help()

Dumps the help page to the user.

show_help_types()

Display the filetypes help subpage.

get_version_statement( $copyright )


get_version_statement( $copyright )

Returns the version information for ack.

print_version_statement( $copyright )


print_version_statement( $copyright )

Prints the version information for ack.

get_copyright

Return the copyright for ack.

load_colors

Set default colors, load Term::ANSIColor on non Windows platforms

is_interesting

File type filter, filtering based on the wanted file types

open_file( $filename )


open_file( $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.

close_file( $fh, $filename )


close_file( $fh, $filename )

Close $fh opened from $filename.

needs_line_scan( $fh, $regex, \%opts )


needs_line_scan( $fh, $regex, \%opts )

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, we have to do the line-by-line, too.

search( $fh, $could_be_binary, $filename, \%opt )


search( $fh, $could_be_binary, $filename, \%opt )

Main search method

print_match_or_context( $opt, $is_match, $starting_line_no, @lines )


print_match_or_context( $opt, $is_match, $starting_line_no, @lines )

Prints out a matching line or a line of context around a match.

search_and_list( $fh, $filename, \%opt )


search_and_list( $fh, $filename, \%opt )

Optimized version of searching for -l and --count, which do not show lines.

filetypes_supported_set

True/False - are the filetypes set?

print_files( $iter, $one [, $regex, [, $ors ]] )


print_files( $iter, $one [, $regex, [, $ors ]] )

Prints all the files returned by the iterator matching $regex.

If $one is set, stop after the first. The output record separator $ors defaults to "\n" and defines, what to print after each filename.

filetype_setup()

Minor housekeeping before we go matching files.