[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: A common base exception object for Perl - RFC



Larry Wall wrote:

> Another interesting question is whether $@ gets denatured or stays an
> object when you do
> 
>     $@ =~ s/foo/bar/;
> 
> It could be made to stay an object, if $@->STRINGIFY returns an
> lvalue.  That probably makes more sense than denaturing $@, since other
> code may rely on $@ remaining an object.

I suppose a tied lvalue would do... Alternatives:

	"$@"		-> $@->STRINGIFY
	$@=~s/foo/bar/	-> do {
				my $s=$@->STRINGIFY;
				my $n=$s=~s/foo/bar/;
				$@->DESTRINGIFY($s) if $n;
				$n
			   }

or allow overloading of pattern-match operators.

Pete
-- 
use Disclaimer::Standard;
my $phone='+44 1793 564450';    # "THIS IS THE COMPATIBILITY
my $fax='+44 1793 566918';      #  POLICE. RESTORE YOUR ORIGINAL
my $mobile='+44 7973 725120';   #  TOKE.C AND BACK AWAY SLOWLY."


References to:
Larry Wall <larry@wall.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]