There is no good way to do that
There will be in Perl 6, but not in Perl 5.
For an example of someone else with the same desire, see the thread at [link|http://www.perlmonks.org/?node_id=225083|http://www.perlmonks.org/?node_id=225083]. As I point out in the last post there, there is a bad way to do it, and that way may be found implemented on CPAN in [link|http://search.cpan.org/~smueller/File-Stream-1.11/lib/File/Stream.pm|File::Stream].
The trick to do it is very horrendous. :-(
Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)