Thanks to those who answered my question about the headers.  I have
two new ones:

Do I need an OUTPUT section in a case where I'm altering an SV*
instead of a typemapped value?  For example:

  void
  twice(a)
  SV *a
  CODE:
    sv_setiv(a, 2 * SvIV(a));
  OUTPUT:
    a

That works with and without the OUTPUT section.

  $number = 24;
  twice($number);
  print $number;

  48


Second question: when I use the SvIV function to extract the integer
value from a scalar, I don't get the same behaviour Perl seems to
exhibit.  When I turn "24 dogs" into an integer, I get 0 (and a
warning about "argument isn't numeric").  If I try that in Perl (for
example, with addition) I get 24.  What am I missing?

  $string = "24 dogs";
  twice($string);
  print $string;

  0

Thanks,

Nat

Reply via email to