Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and, in ./Lib/Datum.pmuse strict; use lib ("./Lib"); use Datum; my $datum = new Datum;
This gives me an error when run with Perl versions after 5.16.package Datum; use strict; use warnings; use Data::Dumper; use Class::Struct; struct Datum => { heights_agl => '@', }; sub heights_agl { my $self = shift; if (@_) { $self->set_values(Variable=>'heights_agl',@_); } } sub set_values { my $self = shift; my %args = @_; die Dumper \@_; } 1;
And with Perl V5.26:C:\Tmp\debug.4>perl driver.pl function 'heights_agl' already defined, overrides struct accessor meth +od at Lib/Datum.pm line 8. C:\Tmp\debug.4>perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +64-multi-thread
Is this hypothesis correct and is there a way to have it working again?$ perl driver.pl function 'heights_agl' already defined, overrides struct accessor meth +od at Lib/Datum.pm line 8. Odd number of elements in hash assignment at Lib/Datum.pm line 25. $VAR1 = [ 'Variable', 'heights_agl', [] ]; $ perl -v This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-li +nux-gnu-thread-multi (with 67 registered patches, see perl -V for more detail)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class::Struct accessor function after Perl V5.16 (updated)
by haukex (Archbishop) on Jan 02, 2019 at 11:11 UTC | |
|
Re: Class::Struct accessor function after Perl V5.16
by tobyink (Canon) on Jan 02, 2019 at 11:31 UTC | |
|
Re: Class::Struct accessor function after Perl V5.16
by Anonymous Monk on Jan 02, 2019 at 12:15 UTC | |
by haukex (Archbishop) on Jan 02, 2019 at 15:08 UTC | |
by Anonymous Monk on Jan 03, 2019 at 09:03 UTC |