NAME Devel::Examine::Subs - Get names of subroutines containing certain text SYNOPSIS use Devel::Examine::Subs; my $file = 'perl.pl'; my $find = 'string'; # get all sub names in a file my @subs = Devel::Examine::Subs->all({ file => $file }); # list of sub names where the sub contains the text "function(" my @has = Devel::Examine::Subs->has({ file => $file, search => $find }); # same as has(), but returns the opposite my @missing = Devel::Examine::Subs->missing({ file => $file, search => $find }); # get all sub names with their start and end line numbers in the file my $href = Devel::Examine::Subs->line_numbers({ file => $file }) # There's also an OO interface to save typing if you will be making # multiple calls my $des = Devel::Examine::Subs->new(); $des->all(...); $des->has(...); $des->missing(...); $des->line_numbers(...); DESCRIPTION Reads into Perl program and module files returning the names of its subroutines, optionally limiting the names returned to subs that contain or do not contain specified text. METHODS new Instantiates a new object. This module was designed for one-off calls through the class methods. Creating an object will save keystrokes if multiple calls are required. has( { file => $filename, search => $text } ) Takes the name of a file to search, and the text you want to search for within each sub. Useful to find out which subs call other methods. Returns a list of names of the subs where the subroutine containes the text. In scalar context, returns the count of subs containing the found text. missing( { file => $filename, search => $text } ) The exact opposite of has. all( { file => $filename } ) Returns a list of the names of all subroutines found in the file. line_numbers( { file => $filename } ) Returns a hash of hashes. Top level keys are the function names, and the subkeys 'start' and 'stop' contain the line numbers of the respective position in the file for the subroutine. CAVEATS Subs that begin indented (such as closures and those within other blocks) will not be counted. For line_numbers() the closing brace must be in column one of the file as well. AUTHOR Steve Bertrand, SUPPORT You can find documentation for this module with the perldoc command. perldoc Devel::Examine::Subs LICENSE AND COPYRIGHT Copyright 2015 Steve Bertrand. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.