19.10. CSV Previous topic Parent topic Child topic Next topic

DBD::CSV is a Perl database driver that uses flat text files as the database. The default supports comma separated files, but that can be customised in many ways, to support for example Unix password format and Excel spreadsheet formats. DBD::CSV is available from CPAN. For more information, see Section 2.1.2. CPAN.
In DBSource, driver name is "CSV", and a required option is f_dir, which specifies the directory where the database files exist. DBUsername and DBAuth are not required and are ignored.
DBD::CSV databases are flat text files. The first line of a database file contains the names of the columns in the file. To create a new database file, you need to create the text file with an editor, for example, a simple database for subscribers that will work the default AuthSelect in AuthBy SQL would look like this:
USERNAME,PASSWORD
mikem,fred
jim,jim
......
<more lines, one per user>
......
For DBD::CSV on Unix, configure your SQL clause like this. DBUsername and DBAuth are not required. f_dir specifies the directory where the database files are located. csv_eol in this example specifies that the line separators are Unix newlines. You must have this for a Unix style text file. You can leave it off to get Windows standard text files.
DBSource    dbi:CSV:f_dir=/your/data/dir;csv_eol=\012