http://www.perlmonks.org?node_id=410969


in reply to The Null Mull (or, when OO needs more O)

Since the undef SV is shared between all undefined values, one could modify undef using a feature in Perl 5.8. (I only thought of this because of the solution to #13 of How's your Perl? (II)).

At the beginning of your program (possibly in a BEGIN block) (completely untested):

&Internals::SvREADONLY(\undef, 0); undef = Object::EveryMethod->new; &Internals::SvREADONLY(\undef, 1);

And override Object::EveryMethod for string/num/bool to behave like undef normally does.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.