Grokbase Groups Perl xs August 2006
FAQ

<lililevy@hotmail.com> writes:
Hello all,
I noticed one more thing. You code below has a try {} catch {}.
Perl is C not C++. It does "exceptions" (i.e. eval { die } ) using
setjmp()/longjmp(). That does not automatically co-exist with try/catch.
So if your inner code ever throw-s perl's state will be in indeterminate
state. For example it could leave file handles open, then when process
ran out of file handles next perl attempt could fail.
Don't know why it would recover though.
__declspec(dllexport)
long CFTPerlUserExitInstanceRun(char *FileName,char *FuncName,struct
PerlParmInfo *ParmsVec,unsigned int ParmsVecSize,char* pReason,int
*pCount,int *pUserExitRc, int *pPerlParseRc)
{
long lRc = 0;
int count = -1;
PerlInterpreter* my_perl = NULL;


char *embedding[] = { "", FileName};

while (true)
{
my_perl = perl_alloc();
if (my_perl == NULL)
{
lRc = -1;
break;
}


EnterCriticalSection(&g_ParserCS);

try
{
PERL_SET_CONTEXT(my_perl);
PL_perl_destruct_level = 1;
perl_construct(my_perl);
if (pfnBreakHandlerReset)
{
(*pfnBreakHandlerReset)();
}

*pPerlParseRc = perl_parse(my_perl, xs_init, 2, embedding ,
NULL);
lRc = *pPerlParseRc;

LeaveCriticalSection(&g_ParserCS);
}
catch(...)
{
LeaveCriticalSection(&g_ParserCS);
lRc = -6;
break;
}

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
groupxs @
categoriesperl
postedAug 14, '06 at 8:55a
activeSep 2, '06 at 9:59a
posts3
users2
websiteperl.org

2 users in discussion

Nick Ing-Simmons: 2 posts Lililevy: 1 post

People

Translate

site design / logo © 2019 Grokbase