Module Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne Happ

    Module Question


    I have a question about finding a module at rutime.

    Here's what I would like to do.

    push(@INC, @notknowntillru nning);

    use lib 'notknowntill running';

    use foo;

    My problem is I do not know the where the Module will be till the script
    runs. Perl won't compile the script because at time of compilation the
    enviroment is not known.

    This is a corporate computing environment and I can't change the value of
    @INC before running my script. (It's a policy thing.)

    Any ideas on how to get the same effect?

    Wayne


  • Randal L. Schwartz

    #2
    Re: Module Question

    >>>>> "Wayne" == Wayne Happ <whapp@comcast. net> writes:

    Wayne> Any ideas on how to get the same effect?

    First, comp.lang.perl has been dead for ten years. You probably
    want comp.lang.perl. misc instead.

    Second, you haven't said *how* you would determine the location of
    the module. But maybe this will help:

    BEGIN {
    my $module_locatio n = magical_functio n_or_sequence_y ou_did_not_desc ribe();
    push @INC, $module_locatio n;
    }

    use Module::Found:: In::Extra::Loca tion;

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <merlyn@stonehe nge.com> <URL:http://www.stonehenge. com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.St onehenge.com for onsite and open-enrollment Perl training!

    Comment

    Working...