Subject: | Poor error message for missing INPUT definition |
I came across this while trying to debug an unrelated problem. As part
of my experiments, I loaded my module's typemap and replaced T_PTROBJ
with T_MYPTROBJ. When building my module, I then got the error:
Error: No INPUT definition for type 'HANDLE', typekind 'T_MYPTROBJ'
found in ChangeNotify.xs, line 131
But there was indeed an INPUT definition for T_MYPTROBJ in that typemap.
This led to much hair-pulling. Eventually, I discovered this line in
ExtUtils/ParseXS.pm:
$tk =~ s/OBJ$/REF/ if $func_name =~ /DESTROY$/;
Sure enough, line 131 is in my DESTROY method. I'm not really clear why
it does that, but I'll assume there's some reason. So what the error
message was really trying to say was:
Error: No INPUT definition for type 'HANDLE', typekind 'T_MYPTRREF' found
Of course, if the error message had said that, I'd have been pulling my
hair wondering why it was talking about T_MYPTRREF instead of
T_MYPTROBJ. I can't find that little magic trick documented anywhere.
I'm not really sure what the error message should say, but I hope it can
be improved.