On Mon, Jul/06/2009 10:25:51AM, Jeff Squyres wrote: > I was just trying to use &perl() in an ini file and ran across an annoying > restriction: I had to make the whole thing be one long line: > > max_test_num = <<EOF > &perl('open(IN, "./mpi_test_suite -l|") || die("cant open"); while (<IN>) { > if (m/Num Tests : (\d+)/) { close(IN); return $1; } } close(IN); return > "0"; ') > EOF > > Without that, the MTT parser would complain that it couldn't find the > closing ' quote (i.e., "&perl(' ... ')"). I tracked it down and it's > because if I did this: > > max_test_num = <<EOF > &perl(' > open(IN, "./mpi_test_suite -l|") || die("cant open"); > while (<IN>) { > if (m/Num Tests : (\d+)/) { close(IN); return $1; } > } > close(IN); > return "0"; > ') > EOF > > then the parser stops looking for the closing quote on the "&perl('" line > -- it doesn't go beyond the \n. Yuck.
Ewww. I think the parser should be able to handle those newlines. > > Any suggestions? When I need a multi-line &perl(), I throw the perl code into a sub in my funclet file. E.g., do this in a Cisco.pm file: sub max_test_num { open(IN, "./mpi_test_suite -l|") || die("cant open"); while (<IN>) { if (m/Num Tests : (\d+)/) { close(IN); return $1; } } close(IN); return "0"; } Put your funclet file next to your INI file, since your INI file will now require your funclet file: foo/bar.ini funclets/Cisco.pm And then have this in your INI file: [MTT] ... funclet_files = &dirname("@INI_NAME@")/../funclets/Cisco.pm ... max_test_num = &Cisco::max_test_num() -Ethan > > -- > Jeff Squyres > Cisco Systems > > _______________________________________________ > mtt-devel mailing list > mtt-de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel