Considered having the return of MyLib::strToInt be the bool, and the param be the int? Usually subs/funcs return true false, and details of the operation are inplace updates/ pass by reference/ $_[0] = "hello";/*status = 1;/. Or the author of C++ method strToInt did it that way and thats the way you will remember it in Perl? You could also return 2 elements "($truefalse, $theint) = $instance->strToInt();", and have MyLib::strToInt method take only one param (THIS scalar). If the caller in perl doesn't want the int, they dont need to collect it in list context.
edit: With XS/C/Perl internals, the biggest XSUB debugging tool is looking at the .c code. Try posting that. For C code, you should learn how to create post C processor code, then run it through a code formatter. A 7 character named macro taking 1 param, barely or terribly documented, can expand to a screenful of code after 2-5 layers of macros are expanded. To understand why it failed, looking at the post preprocessor output it the only way. Also compile with optimize=debug and symbols, as you said already, you have a C debugger, so thats correct. Also instead of returning 1 bool, or a list, consider returning a hashref, a hashref is probably overkill for this function.
-
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.
|