[EMAIL PROTECTED] (Simon Cozens) writes:
> Incidentally, this uses a very interesting trick to provide inheritance-like
> capabilities for importing subroutines from non-OO modules. But I'll write
> about that in another thread lest this one get diverted from finding me a
> good name. ;)

This was the trick:

our $SUPERCLASS = "Lingua::EN::Inflect";

sub import {
    my ($self, @syms) = @_;
    # Grep out the ones we provide:
    my $provide = join "|", map quotemeta, @EXPORT_OK;
    my @new_syms;
    for my $sym (@syms) {
        if ($sym =~ /^($provide)$/) {
            $self->export_to_level(1, $self, $sym);
        } else {
            push @new_syms, $sym;
        }
    }
    return unless @new_syms;

    # Pretend we don't exist
    @_ = ($SUPERCLASS, @new_syms);
    goto &Exporter::import;
}

-- 
`After all, we're not all freaky perverts' - Thorfinn

Reply via email to