[ABE.pm] self-modifying data structures
Faber J. Fedor
faber at linuxnj.com
Tue Jun 5 09:11:23 PDT 2007
I need to transfer data between two sets of six tables in a MySQL
database. I need to repeat this operation across four servers. So I
wrote a little Perl script to do the former and I'm going to copy and
run it on all four servers.
The snag is, the data to be copied exists only on the first server.
What I thought would be fun to do is to write a script that does this:
populate the first set of tables if the data doesn't exist
copy the data to the second set of tables
This implies that the program has a copy of the data. Now, I could
hard-code the data to be copied but that's too much work. What I want
to do is:
if command-line flag is set, read data from tables and update my source
code with the new data
IOW, I want my program to modify its source code/file by updating a data
structure within the program/file. I think the __DATA__ tag is going to be
useful here but I'm not sure.
Any suggestions on how to do this?
Linux New Jersey, Inc.
More information about the ABE-pm