PerlGameDev/Box2D-perl — Issue #116: userData
Author: Blaizer
Created: 2012-01-15 07:53:17+00:00
State: open

When we assign to a C++ object's userData, new_data() returns the thing that is assigned to it. Could someone explain why this code:
```perl
SV* new_data( SV* thing )
{
if ( SvROK(thing) ) {
return newRV_inc( SvRV(thing) );
} else {
return SvREFCNT_inc(thing);
}
}
```

shouldn't be:
```perl
SV* new_data( SV* thing )
{
return SvREFCNT_inc(thing);
}
```

In other words: why are we creating a new reference to what's passed in if it's a reference. Wouldn't it be a good idea to keep what's passed in exactly the same as what's passed in, as with the C++ userData?