CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Regarding perl intepretation.



Jun 7, 2004, 3:11 AM

Post #1 of 2 (885 views)
Regarding perl intepretation. Can't Post


I have a strange problem.

I have perl modules which are platform specific.But there is a file which contains functions of which some are used by some of the platform specific modules.Eg let is the HPUX module and the windows specific module.Let the common module be

In and i have the following line of code.

use X qw(:Hp); ---> this is in this module uses some func abc() in

use X qw(:win); ----> this is in this module uses some function def() in has windows specific stuff.

when i try to tun my program on a HPUX box why does the intepreter try to load some windows modules in eventhough this is run on the HPUX box and throws error.....

Can some Perl Guru Help...


Guru Dutta

Thaumaturge / Moderator

Jun 8, 2004, 1:04 AM

Post #2 of 2 (879 views)
Re: [rgdutta] Regarding perl intepretation. [In reply to] Can't Post

I think we probably need to see the code in that loads the other modules.

If you're using code like this:

if ($hp) { 
use Some::HP::Module;

if ($win) {
use Some::Win::Module;

Then that doesn't do what you think it does. It will always try to load both of the modules. This is because "use" is executed at compile time and the $hp and $win variables aren't given values until run time.

You probably want to look at using "require" and "import" instead.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives