From 942bfa63aec5bd4cc229f44ffe2e2437374cb091 Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Thu, 1 Nov 2012 22:22:18 -0500 Subject: get_build_queue: take an array ref as first arg, make the temp_queue keep state, changes for clarity --- SBO-Lib/lib/SBO/Lib.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c7c186b..ae827de 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -754,16 +754,18 @@ sub add_to_queue ($) { # recursively add a sbo's requirements to the build queue. sub get_build_queue ($$) { - unless ($_[0] && $_[1]) { - script_error 'get_build_queue requires two arguments.'; + exists $_[1] or script_error 'get_build_queue requires two arguments.'; + my ($sbos, $warnings) = @_; + state $temp_queue = ['']; + my @build_queue; + for my $sbo (@$sbos) { + my %args = ( + QUEUE => \@temp_queue, + NAME => $sbo, + WARNINGS => $warnings + ); + add_to_queue(\%args); } - my (@temp_queue, @build_queue); - my %args = ( - QUEUE => \@temp_queue, - NAME => $_[0], - WARNINGS => \%{$_[1]} - ); - add_to_queue(\%args); # Remove duplicate entries (leaving first occurrence) my %seen; for my $sb( reverse(@temp_queue) ) { -- cgit v1.2.3