File Coverage

blib/lib/Symbol/Approx/Sub/String/Equal.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             #
2             # Symbol::Approx::Sub::String::Equal
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:43:10 dave
21             # Initial revision
22             #
23             #
24             package Symbol::Approx::Sub::String::Equal;
25              
26             require 5.006_000;
27 9     9   1004 use strict;
  9         12  
  9         172  
28 9     9   25 use warnings;
  9         7  
  9         518  
29              
30             our ($VERSION, @ISA, $AUTOLOAD);
31              
32             $VERSION = sprintf "%d", '$Revision$ ' =~ /(\d+)/;
33              
34 9     9   31 use Carp;
  9         12  
  9         749  
35              
36             =head1 NAME
37            
38             Symbol::Approx::Sub::String::Equal
39            
40             =head1 SYNOPSIS
41            
42             See L<Symbol::Approx::Sub>
43            
44             =head1 METHODS
45            
46             =head2 match
47            
48             Passed a value and a list of values. Returns the values from the list
49             which equal (by string comparison) the initial value.
50            
51             =cut
52              
53             sub match {
54 10     10 1 43   my ($sub, @subs) = @_;
55 10         10   my (@ret);
56              
57 10         19   foreach (0 .. $#subs) {
58 233 100       305     push @ret, $_ if $sub eq $subs[$_];
59               }
60              
61 10         57   @ret;
62             }
63              
64             1;
65