I would suggest using perl's ability to return multiple values. Your wrapper for getting the theme name could return both the error code and a regular perl string that way.
Update: Here is an example using Inline::C. You can examine the XS code it generates (a bit of ugly stuff, but it works).
use strict;
use Inline (C => Config =>
CLEAN_AFTER_BUILD => 0);
use Inline C => <<'END_OF_C_CODE';
void twoout() {
int first = 42;
char *second = "abc";
Inline_Stack_Vars;
Inline_Stack_Reset;
Inline_Stack_Push(sv_2mortal(newSViv(first)));
Inline_Stack_Push(sv_2mortal(newSVpvn(second,3)));
Inline_Stack_Done;
}
END_OF_C_CODE
my ($num, $str) = twoout();
print "num = $num, str = $str\n";
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|