in reply to Re: An overloaded object and tie
in thread An overloaded object and tie
Using the object returned from tie uses the blessed reference not the tie, which means you can't use the [] syntax when object are created on the fly by overloading. For example:package Tie::NewStdArray; use Tie::Array; @ISA = ('Tie::StdArray'); sub STORE { print 'in store'; } sub FETCH { print 'in fetch'; } # all methods provided by default package main; my @somearray; my $object = tie @somearray,Tie::NewStdArray; $somearray[0]=12; #intercepted by tie $object[0]=12; #uses the blessed array
$three=$two+$one; print $three[12];
|
|---|