Problem is in the select method where I try to build the keys array. Specifically where I'm adding elements with the statementspackage AXRecord; # Our libraries use lib 'C:\Users\Jay\Desktop\SBS DEV\CODE\perl\Utilities'; use AXControl; use AXSQL; use Moose; use DBI; # Attributes has 'Keys' => (is => 'rw', isa=>'ArrayRef'); # Contains a single record sub BUILD # Constructor { } sub Select { #Get the primary key fields $self->Keys (()); $sql = AXSQL->new(ControlObject => $self->ControlObject, SQLString + => "SELECT column_name FROM information_schema.`key_column_usage` WH +ERE table_name = '" . $self->Name . "' order by ordinal_position"); $i = 1; while (($Col) = $sql->Fetch()) { $self->Keys()->[$i] = $Col; $i++; } $Cnt = scalar $self->Fields; $self->FieldCount = $Cnt; $self->Changed = -1; } 1;
The error message I'm getting is$self->Keys()->[$i] = $Col;
Can't use an undefined value as an ARRAY reference at C:\Users\Jay\Des +ktop\SBS DEV\CODE\perl\Utilities/AXRecord.pm line 106. C:\Users\Jay\Desktop\SBS DEV\CODE\perl>
In reply to Moose arrayref addition: noob by jorba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |