sub new { my $ptr= xs_new( ... ); bless \$ptr, ...; } sub DESTROY { my $self= shift(@_); xs_free( $$self ); }