source: perlconfig.c @ e67359b

release-1.10release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since e67359b was e67359b, checked in by David Benjamin <davidben@mit.edu>, 14 years ago
Add owl_new_av to abstract owl_list to AV* Takes a callback function to convert elements to SV*. Signed-off-by: David Benjamin <davidben@mit.edu>
  • Property mode set to 100644
File size: 14.3 KB
RevLine 
[f1e629d]1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <sys/types.h>
5#include <sys/stat.h>
6#include <errno.h>
[908e388]7#define OWL_PERL
[f1e629d]8#include "owl.h"
9
[8203afd]10extern XS(boot_BarnOwl);
[908e388]11extern XS(boot_DynaLoader);
[af1920fd]12/* extern XS(boot_DBI); */
[f1e629d]13
[c3acb0b]14static void owl_perl_xs_init(pTHX)
15{
[e19eb97]16  const char *file = __FILE__;
[f1e629d]17  dXSUB_SYS;
18  {
[8203afd]19    newXS("BarnOwl::bootstrap", boot_BarnOwl, file);
[908e388]20    newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
[f1e629d]21  }
22}
23
[d1b1cf6]24
25SV *owl_new_sv(const char * str)
26{
27  SV *ret = newSVpv(str, 0);
[68f358c]28  if (is_utf8_string((const U8 *)str, strlen(str))) {
[d1b1cf6]29    SvUTF8_on(ret);
30  } else {
[eea72a13]31    char *escape = owl_escape_highbit(str);
32    owl_function_error("Internal error! Non-UTF-8 string encountered:\n%s", escape);
33    owl_free(escape);
[d1b1cf6]34  }
35  return ret;
36}
37
[e67359b]38AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
39{
40  AV *ret;
41  int i;
42  void *element;
43
44  ret = newAV();
45
46  for (i = 0; i < owl_list_get_size(l); i++) {
47    element = owl_list_get_element(l, i);
48    av_push(ret, to_sv(element));
49  }
50
51  return ret;
52}
53
[c08c70a]54SV *owl_perlconfig_message2hashref(const owl_message *m)
[c3acb0b]55{
[1cc95709]56  HV *h, *stash;
[f1e629d]57  SV *hr;
[e19eb97]58  const char *type;
[fa4562c]59  char *ptr, *utype, *blessas;
[b0430a6]60  int i, j;
[25fb825]61  const owl_pair *pair;
[4542047]62  const owl_filter *wrap;
[f1e629d]63
64  if (!m) return &PL_sv_undef;
[f6b319c]65  wrap = owl_global_get_filter(&g, "wordwrap");
66  if(!wrap) {
67      owl_function_error("wrap filter is not defined");
68      return &PL_sv_undef;
69  }
70
[f1e629d]71  h = newHV();
72
[3ea31b6]73#define MSG2H(h,field) (void)hv_store(h, #field, strlen(#field),        \
[d1b1cf6]74                                      owl_new_sv(owl_message_get_##field(m)), 0)
[f1e629d]75
76  if (owl_message_is_type_zephyr(m)
77      && owl_message_is_direction_in(m)) {
78    /* Handle zephyr-specific fields... */
79    AV *av_zfields;
80
81    av_zfields = newAV();
82    j=owl_zephyr_get_num_fields(owl_message_get_notice(m));
83    for (i=0; i<j; i++) {
[5376a95]84      ptr=owl_zephyr_get_field_as_utf8(owl_message_get_notice(m), i+1);
[d1b1cf6]85      av_push(av_zfields, owl_new_sv(ptr));
[b0430a6]86      owl_free(ptr);
[f1e629d]87    }
[3ea31b6]88    (void)hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0);
[f1e629d]89
[3ea31b6]90    (void)hv_store(h, "auth", strlen("auth"), 
[d1b1cf6]91                   owl_new_sv(owl_zephyr_get_authstr(owl_message_get_notice(m))),0);
[f1e629d]92  }
93
[421c8ef7]94  j=owl_list_get_size(&(m->attributes));
95  for(i=0; i<j; i++) {
96    pair=owl_list_get_element(&(m->attributes), i);
[3ea31b6]97    (void)hv_store(h, owl_pair_get_key(pair), strlen(owl_pair_get_key(pair)),
[d1b1cf6]98                   owl_new_sv(owl_pair_get_value(pair)),0);
[421c8ef7]99  }
100 
[f1e629d]101  MSG2H(h, type);
102  MSG2H(h, direction);
103  MSG2H(h, class);
104  MSG2H(h, instance);
105  MSG2H(h, sender);
106  MSG2H(h, realm);
107  MSG2H(h, recipient);
108  MSG2H(h, opcode);
109  MSG2H(h, hostname);
110  MSG2H(h, body);
111  MSG2H(h, login);
112  MSG2H(h, zsig);
113  MSG2H(h, zwriteline);
114  if (owl_message_get_header(m)) {
115    MSG2H(h, header); 
116  }
[d1b1cf6]117  (void)hv_store(h, "time", strlen("time"), owl_new_sv(owl_message_get_timestr(m)),0);
[d1ae4a4]118  (void)hv_store(h, "unix_time", strlen("unix_time"), newSViv(m->time), 0);
[3ea31b6]119  (void)hv_store(h, "id", strlen("id"), newSViv(owl_message_get_id(m)),0);
120  (void)hv_store(h, "deleted", strlen("deleted"), newSViv(owl_message_is_delete(m)),0);
121  (void)hv_store(h, "private", strlen("private"), newSViv(owl_message_is_private(m)),0);
122  (void)hv_store(h, "should_wordwrap",
123                 strlen("should_wordwrap"), newSViv(
124                                                    owl_filter_message_match(wrap, m)),0);
[f1e629d]125
[30678ae]126  type = owl_message_get_type(m);
[8fba2ee]127  if(!type || !*type) type = "generic";
[fa4562c]128  utype = owl_strdup(type);
129  utype[0] = toupper(type[0]);
130  blessas = owl_sprintf("BarnOwl::Message::%s", utype);
[f1e629d]131
[19bab8e]132  hr = newRV_noinc((SV*)h);
[1cc95709]133  stash =  gv_stashpv(blessas,0);
134  if(!stash) {
135    owl_function_error("No such class: %s for message type %s", blessas, owl_message_get_type(m));
136    stash = gv_stashpv("BarnOwl::Message", 1);
137  }
138  hr = sv_bless(hr,stash);
[fa4562c]139  owl_free(utype);
[30678ae]140  owl_free(blessas);
141  return hr;
[f1e629d]142}
143
[dbe8729]144SV *owl_perlconfig_curmessage2hashref(void)
[c3acb0b]145{
[f1e629d]146  int curmsg;
[9e5c9f3]147  const owl_view *v;
[f1e629d]148  v=owl_global_get_current_view(&g);
149  if (owl_view_get_size(v) < 1) {
150    return &PL_sv_undef;
151  }
152  curmsg=owl_global_get_curmsg(&g);
153  return owl_perlconfig_message2hashref(owl_view_get_element(v, curmsg));
154}
155
[30678ae]156/* XXX TODO: Messages should round-trip properly between
157   message2hashref and hashref2message. Currently we lose
158   zephyr-specific properties stored in the ZNotice_t
[87dfeb7]159
160   This has been somewhat addressed, but is still not lossless.
[30678ae]161 */
162owl_message * owl_perlconfig_hashref2message(SV *msg)
163{
164  owl_message * m;
165  HE * ent;
166  I32 count, len;
[e19eb97]167  const char *key,*val;
[30678ae]168  HV * hash;
[ad15610]169  struct tm tm;
[30678ae]170
171  hash = (HV*)SvRV(msg);
172
173  m = owl_malloc(sizeof(owl_message));
174  owl_message_init(m);
175
176  count = hv_iterinit(hash);
177  while((ent = hv_iternext(hash))) {
178    key = hv_iterkey(ent, &len);
179    val = SvPV_nolen(hv_iterval(hash, ent));
180    if(!strcmp(key, "type")) {
181      owl_message_set_type(m, val);
182    } else if(!strcmp(key, "direction")) {
183      owl_message_set_direction(m, owl_message_parse_direction(val));
184    } else if(!strcmp(key, "private")) {
185      SV * v = hv_iterval(hash, ent);
186      if(SvTRUE(v)) {
187        owl_message_set_isprivate(m);
188      }
189    } else if (!strcmp(key, "hostname")) {
190      owl_message_set_hostname(m, val);
191    } else if (!strcmp(key, "zwriteline")) {
192      owl_message_set_zwriteline(m, val);
193    } else if (!strcmp(key, "time")) {
194      m->timestr = owl_strdup(val);
195      strptime(val, "%a %b %d %T %Y", &tm);
196      m->time = mktime(&tm);
197    } else {
198      owl_message_set_attribute(m, key, val);
199    }
200  }
201  if(owl_message_is_type_admin(m)) {
202    if(!owl_message_get_attribute_value(m, "adminheader"))
203      owl_message_set_attribute(m, "adminheader", "");
204  }
[87dfeb7]205#ifdef HAVE_LIBZEPHYR
206  if (owl_message_is_type_zephyr(m)) {
207    ZNotice_t *n = &(m->notice);
208    n->z_kind = ACKED;
209    n->z_port = 0;
210    n->z_auth = ZAUTH_NO;
211    n->z_checked_auth = 0;
[712caac]212    n->z_class = zstr(owl_message_get_class(m));
213    n->z_class_inst = zstr(owl_message_get_instance(m));
214    n->z_opcode = zstr(owl_message_get_opcode(m));
215    n->z_sender = zstr(owl_message_get_sender(m));
216    n->z_recipient = zstr(owl_message_get_recipient(m));
217    n->z_default_format = zstr("[zephyr created from perl]");
218    n->z_multinotice = zstr("[zephyr created from perl]");
[87dfeb7]219    n->z_num_other_fields = 0;
220    n->z_message = owl_sprintf("%s%c%s", owl_message_get_zsig(m), '\0', owl_message_get_body(m));
221    n->z_message_len = strlen(owl_message_get_zsig(m)) + strlen(owl_message_get_body(m)) + 1;
222  }
223#endif
[30678ae]224  return m;
225}
[f1e629d]226
227/* Calls in a scalar context, passing it a hash reference.
228   If return value is non-null, caller must free. */
[c08c70a]229char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
[c3acb0b]230{
[f1e629d]231  dSP ;
[c4ba74d]232  int count;
[f1e629d]233  SV *msgref, *srv;
[909771e]234  char *out;
[f1e629d]235 
236  ENTER ;
237  SAVETMPS;
238 
239  PUSHMARK(SP) ;
240  msgref = owl_perlconfig_message2hashref(m);
[19bab8e]241  XPUSHs(sv_2mortal(msgref));
[f1e629d]242  PUTBACK ;
243 
244  count = call_pv(subname, G_SCALAR|G_EVAL|G_KEEPERR);
245 
246  SPAGAIN ;
247
248  if (SvTRUE(ERRSV)) {
[ce6721f]249    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
[27c3a93]250    /* and clear the error */
251    sv_setsv (ERRSV, &PL_sv_undef);
[f1e629d]252  }
253
254  if (count != 1) {
255    fprintf(stderr, "bad perl!  no biscuit!  returned wrong count!\n");
256    abort();
257  }
258
259  srv = POPs;
260
261  if (srv) {
[909771e]262    out = owl_strdup(SvPV_nolen(srv));
[f1e629d]263  } else {
264    out = NULL;
265  }
266 
267  PUTBACK ;
268  FREETMPS ;
269  LEAVE ;
270
271  return out;
272}
273
[25729b2]274
275/* Calls a method on a perl object representing a message.
276   If the return value is non-null, the caller must free it.
277 */
[c08c70a]278char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv)
[25729b2]279{
280  dSP;
[909771e]281  unsigned int count, i;
[25729b2]282  SV *msgref, *srv;
[909771e]283  char *out;
[25729b2]284
285  msgref = owl_perlconfig_message2hashref(m);
286
287  ENTER;
288  SAVETMPS;
289
290  PUSHMARK(SP);
[19bab8e]291  XPUSHs(sv_2mortal(msgref));
[25729b2]292  for(i=0;i<argc;i++) {
[d1b1cf6]293    XPUSHs(sv_2mortal(owl_new_sv(argv[i])));
[25729b2]294  }
295  PUTBACK;
296
297  count = call_method(method, G_SCALAR|G_KEEPERR|G_EVAL);
298
299  SPAGAIN;
300
301  if(count != 1) {
[f278ff3]302    fprintf(stderr, "perl returned wrong count %u\n", count);
[25729b2]303    abort();
304  }
305
306  if (SvTRUE(ERRSV)) {
[ce6721f]307    owl_function_error("Error: '%s'", SvPV_nolen(ERRSV));
[25729b2]308    /* and clear the error */
309    sv_setsv (ERRSV, &PL_sv_undef);
310  }
311
312  srv = POPs;
313
314  if (srv) {
[909771e]315    out = owl_strdup(SvPV_nolen(srv));
[25729b2]316  } else {
317    out = NULL;
318  }
319
320  PUTBACK;
321  FREETMPS;
322  LEAVE;
323
324  return out;
325}
326
327
[e19eb97]328char *owl_perlconfig_initperl(const char * file, int *Pargc, char ***Pargv, char *** Penv)
[c3acb0b]329{
[d03091c]330  int ret;
[f1e629d]331  PerlInterpreter *p;
[4e0f545]332  char *err;
[e19eb97]333  const char *args[4] = {"", "-e", "0;", NULL};
[fd8dfe7]334  AV *inc;
335  char *path;
[f1e629d]336
337  /* create and initialize interpreter */
[e8c6d8f]338  PERL_SYS_INIT3(Pargc, Pargv, Penv);
[f1e629d]339  p=perl_alloc();
[4d86e06]340  owl_global_set_perlinterp(&g, p);
[f1e629d]341  perl_construct(p);
342
343  owl_global_set_no_have_config(&g);
344
[fa4562c]345  ret=perl_parse(p, owl_perl_xs_init, 2, (char **)args, NULL);
[f1e629d]346  if (ret || SvTRUE(ERRSV)) {
[ce6721f]347    err=owl_strdup(SvPV_nolen(ERRSV));
[4e0f545]348    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
349    return(err);
[f1e629d]350  }
351
352  ret=perl_run(p);
353  if (ret || SvTRUE(ERRSV)) {
[ce6721f]354    err=owl_strdup(SvPV_nolen(ERRSV));
[4e0f545]355    sv_setsv(ERRSV, &PL_sv_undef);     /* and clear the error */
356    return(err);
[f1e629d]357  }
358
359  owl_global_set_have_config(&g);
360
361  /* create legacy variables */
[c415aca]362  get_sv("BarnOwl::id", TRUE);
363  get_sv("BarnOwl::class", TRUE);
364  get_sv("BarnOwl::instance", TRUE);
365  get_sv("BarnOwl::recipient", TRUE);
366  get_sv("BarnOwl::sender", TRUE);
367  get_sv("BarnOwl::realm", TRUE);
368  get_sv("BarnOwl::opcode", TRUE);
369  get_sv("BarnOwl::zsig", TRUE);
370  get_sv("BarnOwl::msg", TRUE);
371  get_sv("BarnOwl::time", TRUE);
372  get_sv("BarnOwl::host", TRUE);
373  get_av("BarnOwl::fields", TRUE);
[00f9a7d]374
375  if(file) {
[8203afd]376    SV * cfg = get_sv("BarnOwl::configfile", TRUE);
[00f9a7d]377    sv_setpv(cfg, file);
378  }
379
[fd8dfe7]380  /* Add the system lib path to @INC */
381  inc = get_av("INC", 0);
382  path = owl_sprintf("%s/lib", owl_get_datadir());
383  av_unshift(inc, 1);
[d1b1cf6]384  av_store(inc, 0, owl_new_sv(path));
[fd8dfe7]385  owl_free(path);
386
387  eval_pv("use BarnOwl;", FALSE);
[f1e629d]388
389  if (SvTRUE(ERRSV)) {
[ce6721f]390    err=owl_strdup(SvPV_nolen(ERRSV));
[27c3a93]391    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
[4e0f545]392    return(err);
[f1e629d]393  }
394
395  /* check if we have the formatting function */
[8203afd]396  if (owl_perlconfig_is_function("BarnOwl::format_msg")) {
[f1e629d]397    owl_global_set_config_format(&g, 1);
398  }
399
400  return(NULL);
401}
402
403/* returns whether or not a function exists */
[e19eb97]404int owl_perlconfig_is_function(const char *fn) {
[c415aca]405  if (get_cv(fn, FALSE)) return(1);
[f1e629d]406  else return(0);
407}
408
409/* caller is responsible for freeing returned string */
[e19eb97]410char *owl_perlconfig_execute(const char *line)
[c3acb0b]411{
[f1e629d]412  STRLEN len;
413  SV *response;
[65b2173]414  char *out;
[f1e629d]415
416  if (!owl_global_have_config(&g)) return NULL;
417
[e0096b7]418  ENTER;
419  SAVETMPS;
[f1e629d]420  /* execute the subroutine */
[c415aca]421  response = eval_pv(line, FALSE);
[f1e629d]422
423  if (SvTRUE(ERRSV)) {
[ce6721f]424    owl_function_error("Perl Error: '%s'", SvPV_nolen(ERRSV));
[27c3a93]425    sv_setsv (ERRSV, &PL_sv_undef);     /* and clear the error */
[f1e629d]426  }
427
[fb7742c]428  out = owl_strdup(SvPV(response, len));
[e0096b7]429  FREETMPS;
430  LEAVE;
[f1e629d]431
432  return(out);
433}
434
[c08c70a]435void owl_perlconfig_getmsg(const owl_message *m, const char *subname)
[b67ab6b]436{
437  char *ptr = NULL;
438  if (owl_perlconfig_is_function("BarnOwl::Hooks::_receive_msg")) {
439    ptr = owl_perlconfig_call_with_message(subname?subname
440                                           :"BarnOwl::_receive_msg_legacy_wrap", m);
[f1e629d]441  }
[b67ab6b]442  if (ptr) owl_free(ptr);
[0f9eca7]443}
444
445/* Called on all new messages; receivemsg is only called on incoming ones */
[c08c70a]446void owl_perlconfig_newmsg(const owl_message *m, const char *subname)
[0f9eca7]447{
448  char *ptr = NULL;
449  if (owl_perlconfig_is_function("BarnOwl::Hooks::_new_msg")) {
450    ptr = owl_perlconfig_call_with_message(subname?subname
451                                           :"BarnOwl::Hooks::_new_msg", m);
452  }
453  if (ptr) owl_free(ptr);
[f1e629d]454}
[6922edd]455
[e19eb97]456void owl_perlconfig_new_command(const char *name)
[eb6cedc]457{
458  dSP;
459
460  ENTER;
461  SAVETMPS;
462
463  PUSHMARK(SP);
[d1b1cf6]464  XPUSHs(sv_2mortal(owl_new_sv(name)));
[eb6cedc]465  PUTBACK;
466
467  call_pv("BarnOwl::Hooks::_new_command", G_SCALAR|G_VOID);
468
469  SPAGAIN;
470
471  if(SvTRUE(ERRSV)) {
472    owl_function_error("%s", SvPV_nolen(ERRSV));
473  }
474
475  FREETMPS;
476  LEAVE;
477}
478
[0a0fb74]479char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
[6922edd]480{
481  int i, count;
482  char * ret = NULL;
[ad15610]483  SV *rv;
[6922edd]484  dSP;
485
486  ENTER;
487  SAVETMPS;
488
489  PUSHMARK(SP);
490  for(i=0;i<argc;i++) {
[d1b1cf6]491    XPUSHs(sv_2mortal(owl_new_sv(argv[i])));
[6922edd]492  }
493  PUTBACK;
494
495  count = call_sv(cmd->cmd_perl, G_SCALAR|G_EVAL);
496
497  SPAGAIN;
498
499  if(SvTRUE(ERRSV)) {
[ce6721f]500    owl_function_error("%s", SvPV_nolen(ERRSV));
[c4ba74d]501    (void)POPs;
[6922edd]502  } else {
503    if(count != 1)
504      croak("Perl command %s returned more than one value!", cmd->name);
[ad15610]505    rv = POPs;
[6922edd]506    if(SvTRUE(rv)) {
[ce6721f]507      ret = owl_strdup(SvPV_nolen(rv));
[6922edd]508    }
509  }
510
511  FREETMPS;
512  LEAVE;
513
514  return ret;
515}
516
517void owl_perlconfig_cmd_free(owl_cmd *cmd)
518{
[ff13a6f]519  SvREFCNT_dec(cmd->cmd_perl);
[6922edd]520}
[db8b00b]521
[9c7a701]522void owl_perlconfig_dispatch_free(owl_dispatch *d)
523{
[4d86e06]524  SvREFCNT_dec(d->data);
[1895c29]525  owl_free(d);
[9c7a701]526}
527
[db8b00b]528void owl_perlconfig_edit_callback(owl_editwin *e)
529{
[4d86e06]530  SV *cb = owl_editwin_get_cbdata(e);
[367fbf3]531  SV *text;
[ad15610]532  dSP;
533
[db8b00b]534  if(cb == NULL) {
535    owl_function_error("Perl callback is NULL!");
[1373d35]536    return;
[db8b00b]537  }
[d1b1cf6]538  text = owl_new_sv(owl_editwin_get_text(e));
[db8b00b]539
540  ENTER;
541  SAVETMPS;
542
543  PUSHMARK(SP);
[367fbf3]544  XPUSHs(sv_2mortal(text));
[db8b00b]545  PUTBACK;
546 
[9364a36]547  call_sv(cb, G_DISCARD|G_KEEPERR|G_EVAL);
548
549  if(SvTRUE(ERRSV)) {
[ce6721f]550    owl_function_error("%s", SvPV_nolen(ERRSV));
[9364a36]551  }
[db8b00b]552
553  FREETMPS;
554  LEAVE;
555
556  SvREFCNT_dec(cb);
[a556caa]557  owl_editwin_set_cbdata(e, NULL);
[db8b00b]558}
[f72f573]559
[99068d3]560void owl_perlconfig_mainloop(owl_timer *t, void *data)
[f72f573]561{
[ad15610]562  dSP;
[0337203]563  if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
[8203afd]564    return;
[f72f573]565  PUSHMARK(SP) ;
[0337203]566  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
[a55abb3]567  if(SvTRUE(ERRSV)) {
[ce6721f]568    owl_function_error("%s", SvPV_nolen(ERRSV));
[a55abb3]569  }
[f72f573]570  return;
571}
[9c7a701]572
[f36cd97]573void owl_perlconfig_dispatch(owl_dispatch *d)
[9c7a701]574{
[f36cd97]575  SV *cb = d->data;
[9c7a701]576  dSP;
577  if(cb == NULL) {
578    owl_function_error("Perl callback is NULL!");
[f36cd97]579    return;
[9c7a701]580  }
581
582  ENTER;
583  SAVETMPS;
584
585  PUSHMARK(SP);
586  PUTBACK;
587 
588  call_sv(cb, G_DISCARD|G_KEEPERR|G_EVAL);
589
590  if(SvTRUE(ERRSV)) {
[ce6721f]591    owl_function_error("%s", SvPV_nolen(ERRSV));
[9c7a701]592  }
593
594  FREETMPS;
595  LEAVE;
596}
[1631825]597
598void owl_perlconfig_perl_timer(owl_timer *t, void *data)
599{
[5ebc202]600  dSP;
[1631825]601  SV *obj = data;
602
603  if(!SvROK(obj)) {
604    return;
605  }
606
607  ENTER;
608  SAVETMPS;
609
610  PUSHMARK(SP);
611  XPUSHs(obj);
612  PUTBACK;
613
614  call_method("do_callback", G_DISCARD|G_KEEPERR|G_EVAL);
615
616  SPAGAIN;
617
618  if (SvTRUE(ERRSV)) {
619    owl_function_error("Error in calback: '%s'", SvPV_nolen(ERRSV));
620    sv_setsv (ERRSV, &PL_sv_undef);
621  }
622
623  PUTBACK;
624  FREETMPS;
625  LEAVE;
626}
627
628void owl_perlconfig_perl_timer_destroy(owl_timer *t)
629{
630  if(SvOK((SV*)t->data)) {
631    SvREFCNT_dec((SV*)t->data);
632  }
633}
Note: See TracBrowser for help on using the repository browser.