NB: These pages were mostly written in 2001 or so. The résumé dates are accurate but the code is aged and unlike whiskey, 8 year-old code doesn't usually taste better. For a look at my current skills and to see my CPAN modules, sample code, and code discussions, please see these pages instead: Perl resources and sample code and PangyreSoft.
Moving DB_Files between disparate systems
Social links
View Ashley Pond V's profile on LinkedIn
Miscellaneous

Other pages

Description

This script converts binary DB_File data into plain text for sending accross networks and reconstituting on other systems with the same script. There is usage information and some discussion in the script comments.

In my case, I build parts of my site and its search index from mysql on OS X at home. The search index uses DB_File. I didn’t have mysql on my host originally and didn’t want the headache of syncing the DBs anyway (myisam to innodb, 3.whatever to 4.bleeding). So, the only data-system that needs to go over is the search index. Moving the DB generated with DB_File breaks it since the target system has little other than “nix” in common with my box. This script fixes it for transfer and puts it back the way it needs to be once it gets where it belongs.

Code
Serialize binary…
G4:jinx[77]>db-file-converter search_index.db
converting DB_File ddx_search.dbfile to YAML ddx_search.yml
¡Muévase!
G4:jinx[78]>scp ddx_search.yml so_n_so@sedition.com:/some/dir
ddx_search.yml    100% |**********************************| 158 KB 00:00
Reconsitution, on other box where script is also installed
G4:jinx[79]>ssh so_n_so@sedition.com \
   /bin/db-file-converter /some/dir/ddx_search.yml
converting YAML ddx_search.yml to DB_File ddx_search.dbfile

Further

Check out YAML, DB_File, Storable, and Data::Dumper. All fantastic modules covering all the different data situations you’ll commonly get into.

Search these pages via Google
Text, original code, fonts, and graphics ©1990-2009 Ashley Pond V.