bsdz has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I understand that everything after the __DATA__ token is available for reading via the filehandle <package>::DATA. I was wondering if one could extend this to allow writing too? I.e.
use strict; use IO::Handle; my $io = IO::Handle->new_from_fd(*main::DATA, "w"); $io->read(my $buffer, 10); print "$buffer\n"; $io->print("Some different data"); __DATA__ Some data
Update: I am sorry, I hadn't properly searched the monastery and found this node. Maybe there are better ways to do this now? If not then please reap this node.

Replies are listed 'Best First'.
Re: Open <package>::DATA for writing
by merlyn (Sage) on Dec 10, 2006 at 19:58 UTC
Re: Open <package>::DATA for writing
by grep (Monsignor) on Dec 10, 2006 at 21:02 UTC
    If you're doing anything other than lightweight config info/data storage you might want to look at DBD::SQLite for a portable solution to data storage.

    grep
    XP matters not. Look at me. Judge me by my XP, do you?