in reply to Smallish mock objects
gensym doesn't actually create namespaces; they spring into existence on demand. I would just have done something like:
my $obj = {}; my $class = "$obj"; bless $obj, $class; *{"${class}::foo"} = sub { "bar" }; print $obj->foo();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Smallish mock objects
by ikegami (Patriarch) on Dec 25, 2006 at 03:01 UTC | |
|
Re^2: Smallish mock objects
by diotalevi (Canon) on Dec 25, 2006 at 06:26 UTC |