sub list_pools { my $self = shift; my @pools = list_pools_c($self->{conn}); return \@pools; } __C__ void list_pools_c (rados_t clu) { int buf_sz = rados_pool_list(clu,NULL,0); char buf[buf_sz]; int r = rados_pool_list(clu,buf,buf_sz); if (r != buf_sz) { printf("buffer size mismatch: got %d the first time, but %d " "the second.\n", buf_sz, r); } Inline_Stack_Vars; Inline_Stack_Reset; const char *b = buf; while(1) { if(b[0] == '\0') { Inline_Stack_Done; break; } Inline_Stack_Push(sv_2mortal(newSVpv(b,0))); b += strlen(b) +1; } }