in reply to Class::Struct accessor function after Perl V5.16

This gives me an error when run with Perl versions after 5.16.

Well technically, you're the one causing the error ;-) die Dumper \@_;

I'm pretty sure the difference in behavior you're seeing is because bug #29230 was fixed in Class::Struct version 0.64, which was released with v5.18.0. It appears that the constructor is supposed to initialize the fields <update> using the custom accessors </update>.

In sub set_values, you expect there to be an even number of arguments that you assign to a hash (my %args = @_;), but in sub heights_agl, you do ->set_values(Variable=>'heights_agl',@_), which means that if @_ contains an odd number of elements, you'll get the "Odd number of elements in hash assignment" warning (not a fatal error, but a useful warning).

I'm pretty sure this would happen any time you assign <update> an array ref </update> to heights_agl - so I think you need to rethink your logic anyway. Since you haven't shown what set_values is actually doing, it's a little hard to tell what the best solution would be, but perhaps you might want to change the call to something like $self->set_values(Variable=>'heights_agl',Arguments=>[@_]);?

Update: Note the documentation of Class::Struct:

Array ('@' or '*@')

The element is an array, initialized by default to ().

... As a special case, when the accessor is called with an array reference as the sole argument, this causes an assignment of the whole array element. The object reference is returned.

So I guess you'll need to extend your set_values to handle this case.