here was a fun unbless function i wrote in response to something
on spug's mailing list (it never made here or there, due to mailing
difficulties at the time)
sub curse ($) {
my $thing = shift;
if (!(ref($thing))) {
die "Can't curse non-reference value";
}
if ("$thing" =~ m/=(SCALAR|ARRAY|HASH|CODE|GLOB)\(/) {
return bless $thing, $1;
} else {
return $thing;
}
}
Trelane then came up with this error case
$x = curse new String("This is a problem cos I have =ARRAY(foo in my text");
print $x,"\n";
package String;
use overload '""' => sub { $_[0]->{text}};
use overload;
sub new
{
my $class = shift;
return bless {text => join('',@_)}, $class;
}
which just shows you what a so and so he is ;-)
However there is a good soln in scalar::util or somesuch
Greg
--
Greg McCarroll http://217.34.97.146/~gem/