From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2007-06-12 16:53:21


On Jun 12, 2007, at 10:50 AM, Ethan Mallove wrote:

>>> eval $btls = MTT::Functions::if(MTT::Functions::regexp
>>> (MTT::Functions::shell("hostname"), "v440-2|v20z-2"),
>>> MTT::Functions::enumerate("self,sm,tcp"),
>>> MTT::Functions::if("MTT::Functions::regexp
>>> ("MTT::Functions::shell("hostname"), "v440-6"),
>>> MTT::Functions::enumerate("udapl"),
>>> MTT::Functions::enumerate("sm", "tcp",
>>> "sm,tcp", "udapl", "sm,udapl")
>>> )
>>> )
>>
>> Ah -- I had to think about this a bit before I figured it out/
>> remembered. I think we won't get the expansion effect if you do it
>> this way.
>
> No expansion effect? As long as the perl code evaluates to
> an array, couldn't it to work? E.g.,

We'll need to revamp all the current funclets to accept arrays and
return [potentially] arrays of arrays. What if, as a
counterproposal, we have a &perl() funclet? Then you could do the
following:

btls = &perl("if ($hostname =~ /foo/) { \
            return ("self,sm,tcp"); \
        } elsif ($hostname =~ /bar/) { \
            return ("udapl"); \
        } else { \
            return ("sm", "tcp", "sm,tcp", "udapl", "sm,udapl"); \
        }")

(or something like that)

-- 
Jeff Squyres
Cisco Systems