in reply to Is this proof of concept too evil?
First of all, I find tsvars rather clunky. Two args per var would be much better.
tsvars( a => my $a = 'A', b => my $b = 'B', ); tsvars( a => my $a2, b => my $b2 = 'B2', );
my ($ident, $value) = @_[0,1]; tie( $_[1], 'MyTest::Scalar', $ident ); $_[1] = $value if defined($value); splice(@_, 0, 2);
But you're just emulating aliases using tie magic. Magic adds a lot of overhead. You'd probably be better using true aliases. The interface is much more flexible too.
use Data::Alias qw( alias ); my ($ident, $value) = @_[0,1]; alias $_[1] = $VALUES{ $ident ); $_[1] = $value if defined($value); splice(@_, 0, 2);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is this proof of concept too evil?
by exodist (Monk) on Jan 18, 2009 at 01:01 UTC | |
by ikegami (Patriarch) on Jan 18, 2009 at 01:41 UTC | |
by exodist (Monk) on Jan 18, 2009 at 02:11 UTC | |
by ikegami (Patriarch) on Jan 18, 2009 at 02:23 UTC | |
by exodist (Monk) on Jan 18, 2009 at 07:31 UTC |