in reply to Algebraic Hash Configuration via Delayed Closure?
I suspect that may not be flexible enough to meet your needs, though...my $g = Games::Grid->new( border => 4, width => sub { $_[0]/4 }, height => sub { $_[0] }, fill => '=', ); { my $W = $self->{terminal}->{_co}; my $H = $self->{terminal}->{_li}; $self->terminal->{WIDTH} = $config{width}->($W); $self->terminal->{HEIGHT} = $config{height}->($H); }
How about using package variables for $W and $H, instead of lexical variables?
my $g = Games::Grid->new( border => 4, width => sub { $terminal::W/4 }, height => sub { $terminal::H }, fill => '=', ); { $terminal::W = $self->{terminal}->{_co}; $terminal::H = $self->{terminal}->{_li}; $self->terminal->{WIDTH} = $config{width}->(); $self->terminal->{HEIGHT} = $config{height}->(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Algebraic Hash Configuration via Delayed Closure?
by princepawn (Parson) on Mar 07, 2001 at 01:02 UTC | |
by japhy (Canon) on Mar 07, 2001 at 02:19 UTC |