Sub::Approx::Subclass (was Re: Grep here yet?)
Dave Cross
dave at dave.org.uk
Mon Oct 2 05:53:43 CDT 2000
From: Mark Fowler <mark at profero.com>
Date: 10/2/00 9:11:11 AM
>> p.s. Mark, I think I've got a solution to your
>> Sub::Approx::Subclass problems. Haven't had time to
>> investigate it this weekend, but I'll try it out
>> tomorrow and get back to you.
>
> I had a little think about that this weekend while I was
> moving boxes o' stuff around London and I came up with
> this (perverted) way of doing things....
>
> You have three (3) classes. Sub::Approx,
> Sub::Approx::Subclass, and
> Sub::Approx::Subclass::Matchers. Note that I haven't
> actually tried this yet...
>
> The first file is :
>
> package Sub::Approx::Subclass::Matchers;
>
> sub matchers
> {
> my $this = shift;
> my @hash = $this->SUPER::matchers;
> push @hash, "whatever" =>
> [\&setup_whatever,&match_whatever];
> return @hash
> }
>
> 1;
>
> package Sub::Approx::Subclass;
> use base qw(Sub::Approx::Subclass::Matchers Sub::Approx);
>
> 1;
>
> -----
>
> You'll also need to make a few changes to Sub::Approx,
> namely that you replace line 44 to read
>
> my %funcs = $class->matches;
>
> And make a subroutine that does
>
> sub matches
> {
> (text_soundex => [\&setup_text_soundex,
> \&match_text_soundex,
> text_metaphone => [\&setup_text_metaphone,
> \&match_text_metaphone],
> string_approx => [\&setup_string_approx,
> \&match_string_approx])
> }
>
> Not sure if this will work or not....
>
> Later.
That's all _far_ too complex. See my mail to london.pm earlier
this morning for my solution.
Dave...
--
<http://www.dave.org.uk>
"The chances of anything coming from Mars are a million to one",
he said. But still they come.
More information about the Bath-pm
mailing list