in reply to IPC::Run harness question
G'day italdesign,
"So for some reason, finish() doesn't seem to be getting the proper $h object."
The most likely reason is that you're using package global variables. If you move code from one package to another, the variables in that code will be global to the new package. Use lexical variables!
Using package global variables will have other problems; for instance, in the code you show, you don't capture the object invoking your methods but instead just use whatever value $self happens to have.
Furthermore, the code you have provided appears to have problems which strict would have alerted you to: 'vars' would tell you about "$self" and "$h" and 'subs' would tell you about "h". strict may find other problems in your complete code; warnings will alert you to other types of problems.
To save yourself from another potential bug which can be hard to track down, I'd recommend you stop using the strongly discouraged Indirect Object Syntax.
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IPC::Run harness question
by italdesign (Novice) on May 05, 2014 at 20:29 UTC | |
by kcott (Archbishop) on May 06, 2014 at 07:25 UTC | |
by italdesign (Novice) on May 06, 2014 at 21:51 UTC |