The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Pootle::Client::Filters

Wrapper object for multiple filters. Use this to test a object against multiple filters conveniently.

Synopsis

For available language attributes to filter with, see. https://pootle.readthedocs.io/en/stable-2.5.1/api/api_language.html#get-a-language or Pootle::Resource::Language

To pick only the Galician language from all the languages the Pootle server supports

    my $languages = $papi->findLanguages( Pootle::Filters->new({
        fullname => qr/^Galician/,
        code => qr/gl_?.*/,
    }));

To find all English dialects

    my $languages = $papi->findLanguages( Pootle::Filters->new({
        code => qr/^en/,  #All codes starting with 'en', such as en_GB, en_NZ, ...
    }));

Filters can filter all Pootle::Resource::* -objects

new

  my $ok = Pootle::Client::Filter->new({
    fullname => qr/^Finnish/,
    code => qr/^fi/,
  })->matches($objects);

 @PARAM1 ARRAYRef of {key => regexp}, {...} -pairs. Key selects the object's attribute to test against, and regexp matches against the attribute value
 @RETURNS Pootle::Client::Filters

match

Apply filters to the given object and return if object matches them

 @PARAM1 Pootle::Resource::*-object
 @PARAM2 HASHRef of
 @RETURNS Boolean, True when all filters match

intersect

Given two groups of Pootle::Resource::* -objects, finds an intersection of a given attribute.

 @RETURNS ARRAYRef of Pootle::Filters::Intersection-objects