in reply to Re: Re: Coding for two platforms in one Script
in thread Coding for two platforms in one Script

You shouldn't get any errors when the module is required unless it has bugs. Are you talking about undefined variable errors, or are you using subroutines imported from the module during a use()?

There is no need to require the module in each block. Just require it once. If you are using imported subs, you will need to import it once in each module that uses those subs.

It's hard to understand why you're getting these errors, so maybe you should try to post a small example of some code that gives you errors when you use require.

  • Comment on Re: Re: Re: Coding for two platforms in one Script

Replies are listed 'Best First'.
Re: Re: Re: Re: Coding for two platforms in one Script
by BoredByPolitics (Scribe) on Dec 06, 2001 at 23:19 UTC

    I finally worked out what was causing the 'undefined variable' errors, and have resolved them.

    The POD docs for Win32::EventLog imply that you can leave undefined variables which you don't want to use. This is true, from a functional perspective, but the module itself doesn't check that everything it's putting into a subroutine call is defined, hence the errors.

    So the solution (for this module) is to either define the variables in the Report call properly, or set them to null/zero. I've also found that I need to set the machine name in the new() call, otherwise it also generates an undefined error.

    You live and learn ;-)