On Tue, 12 Nov 2002, Rocco Caputo wrote:

> I cannot tell the difference between
> 
>   Program => [ program, @args ],
> 
> and
> 
>   Program => [program],
>   ProgramArgs => \@args,

You're right, in this case the functionality is the same.  The key
advantage of my patch is that one will be able to pass arguments to
Program if it is a code ref, and I listed the behavior in my first post:

> On Fri, Nov 08, 2002 at 04:23:30PM -0500, Dmitri Tikhonov wrote:
> > 
> > Where Program is a code ref, the behavior will be
> >     $program->(@$args);
> > 

The reason I am doing this is that I have code like

        Program => sub {
                ...
                $abc * 2;       # $abc is lexical variable outside
        },

I do not want Program to be a closure.  So a better way to write it is

        Program => sub {
                my ($abc, $xyz) = @_;
        },
        ProgramArgs => [$abc, $something_else],

When Program is an array, ProgramArgs get pushed onto it; when it is a
scalar, ProgramArgs are join(' ', @args)'ed and appended to it.  There is
no advantage to doing that, of course, but user should be able to specify
ProgramArgs option and get meaningful results in all three cases.

- Dmitri.


Reply via email to