mycroft_ has asked for the wisdom of the Perl Monks concerning the following question:

I was using a user-defined module (xxxx.pm) in an NT system by just putting "use xxxx;" and using the modules that were defined there with no specification of namespace (e.g, foo($text);). Now, trying to use the same module on a Win98 installation, with the same script, I get "$main::foo" not found. Any ideas on how to fix it?

Replies are listed 'Best First'.
(Ovid) Re: Win98 &
by Ovid (Cardinal) on Dec 17, 2000 at 01:05 UTC
    If you have made absolutely no changes, you'll want to check in the module to see how the variable or subroutine that you're accessing is getting exported. Are there conditions under which it's not exported? Maybe you should specify what you want to import into your script. For example, if you want to import the standard functions from CGI.pm, you add use CGI qw /:standard/;.

    Also, you've specified a subroutine AND a scalar. Which is it? foo($text) is a function that you're calling and $main::foo is accessing the scalar $foo in package main.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      Thanks a zillion for your help. I ended up re-installing Perl and then it worked; probably a registry problem... : ( Cheers!
Re: Win98 &
by arturo (Vicar) on Dec 18, 2000 at 01:53 UTC

    Stab in the dark: I've had problems importing modules on Win95 due to capitalization errors; the use wouldn't fail, but the "imported" functions weren't imported. So check your capitalization and make sure it conforms to the capitalization on the module file ("xxx.pm"). And it wouldn't make sense, if NT were case-sensitive and 95/98 isn't, that it would work on NT and not on 98. But we all know with whom we're dealing, so I don't take it that the problems always have to make sense =) (the best I can say is 'what do you have to lose?' =)

    I know *nothing* about WinNT, about its case-sensitivity and such, so that's why it's such a huge stab in the dark.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      Thanks a zillion for your help. I ended up re-installing Perl and then it worked; probably a registry problem... : ( All the best!