NAME
Data::Hopen::Util::NameSet - set of names (strings or regexps)
SYNOPSIS
NameSet stores strings and regexps, and can quickly tell you whether a given string matches one of the stored strings or regexps.
FUNCTIONS
new
Create a new instance. Usage: Data::Hopen::Util::Nameset->new(...)
. The parameters are as "add".
add
Add one or more strings or regexps to the NameSet. Usage:
$instance->add(x1, x2, ...)
where each xn
can be a scalar, regexp, arrayref (processed recursively) or hashref (the keys are added and the values are ignored).
contains
Return truthy if the NameSet contains the argument. Usage: $set->contains('foo')
.
strings
Accessor for the strings in the set. Returns an arrayref.
regexps
Accessor for the regexps in the set. Returns an arrayref.
complex
Returns truthy if the nameset has any regular expressions.
_build
(Internal) Build a regex from all the strings and regexps in the set. Returns the new regexp --- does not mutate $self.
In the current implementation, strings are matched case-sensitively. Regexps are matched with whatever flags they were compiled with.