- I have an object that exposes some callback methods, for example:
$x = $Callback->GetFieldName(2);
To create this object and expose it to the script, I actually inject some code at the start of the script:
$CallBack = new Callback(<actual address of external object here>);
I'm sure there must a cleaner way that doesn't involve modifying the passed script. How can I tell Perl about an external interface in such a way as to leave the above calling convention working? - I want to set $_ at the start of processing, because the simplest script should be something as simple as
reverse;
the input being $_ at the beginning, and $_ becoming the output at the end. I currently inject code (immediately after the code that creates the callback object above) that uses a method on that callback:
$_ = $Callback->GetInput();
I'm successfully retrieving $_ by using
sv = GvSV(Interpreter->Idefgv);
at the end - but my previous use of
SV * defval = GvSV(m_Interpreter->Idefgv);
sv_setpv(defval, Input);
fails horribly on SUSE 10.2 built using gcc. - If perl_parse() fails, how do I find the reason and line number of the error(s) in the source? (I'm sure I'm missing something obvious.)
Oh, and yes, there are tens of thousands of lines of existing scripts which rely on the existing behaviour, going back quite a few years, which our new spiffy Java solution must address ... enough with the buzzword bingo.