summaryrefslogtreecommitdiff
path: root/src/perl/perl-sources.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/perl/perl-sources.c')
-rw-r--r--src/perl/perl-sources.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/perl/perl-sources.c b/src/perl/perl-sources.c
index be1a4188..06516474 100644
--- a/src/perl/perl-sources.c
+++ b/src/perl/perl-sources.c
@@ -64,6 +64,7 @@ static void perl_source_destroy(PERL_SOURCE_REC *rec)
static int perl_source_event(PERL_SOURCE_REC *rec)
{
dSP;
+ int retcount;
ENTER;
SAVETMPS;
@@ -73,14 +74,18 @@ static int perl_source_event(PERL_SOURCE_REC *rec)
PUTBACK;
perl_source_ref(rec);
- perl_call_sv(rec->func, G_EVAL|G_DISCARD);
+ retcount = perl_call_sv(rec->func, G_EVAL|G_SCALAR);
SPAGAIN;
if (SvTRUE(ERRSV)) {
char *error = g_strdup(SvPV(ERRSV, PL_na));
signal_emit("script error", 2, rec->script, error);
g_free(error);
+ } else if (retcount > 0 && POPi != 0) {
+ /* stopped */
+ perl_source_destroy(rec);
}
+
perl_source_unref(rec);
PUTBACK;