Subverting case insensitivity for module names under Mac HFS

Andy Wardley abw at wardley.org
Mon Jun 23 12:23:44 BST 2008


Andy Wardley wrote:
>     foreach my $base (@$bases) {
>         foreach my $name (@names) {
>             $module = $base . '::' . $name;
>             return $module if UTILS->maybe_load_module($module);

This seems to do the trick without too much hassle.

      $loaded = 0
      foreach my $base (@$bases) {
          foreach my $name (@names) {
              $module = $base . '::' . $name;
              return $module
                 if ($loaded || UTILS->maybe_load_module($module) && ++$loaded)
                 && @{$module . '::ISA'};

Given that all the modules are subclasses of Template::Plugin, I can be sure
that they'll define an @ISA.  The $loaded guard prevents the same module being
loaded several time and spewing out "subroutine redefined" warnings.

Thanks for listening, Problem Pony!

A


More information about the london.pm mailing list