D
Dave Saville
I have a commercial program. The author has provided "hooks" at
various points in the program. The "hook" code can be written in
anything. Most of mine are perl but there is a problem in that I
actually want to run more than one script per hook.
At present I have a master script per hook that runs the required
scripts. But performance wise I am (re)loading the perl interpreter
every script. All scripts take the same two parameters and it is not
practical to combine them into one as they may be used by themselves
or in more than one hook.
Is there some cunning way I can invoke a perl script from inside
another without turning it into a function/package? Remember I need to
use them standalone too.
I was thinking, without any real knowledge, if I could do something
like the following although I don't know how I would pass the
parameters.
use strict;
use warnings;
my $parm1 = shift;
my $parm2 = shift;
my $HANDLE;
open $HANDLE, "somecode.pl";
undef $/;
my $stuff = <$HANDLE>;
close $HANDLE;
eval $stuff;
All pointers gratefully received.
various points in the program. The "hook" code can be written in
anything. Most of mine are perl but there is a problem in that I
actually want to run more than one script per hook.
At present I have a master script per hook that runs the required
scripts. But performance wise I am (re)loading the perl interpreter
every script. All scripts take the same two parameters and it is not
practical to combine them into one as they may be used by themselves
or in more than one hook.
Is there some cunning way I can invoke a perl script from inside
another without turning it into a function/package? Remember I need to
use them standalone too.
I was thinking, without any real knowledge, if I could do something
like the following although I don't know how I would pass the
parameters.
use strict;
use warnings;
my $parm1 = shift;
my $parm2 = shift;
my $HANDLE;
open $HANDLE, "somecode.pl";
undef $/;
my $stuff = <$HANDLE>;
close $HANDLE;
eval $stuff;
All pointers gratefully received.