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

Thanks for you comments.
So I think I can fix it by checking parameters in set_values with
if (@_&& ref @_ ne ‘ARRAY’) {

Replies are listed 'Best First'.
Re^2: Class::Struct accessor function after Perl V5.16
by haukex (Archbishop) on Jan 02, 2019 at 15:08 UTC
    if (@_&& ref @_ ne ‘ARRAY’) {

    No, not quite, ref @_ won't do what you want. If you wanted to check that a function was called with exactly one argument that is an arrayref: if ( @_==1 && ref $_[0] eq 'ARRAY' ) { ... }

      Sorry, I forgot to mention that set_heights, apart from initialization stage, is called passing a list of key/value pairs.
      So
      if (@_ && ref $_[0] ne 'ARRAY') {
      is now fixing the code. Thanks a lot for your time and help.