[libcode-tidyall-perl] 231/374: add zglobs_to_regex
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 22:26:26 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcode-tidyall-perl.
commit 385fc2319cb14d7b6ba67f47533c04d7683b137f
Author: Jonathan Swartz <swartz at pobox.com>
Date: Fri Sep 14 11:19:31 2012 -0400
add zglobs_to_regex
---
lib/Code/TidyAll/Util/Zglob.pm | 7 ++++++-
lib/Code/TidyAll/t/Zglob.pm | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/Code/TidyAll/Util/Zglob.pm b/lib/Code/TidyAll/Util/Zglob.pm
index 6cde296..c82e919 100644
--- a/lib/Code/TidyAll/Util/Zglob.pm
+++ b/lib/Code/TidyAll/Util/Zglob.pm
@@ -6,13 +6,18 @@ use Exporter;
use vars qw/@ISA @EXPORT_OK
$strict_leading_dot $strict_wildcard_slash/;
@ISA = 'Exporter';
- at EXPORT_OK = qw( zglob_to_regex );
+ at EXPORT_OK = qw( zglobs_to_regex zglob_to_regex );
$strict_leading_dot = 1;
$strict_wildcard_slash = 1;
use constant debug => 0;
+sub zglobs_to_regex {
+ my @globs = @_;
+ return @globs ? join( '|', map { "(?:" . zglob_to_regex($_) . ")" } @globs ) : qr/(?!)/;
+}
+
sub zglob_to_regex {
my $glob = shift;
my $regex = zglob_to_regex_string($glob);
diff --git a/lib/Code/TidyAll/t/Zglob.pm b/lib/Code/TidyAll/t/Zglob.pm
index 1b7de1f..df4d3ed 100644
--- a/lib/Code/TidyAll/t/Zglob.pm
+++ b/lib/Code/TidyAll/t/Zglob.pm
@@ -1,4 +1,5 @@
package Code::TidyAll::t::Zglob;
+use File::Zglob;
use Test::Class::Most parent => 'Code::TidyAll::Test::Class';
use Code::TidyAll::Util::Zglob qw(zglob_to_regex);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git
More information about the Pkg-perl-cvs-commits
mailing list