EPIC pollutes @INC in adding resource’s dir

2007-09-21
2013-05-20
  • EPIC pollutes @INC in adding resource’s directory
    -------------------------------------------------

    When running or debugging a Perl module, EPIC pollutes @INC with the resource directory. It adds the directory in the beginning of the list. In consequence, you can’t import a standard Perl module (like Config.pm) if you have a module of the same name in your directory.
    I don’t known the real reason of adding the resource directory when ‘.’ is already in @INC!

    For example, I have a package MyPackage (It’s a directory) with a module named Config.pm and another named MyModule.pm that uses Config standard Perl module (but not MyPackage::Config). When you run MyModule.pm, the instruction ‘use Config;’ imports MyPackage::Config!

    I have the same problem when debugging a Perl script because the debugger imports Config. See whats_in_inc.pl below…

    Examples:
    MyModule.pm and Config.pm are in MyPackage directory.
    ------- MyModule.pm -------
    #!/usr/bin/perl

    ####
    # @author: Laurent LAPORTE
    # @summary: Module using Config, with a *main* (for testing).
    # @date: 2007-09-21
    ####

    use strict;

    package MyPackage::MyModule;

    use Config;

    sub printArchname() {
        print "archname is " . $Config{archname} . "\n"; # Ooops : Global symbol "%Config" requires explicit package name...
    }

    package main;

    MyPackage::MyModule::printArchname();

    1;

    ------- Config.pm -------
    #!/usr/bin/perl

    ####
    # @author: Laurent LAPORTE
    # @summary: Config module in MyPackage package.
    # @date: 2007-09-21
    ####

    use strict;

    package MyPackage::Config;

    sub getConfig() {
        return "The config of MyPackage";
    }

    1;

    ------- whats_in_inc.pl -------
    use strict;
    print "'$_'\n" foreach (@INC);

    Configuration:
    The problem doesn’t exists in EPIC v0.5.33, I don’t know if it exists between 0.5.33 and 0.5.35, but it exists in v0.5.36 and v0.5.40…
    eclipse v3.2 or v3.3
    perl v5.8.8 built for MSWin32-x86-multi-thread