Jeremy White
2006-01-09 16:02:12 UTC
Given this code:
{
my $variable;
sub mysub {
# ... accessing $variable
}
}
from:
http://www.unix.org.ua/orelly/perl/cookbook/ch10_04.htm
Is there a way to get hold of the SV for $variable and manipulate it via XS?
I want to be able to write the contents of $variable in XS, then call mysub
via XS and then read the contents of $variable afterwards ($variable needs
to remain a closure as it is shared with other subs in the same block - the
block is evaled into existence during runtime).
All my attempts so far have failed, so I'm either being stupid, or can't it
be done?
Cheers,
jez.
{
my $variable;
sub mysub {
# ... accessing $variable
}
}
from:
http://www.unix.org.ua/orelly/perl/cookbook/ch10_04.htm
Is there a way to get hold of the SV for $variable and manipulate it via XS?
I want to be able to write the contents of $variable in XS, then call mysub
via XS and then read the contents of $variable afterwards ($variable needs
to remain a closure as it is shared with other subs in the same block - the
block is evaled into existence during runtime).
All my attempts so far have failed, so I'm either being stupid, or can't it
be done?
Cheers,
jez.