| 1 | package Gtk2::Net::LDAP::Widgets::Util; | ||
| 2 | #---[ pod head ]---{{{ | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | Gtk2::Net::LDAP::Widgets::Util - helper functions | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | This module contains various helper functions and isn't meant to be used | ||
| 11 | directly. Read the source in case of any needs to do that. | ||
| 12 | |||
| 13 | =cut | ||
| 14 | |||
| 15 | #---}}} | ||
| 16 | |||
| 17 | require Exporter; | ||
| 18 | our @ISA = qw(Exporter); | ||
| 19 | our @EXPORT = qw(filter_trim_outer_parens); | ||
| 20 | our $VERSION = "2.0.1"; | ||
| 21 | |||
| 22 | use strict 'vars'; | ||
| 23 | |||
| 24 | #---[ sub filter_trim_outer_parens ]---{{{ | ||
| 25 | |||
| 26 | =head2 filter_trim_outer_parens | ||
| 27 | |||
| 28 | =over 4 | ||
| 29 | |||
| 30 | =item filter_trim_outer_parens ( filter ) | ||
| 31 | |||
| 32 | Trims superfluous outside parentheses from an LDAP filter, e.g. ((uid=olo)) | ||
| 33 | will be changed to uid=olo | ||
| 34 | |||
| 35 | C<filter> string representation of LDAP filter to trim parentheses from. | ||
| 36 | |||
| 37 | =back | ||
| 38 | |||
| 39 | =cut | ||
| 40 | sub filter_trim_outer_parens { | ||
| 41 | my $filter = shift; | ||
| 42 | while ($filter =~ /^\(.*\)$/) { | ||
| 43 | $filter =~ s/^\((.*)\)$/$1/; | ||
| 44 | } | ||
| 45 | return $filter; | ||
| 46 | } | ||
| 47 | #---}}} | ||
| 48 | |||
| 49 | 1; | ||
| 50 | __END__ |