Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Why do the SvPV???() calls require a length parameter?

I thought that the point of SVs is that they know how long any PV is?

Replies are listed 'Best First'.
Re: PerlApi question
by dave_the_m (Monsignor) on Jun 01, 2007 at 00:56 UTC
    The SvPV*() calls set the length variable rather than read it.

    Dave.

Re: PerlApi question
by Fletch (Bishop) on Jun 01, 2007 at 00:47 UTC

    Yes, SvPV* values do; however char * values don't and could possily contain NULs. If you're going back and forth between them you need to know how big they are (or Perl will).