NAME
File::RegexMatch - Module to help locate files using regular expressions.
SYNOPSIS
#!/usr/bin/env perl -w
use strict; use File::RegexMatch;
foreach (File::RegexMatch->new(verbose => 1)->match( base_directory => "/home/user/public_html", regex_pattern => qr/\.pl$/, include_hidden => 0 )) { print $_->path() . "\n"; }
DESCRIPTION
This module provides the functionality to traverses a directory tree and return an array of File::RegexMatch::File objects. Each file that is returned has a filename that matches the regular expression that is passed to the match
subroutine.
METHODS
new
Instantiates and returns a new File::RegexMatch object. An optional argument for verbose can be passed to the constructor. Verbose property value is 0 (false) by default.
match
This method takes up to three parameter, base_directory
, regex_pattern
and include_hidden
.
The base_directory
parameter defines the directory which the method should start traversing. An absolute or relative path can be used. The default value for this is $ENV{HOME}
- the users home directory.
The regex_pattern
parameter is the regular expression that you wish to match file names against. The default value of this parameter is qr/.*/
.
The include_hidden
parameter should be set to true if the method should include hidden files in its search. By default it is set to false.
SEE ALSO
File::Find
BUGS
Please report any bugs or feature requests to lloydg@cpan.org
AUTHOR
Lloyd Griffiths
COPYRIGHT
Copyright (c) 2011-2013 Lloyd Griffiths
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.