> Isn't this the same as Markov's Object::Realize::Later ? No, but that module certainly helps solve a similar set of problems; it uses a formal object that populates itself in a defined manner, instead of a tied scalar `tripping an alarm' that calls the sub to get itself realized.
Very interesting, this more complex/complete solution may end up avoiding some of the caveats of my approach. Thanks for the pointer. > To my understanding it's a lot more like Simon Cozens's > Tie::Discovery, only with single scalars rather than hash > entries. Yes, this is exactly right. I'll check out Simon's work to see if I can fit the scalar version in gracefully. richardc++ > Mmm. The perl community seems to be bad at finding suitably > descriptive names for things, given the seeming inability of > later programmers to find them, and save re-inventing wheels. No kidding. Perhaps the low volume of mail on this list is related. > This seems on first inspection to be a form of Memoize, but > providing access via variables (presumably tied, and therefore > less efficient) than via functions. Memoize is part of the Perl > core as of 5.8.0 . No, memoize remembers the result from a function call with a set of indexed arguments and caches them. This module _replaces_ a scalar (eg, a reference to an object) with the result of a sub (eg, the object) when it is accessed. Chalk and cheese, I'm afraid. The efficiency issue is also a moot point, because after FETCH is called once, the tied variable collapses into a regular scalar. Besides, according to qq«package foo; sub TIESCALAR { my $class = shift; bless { foo => shift }, $class; } sub FETCH { return $_[0]->{foo}; } package main; use Benchmark; my $thingy; my $obj = tie $thingy, "foo", "bar"; timethese(1_000, { "tie" => sub { ($thingy eq "bar") for (1..1000) }, "method" => sub { ($obj->FETCH eq "bar") for 1..1000 }, });», it's not dreadfully slower than a method call. -- Sam Vilain, [EMAIL PROTECTED] Try to be the best of what you are, even if what you are is no good. ASHLEIGH BRILLIANT