in reply to dynamic polymorphism

Let me start by noticing that Tie::File says explicitly that it doesn't support subclassing.

That said, you can probably get what you want by saving the user's code ref in your object's instance instead of in the symbol table. In TIEARRAY, say something like:

$self->{_get_next_rec} = $opts{code} if ref $opts{code} eq 'CODE'; *Tie::File::_read_record = sub { my ($self) = @_; my $rec = $self->{_get_next_rec}->( $self->{fh} ); return $rec; };

This way each object has its own code, and _read_record calls it.