Greetings all perl programmers. I am a recent addition to your ranks and as such have a question that may just be a matter of syntax.
I wish to populate a hash with a package. In package is a function pointer and a error string, the function or sub in perl's case needs to take a list
in c I would do this:
typedef struct FunctionInfo {
bool (*fpFunction)(List *spList);
char *cpRetVal;
}FunctionInfo, *pFunctionInfo;
then I would create a list of these with a key using a char str
Now in perl I know there are packages though they are different in declaration and all of that.
However the assignment of the function pointer is where things get a little fuzzy for me.
if I have some sub
sub Action(@ActionList)
{
}
and I want a function pointer to that
$fpAction = Action;
from what I have experienced this executes the function, in which case I use single quotes
$fpAction = 'Action'; (though for clarity I use &Action, but it should be the same);
then for using the function pointer the book I have says to use &$fpAction but this yields an undefined sub.
So I am a lilttle confused as to the function pointer assignment syntax.
I wish to populate a hash with a package. In package is a function pointer and a error string, the function or sub in perl's case needs to take a list
in c I would do this:
typedef struct FunctionInfo {
bool (*fpFunction)(List *spList);
char *cpRetVal;
}FunctionInfo, *pFunctionInfo;
then I would create a list of these with a key using a char str
Now in perl I know there are packages though they are different in declaration and all of that.
However the assignment of the function pointer is where things get a little fuzzy for me.
if I have some sub
sub Action(@ActionList)
{
}
and I want a function pointer to that
$fpAction = Action;
from what I have experienced this executes the function, in which case I use single quotes
$fpAction = 'Action'; (though for clarity I use &Action, but it should be the same);
then for using the function pointer the book I have says to use &$fpAction but this yields an undefined sub.
So I am a lilttle confused as to the function pointer assignment syntax.