in reply to perl cgi and flat textfile
I am tempted to simply say "yes" to all three of your questions, but that really wouldn't be fair. It really depends on your coding skill and how much extra work you want to put into it. Using one-liners, here are basic steps:
# deleting entries perl -ni -e 'print if $_ !~ /old_stuff/' somefile.txt # editing entries perl -pi -e 's/new_stuff/old_stuff/' somefile.txt # adding entries :) cat somefile.txt new_records.txt > new_file.txt
As you can see, nothing in the above list is difficult, it's all in what you really need to do. However, incorporating such things into a program can sometimes be difficult. If you must use flat files, I would strongly recommend using DBD::CSV. Then, if you need to switch to a database, the conversion is trivial.
If you do decide to use a CSV database (with or without DBD::CSV), you can use my CSV Database Validation program which does a fairly rigorous job of ensuring the integrity of your data. You can use it to define basic data types, foreign key constraints and even match data against regular expressions. Create a schema, create your data and put your application through its paces. Then, run the validation script against it to ensure the integrity of your data.
I include full POD documentation in the program including a small tutorial.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl cgi and flat textfile
by Anonymous Monk on Dec 11, 2013 at 13:48 UTC | |
by marto (Cardinal) on Dec 11, 2013 at 14:03 UTC |