Hi Jamie,
it looks like this is my first mail in my life (I mean my previsou empty
reply :-)
>
> Sablotron looks extremely promising, and as a command line utility it's
> already useful, but I'm having some problems getting it to work under apache
> with mod_perl.
We use Sablotron in mod_perl scripts with no problems (we use it in
little bit indirect way, so I'll try some simple test)
> The problem is it gets a segfault when it runs, I think it's related to the
> SablotFree(foo); routine.
>
> I'm not a native C coder, but I did find something interesting.
>
> This doesn't crash under mod_perl, but it doesn't work either. :-( The
> fprintf(stderr,"Result: %s\n",result); line prints something completely
> different (in the apache error log file) under mod_perl then it does under
> regular perl.
>
> It prints some kind of binary data, leading me to believe it's a memory
> allocation mix-up of some kind, particular to mod_perl.
Can you send us sample perl script and data? (template and xml)?
> ----------| Sablotron.xs |-------------------
>
> int
> SablotProcessStrings(sheet,input,result)
> char * sheet
> char * input
> char * result
> PREINIT:
> char anything; // ???
> char *foo = &anything;
foo doesn't have to point to anything, 'cos result buffer is allocated
by Sablotron.
> CODE:
> RETVAL = SablotProcessStrings(sheet, input, &foo);
> perror("We're here");
> result = foo;
> OUTPUT:
> result
> RETVAL
> CLEANUP:
> perror("Just before cleanup");
> fprintf(stderr,"Result: %s\n",result);
> SablotFree(foo);
> perror("We're After cleanup");
"After cleanup" message never appears?
Few additional questions:
1. The same tamplate and data works with sabcmd?
2. Are there som other messages in Apache log (mainly messages produced
by Sablotron)
3. Sablotron needs to write into working directory. Has web user
permissions for it?
Have a nice day
Pavel
--
Pavel Hlavnicka
Ginger Alliance Ltd.
Prague; Czech Republic