Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I would love to see this stucture in perl like a HASH or OO. For exampletypedef struct { int Msg; short uid; short LineType; char *Line; // pointer to text char Sound; // 0 for no sound, otherwise sound # char *Cmd; // String of command including ! char OpOnly; // Is the command for ops only? char *HelpFile; // Help Filename for this command int CmdID; // CmdID - The bot core doesn't care about this +, } BOTMSG;
The given examples in Perlembed documentation only show how to pass a single pointer, an integer, or an string value but it do not say anything about passing complex structures and how to manipulate those in perl. I appreciate all help you can give me,sub set_struct { xxxxx = @_; # <-- ??? $BOTMSG{Msg} = "1"; $BOTMSG{uid} = "1024"; $BOTMSG{LineType} = "100"; $BOTMSG{Line} = "Hello World\n"; $BOTMSG{Cmd} = "/!say"; $BOTMSG{OpOnly} = "yes"; $BOTMSG{HelpFile} = "C\tmp\help\help1.txt"; $BOTMSG{CmdID} = "1234567890"; return %BOTMSG; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Empedding perl into C - how to pass complex structures to the perl ?
by broquaint (Abbot) on Feb 27, 2002 at 13:16 UTC | |
|
Re: Empedding perl into C - how to pass complex structures to the perl ?
by Matts (Deacon) on Feb 27, 2002 at 13:16 UTC | |
by Anonymous Monk on Feb 28, 2002 at 08:15 UTC |