# getting fancy with arg binding my @hosts = qw( foo bar baz ); prun( map { my $host = $_; sub { test_host( $host ) } } @hosts ) or die( Parallel::Simple::errplus() );
However, that looks ugly - and ugly isn't simple. So I thought of how I could support this case, and I realize that since I can tell listrefs apart from strings and code refs, I could allow this:
prun( $coderef1, $coderef2 => [ $arg1, $arg2, $arg3 ], );
Which would run $coderef1 once, but run $coderef2 three times, once for each arg. If you wanted to pass more than one arg at a time, you could create sublists:
prun( $coderef1, $coderef2 => [ [ $arg1a, $arg1b], [ $arg2a, $arg2b ] ], );
And it would just work. You could still use named style, too, of course:
prun( foo => $coderef1, bar => $coderef2 => [ $arg1, $arg2, $arg3 ], );
So.. I don't think there's any question that this is useful. The question is - is this too complicated for a ::Simple module? Or does it fit right in, because it let's you do far more complex logic with a simple, concise syntax?
-ofer