On Tue, Nov 12, 2002 at 11:38:15AM -0500, Dmitri Tikhonov wrote:
> 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.
I have forwarded your patch to the task queue at [EMAIL PROTECTED]
Even better, and more illustrative of your point:
sub do_something {
my ($abc, $xyz) = @_;
}
...
Program => \&do_something,
ProgramArgs => [ $abc, $something_else ],
I have been recommending
Program => sub { do_something($abc, $something_else) },
which doesn't eliminate the closures you want to avoid. What sort of
problems are you running into with closures?
-- Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/