httpd-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: cvs commit mails
Date Sat, 09 Dec 2000 21:54:01 GMT

--- Joshua Slive <slive@finance.commerce.ubc.ca> wrote:
> The relevant code is:
> 
>    local($path) = @_;
>     my($mapped, $dir) = ("", $path);
>     my(%mapping) = ('apache-2.0/src/include'            => 'httpd-docs-2.0',
>                     'apache-2.0/src/os/unix'            => 'httpd-docs-2.0',
>                     'apache-2.0/src/lib/apr/include'    => 'httpd-docs-2.0',
>                     'httpd-2.0/docs'                    => 'httpd-docs-2.0');
> 
>     if ($mapped = $mapping{$path}) {
>     }

Hrm, a substring match is tricky the way it's set up.  You'd have to loop through
all the keys of %mapping looking for a match, something like this:

    foreach $mainpath (keys %mapping) {
        if ($mainpath =~ /^$path/) {
            $mapped = $mapping{$mainpath};
            break;
        }
    }

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

Mime
View raw message