Perl Bug 12 - "in memory" files don't call STORE method when tied


perl version: 5.8.8
Operating System: i486-linux-gnu-thread-multi

If we open a file handle to an "in memory" file held in a perl scalar, and then tie that scalar, we don't see the STORE method called on writes to the filehandle, though they still work on normal STORE events.

Code:

{ package printHook;
  sub hook {
    my $myout;

    # Redirect EXAMPLE filehandle to the variable.
    open EXAMPLE,'>',\$myout or die "Can't open EXAMPLE: $!\n";
    # And tie the variable to this package
    tie $myout, "printHook", "";

    # Store to the variable directly
    $myout = "direct store";
    print "\$myout is: \"$myout\"\n";

    # Store to the variable through the filehandle
    print EXAMPLE "write to myout variable..";
    # We didn't see our STORE method called?
    print "\$myout is: \"$myout\"\n";
  }
  sub TIESCALAR {
    my ($pkg) = @_;
    my $obj = [];
    bless $obj, $pkg;
    return $obj;
  }
  sub STORE {
    my ($obj, $val) = @_;
    print STDERR "Wrote var <- $val\n";
    $obj->[0] = $val;
    return $val;
  }
  sub FETCH { return $_[0][0]; }
}

printHook->hook();

The output is:

Wrote var <- direct store
$myout is: "direct store"
$myout is: "write to myout variable.."
Expected output:
Wrote var <- direct store
$myout is: "direct store"
Wrote var <- write to myout variable..
$myout is: "write to myout variable.."