XS(XS_Net__LibnetRaw_libnet_write_ip) { dXSARGS; if (items != 3) Perl_croak(aTHX_ "Usage: Net::LibnetRaw::libnet_write_ip(sock, + packet, len)"); { int sock = (int)SvIV(ST(0)); u_char * packet = (u_char *)SvPV(ST(1),PL_na); int len = (int)SvIV(ST(2)); int RETVAL; dXSTARG; RETVAL = libnet_write_ip(sock, packet, len); XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); }
I'd make len default to 0 (change "len" to "len=0" the first place it is mentioned) and add:
INIT: if( 0 == len ) len= SvCUR(ST(1));
so that write_ip($sock,$packet) works.

        - tye (but my friends call me "Tye")

In reply to (tye)Re4: XS question: typemap for a pointer to a pointer? by tye
in thread XS question: typemap for a pointer to a pointer? by Big Willy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.