Module Question

Discussion in 'Perl' started by Wayne Happ, Jan 7, 2006.

  1. Wayne Happ

    Wayne Happ Guest

    I have a question about finding a module at rutime.

    Here's what I would like to do.

    push(@INC, @notknowntillrunning);

    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
     
    Wayne Happ, Jan 7, 2006
    #1
    1. Advertising

  2. >>>>> "Wayne" == Wayne Happ <> 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_location = magical_function_or_sequence_you_did_not_describe();
    push @INC, $module_location;
    }

    use Module::Found::In::Extra::Location;

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
     
    Randal L. Schwartz, Jan 8, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jiong Feng
    Replies:
    2
    Views:
    539
    Wade A. Hilmo [MS]
    Nov 29, 2003
  2. Daniel Ortmann
    Replies:
    4
    Views:
    584
    Skip Montanaro
    Jul 2, 2003
  3. Marcus Schneider
    Replies:
    2
    Views:
    341
    Michael Peuser
    Aug 16, 2003
  4. Maric Michaud
    Replies:
    0
    Views:
    7,194
    Maric Michaud
    Jun 24, 2006
  5. Zev Blut
    Replies:
    3
    Views:
    173
    trans. (T. Onoma)
    Nov 24, 2004
Loading...

Share This Page