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

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' ) { ... }

Replies are listed 'Best First'.
Re^3: Class::Struct accessor function after Perl V5.16
by Anonymous Monk on Jan 03, 2019 at 09:03 UTC
    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.