File Coverage

blib/lib/Symbol/Approx/Sub/String/Approx.pm
Criterion Covered Total %
statement 12 17 70.6
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 25 68.0


line stmt bran cond sub pod time code
1             #
2             # Symbol::Approx::Sub::String::Approx
3             #
4             # $Id$
5             #
6             # Matcher plugin for Symbol::Approx::Sub;
7             #
8             # Copyright (c) 2000, Magnum Solutions Ltd. All rights reserved.
9             #
10             # This module is free software; you can redistribute it and/or
11             # modify it under the same terms as Perl itself.
12             #
13             # $Log$
14             # Revision 1.2 2005/10/22 17:56:22 dave
15             # Added docs.
16             #
17             # Revision 1.1 2002/03/29 17:55:31 dave
18             # Support modules
19             #
20             # Revision 1.1 2001/07/15 20:42:26 dave
21             # Initial revision
22             #
23             #
24             package Symbol::Approx::Sub::String::Approx;
25              
26             require 5.006_000;
27 1     1   979 use warnings;
  1         2  
  1         24  
28 1     1   3 use strict;
  1         1  
  1         61  
29              
30             our ($VERSION, @ISA, $AUTOLOAD);
31              
32             $VERSION = sprintf "%d", '$Revision$ ' =~ /(\d+)/;
33              
34 1     1   4 use Carp;
  1         1  
  1         40  
35 1     1   208 use String::Approx 'amatch';
  1         2276  
  1         92  
36              
37             =head1 NAME
38            
39             Symbol::Approx::Sub::String::Approx
40            
41             =head1 SYNOPSIS
42            
43             See L<Symbol::Approx::Sub>
44            
45             =head1 METHODS
46            
47             =head2 match
48            
49             Passed a value and a list of values. Returns the values from the list
50             which match the initial value using the C<amatch> method from
51             L<String::Approx>.
52            
53             =cut
54              
55             sub match {
56 0     0 1     my ($sub, @subs) = @_;
57 0             my (@ret);
58              
59 0             foreach (0 .. $#subs) {
60 0 0             push @ret, $_ if amatch($sub, $subs[$_]);
61               }
62              
63 0             @ret;
64             }
65              
66             1;
67