I think you might be able to do it using autobox and overload. Something like this I think:
package REF;
use overload q("") => sub { die "Attempt to stringify reference" };
package main;
use autobox 'REF' => 'REF', DEFAULT => undef;
...
You need at least perl 5.8.1 for this though. That's why I can't test the code myself. (I should update one of these days ...)
Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
-- P. Simon in Mrs. Robinson |