[
{
'supplier_id' => 17,
'item_foo' => 3,
'item_bar' => 7
},
{
'supplier_id' => 28,
'item_foo' => 5,
'item_qux' => 202
}
]
####
{
'28' => {
'item_foo' => 5,
'item_qux' => 202
},
'17' => {
'item_foo' => 3,
'item_bar' => 7
}
};
####
sub set_stock
{
my( $self, $supplier, $line, $stockLevel ) = @_;
my $supplierList = ();
my $supplierNumber = $supplier->supplier_id;
# $supplierList will be a reference to a hash of references to hashes.
unless( $supplierList = $self->get('supplier_list') )
{
die( "Cannot set stock level when supplier list is corrupt: $supplierList" );
}
my $reference = $line->reference;
$supp->{ $supplierNumber }{ $reference } = $stockLevel;
}