---
name: "Ack"
section: "3pm"
platform: "linux"
package: "ack-grep"
version: "1.80-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Ack"
---

# Ack(3pm)

App::Ack - A container for functions for the ack program Version 1.80 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.\
 **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.\
 **def\_types\_from\_ARGV** Go through the command line arguments and look for *--type-set foo=.foo,.bar* and *--type-add xml=.rdf*. Remove them from `@ARGV` and add them to the supported filetypes, i.e. into `%mappings`, etc.\
 **delete\_type** Removes a type from the internal structures containing type information: `%mappings`, `%types` and `%type_wanted`.\
 **ignoredir\_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 ignore.\
 **remove\_dir\_sep( $path )** This functions removes a trailing path separator, if there is one, from its argument\
 **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 avoid searching, even under -a.\
 **is\_searchable( $filename )** Returns true if the filename is one that we can search, and false if it's one that we should skip 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 )** Returns a regex object based on a string and command-line options.\
 **check\_regex( $regex\_str )** Checks that the `$regex_str` can be compiled into a perl regular expression. Dies with the error message if this is not the case. No return value.\
 **warn( @\_ )** Put out an ack-specific warning.\
 **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 )** Returns the version information for ack.\
 **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 )** 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 $fh opened from $filename.\
 **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 or the match is inverted, we have to do the line-by-line, too.\
 **search( $fh**, `$could_be_binary`, `$filename, \%opt )` Main search method\
 **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 )` 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 ]] )` 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.\
 **print\_files\_with\_matches( $iter**, `$opt )` Prints the name of the files where a match was found.\
 **print\_matches( $iter**, `$opt )` Print matching lines.\
 *filetype\_setup()* Minor housekeeping before we go matching files.\
 **expand\_filenames( \\@ARGV )** Returns reference to list of expanded filename globs (Win32 only).\
 **get\_starting\_points( \\@ARGV, \\%opt )** Returns reference to list of starting directories and files.\
 **get\_iterator** Return the File::Next file iterator\
 **set\_up\_pager( $command )** Copyright 2005-2008 Andy Lester, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
