Hi All,
Does anyone know a quick and dirty way to have one Perl program call another as a module.
I have two complete and separate Perl programs, one gives a list of log files and then when you select one, and click "View", it runs the other program which displays the file nice and orderly for the user to see.
The way I have it set up now is using a 'system' call, which takes the name of the second program in a string $syscommand and runs
$my_output = system ($syscommand)
This runs the program just fine, passing the selected record as an argument, and after closing goes back where you started.
However...........the local Powers that Be want me to change this by instead making the second program a module, being referenced as a subroutine in the first program.
So (I assume) there would be a line in the first program:
use 2nd_program;
and then a call in the first program:
2nd_program_subroutine();
I have tried examples, articles, etc, and the farthest I've gotten is a memory fault/core dump.
Is there a way to convert a freestanding 2nd program quickly into a module, and run it from the 1st program?
Would appreciate advice....thanks
jpasquini
Does anyone know a quick and dirty way to have one Perl program call another as a module.
I have two complete and separate Perl programs, one gives a list of log files and then when you select one, and click "View", it runs the other program which displays the file nice and orderly for the user to see.
The way I have it set up now is using a 'system' call, which takes the name of the second program in a string $syscommand and runs
$my_output = system ($syscommand)
This runs the program just fine, passing the selected record as an argument, and after closing goes back where you started.
However...........the local Powers that Be want me to change this by instead making the second program a module, being referenced as a subroutine in the first program.
So (I assume) there would be a line in the first program:
use 2nd_program;
and then a call in the first program:
2nd_program_subroutine();
I have tried examples, articles, etc, and the farthest I've gotten is a memory fault/core dump.
Is there a way to convert a freestanding 2nd program quickly into a module, and run it from the 1st program?
Would appreciate advice....thanks
jpasquini