Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Re: Coding for two platforms in one Script

by perrin (Chancellor)
on Dec 05, 2001 at 23:20 UTC ( #129712=note: print w/replies, xml ) Need Help??


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 ;-)

    Pete

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://129712]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2022-05-23 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?