Ignore:
Timestamp:
2013-05-06T15:23:45+12:00 (11 years ago)
Author:
jmt12
Message:

Replacing hardcoded additions to INC and PATH environment variables with conditional ones - this allows us to use the order of values in these variables for precedence, thus allows better support for extensions that override classifiers, plugins etc. ENV and PATH functions already exists in util, but augmentINC() is a new function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/parse2.pm

    r22732 r27303  
    3535    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
    3636    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
    37     unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
    38     unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
     37
     38    # - ensure perllib paths don't already exist in INC before adding, other-
     39    # wise we risk clobbering plugin/classifier inheritence implied by order
     40    # of paths in INC [jmt12]
     41    my $gsdl_perllib_path = $ENV{'GSDLHOME'} . '/perllib';
     42    my $found_path = 0;
     43    foreach my $inc_path (@INC)
     44    {
     45      if ($inc_path eq $gsdl_perllib_path)
     46      {
     47        $found_path = 1;
     48        last;
     49      }
     50    }
     51    if (!$found_path)
     52    {
     53      unshift (@INC, $gsdl_perllib_path);
     54      unshift (@INC, $gsdl_perllib_path . '/cpan');
     55    }
    3956}
    4057
Note: See TracChangeset for help on using the changeset viewer.