ffi_peek#

Read $len raw bytes at address $ptr into a Perl byte string.

Synopsis#

my $bytes = Peta::FFI::peek($ptr, 16);

What you get back#

A byte string of exactly $len bytes copied from $ptr; undef when $ptr is 0/undef. $len of 0 returns the empty string.

Edge cases#

  • Fewer than 2 arguments - croaks.

  • Address or length wrong - reading memory the process does not own is undefined behaviour; the length must come from the same C API that produced the pointer (e.g. PQgetlength).