I have never made an extension, so I cant answer your question
out right.
I played around with your code, and I read
perlman:perlxs and
perlman:perlxstut and I did not get
very far with C++ coding. It seems that it is all written
in C, and there are little or no examples for C++.
I looked in
Advanced Perl Programming and that only briefly mentions
C++ also. But the author Sriram Srinivasan mentions other
resources on CPAN by Dean Roehrich. Dean has code and extension examples in two cookbooks:
CookBookA and CookBookB which you can get
here
I have not had the chance to look at them but the readme looked promising.
Good luck. I will post more if I find anything else out.