
FishMonger
Veteran
Dec 6, 2009, 4:30 PM
Post #4 of 4
(498 views)
|
|
Re: [karthigan] Writing to __DATA__ section
[In reply to]
|
Can't Post
|
|
As far as I know it is not possible, but you could ask on P5P (Perl 5 Porters). Even if it is possible, the __DATA__ token is the wrong place to store/maintain log file data. If you need temporary file storage for your script, you'd be better off using one of Perl's more mainstream methods to implement that storage. See `perldoc -f open` Here's the relevant portion.
As a special case the 3-arg form with a read/write mode and the third argument being "undef": open(my $tmp, "+>", undef) or die ... opens a filehandle to an anonymous temporary file. Also using "+<" works for symmetry, but you really should consider writing something to the temporary file first. You will need to seek() to do the reading. Also look at File::Temp http://search.cpan.org/~tjenness/File-Temp-0.22/Temp.pm
|