"R. Joseph Newton" wrote: > Tushar Gokhale wrote: > > > I'm reading another perl script into array and want to commands from the the > > array as if normal perl commands. How do I do it? > > The truly helpful answer would be: "Don't do this!". OTOH, if you want to try > it out for yourself, I would suggest wrapping in in an eval block. This will > basically run the script for you. It will not do anything to compensate for > lack of program structure, though. > > Why do you want to run one script from another? We may be able to find better > ways for you to achieve your purpose. > > Joseph
Just read back through the list. Is this a continuation of the test harness thread? If so, you would get more focused help by staying on-thread. Reading the earlier thread showed that there was a purpose, but I still question its applicablity. The best test harness for a script is probably the command line. For any piece of code that can run from the command line on its own, a test harness is likely to obscure problems and make debugging more difficult, rather than less. Test harnesses are more appropriate for modules intended for use within a complex system. Since each module should, ideally be tested independently, we use test harnesses to simulate the demands and conditions the module will face when placed in production, in order to better focus on the problems that arise from other parts of the application system. Creating an effective test harness will therefore require some serious high-level design work. To be used effectively, a test harness should very closely reflect the interface of the module, from the calling routine's perspective. It should test all boundary conditions that may affect operation, as well as operation under normal circumstances. It would be very difficult to do this using a single generic harness for multiple scripts. The fan-out should be in the other direction. Any large system will probably require many test harnesses in its development, each specialized to test some portion of the system in isolation. For any script that can be run from the command line, the interpreter itself shold be an adequate test harness. It will provide focused feedback on both the sytactic integrity of the code, and warnings of likely logic errors. An interactive debugger can help, also. I believe that there is something along that line available with the standard install of Perl, but I haven't explored it myself. You might try: perldoc perldebug for more information on the built-in test harness for scripts. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>