gsd4me has asked for the wisdom of the Perl Monks concerning the following question:
Sorry to interrupt your tonsure creating dear monks but some advice please. It appears that Perl has adapted itself and has thrown our system's operation, established during a small routine change to our code.
The code creates several data types from definitions in a package, and stores them as a series of joined records - so one record holds the data pointer of another etc. (I have simplified the code to show you below) (It was so much easier to use address manipulations in 'C' but Perl's list manipulation was one of the original reasons why we went with Perl over 'C'). The trouble is that the code that was working before has now seemingly been banned as being anti- the Perl Spanish Inquisition's latest thinking on purity. Obviously a code rewrite/redesign is *not* desired at this stage so is there a better/newer/easier way of simply pushing the element onto the list held by the 'root' structure?
The error being given is:
Experimental push on scalar is now forbidden at C:\crap\adbtest.pl line 40, near "$rohan1;"
Experimental push on scalar is now forbidden at C:\Users\Alan\Documents\crap\adbtest.pl line 46, near "$rohan4;" Many thanks - ADB
Package/data sources package rohanType1; sub new { my $self = {}; # Discard the class name shift; $self->{'field11'} = undef; bless ($self); return $self; } return 1; package rohanType2; sub new { my $self = {}; shift; $self->{'field21'} = 0; bless ($self); return $self; } return 1; package rohanType3; sub new { my $self = {}; shift; # Pointer to rohanType1 $self->{'field31'} = undef; # Pointer to rohanType2 $self->{'field32'} = undef; bless ($self); return $self; } return 1; # Now the data structures used globally to store information used by t +he whole analysis, which holds # data types as defined above package rohanData; sub new { my $self = (); shift; $self->{'rohan1'} = undef; $self->{'rohan2'} = (); bless ($self); return $self; } return 1; ======================= Code my $rohanRoot; my $rohan1; my $rohan2; my $rohan3; my $rohan4; $rohanRoot = rohanData->new(); $rohan1 = rohanType1->new(); $rohan2 = rohanType2->new(); $rohan1->{'field11'} = $rohan2; $rohanRoot->{'rohan1'} = $rohan1; # my debug helper to see if add +resses are correct - not part of code push $rohanRoot->{'rohan2'}, $rohan1; # Interpreter/debugger objec +ts to this ... $rohan3 = rohanType1->new(); $rohan4 = rohanType2->new(); $rohan3->{'field11'} = $rohan4; push $rohanRoot->{'rohan2'}, $rohan3; # ... and this
|
|---|