http://qs321.pair.com?node_id=526120


in reply to Re: DBD::CSV failing
in thread DBD::CSV failing

<sigh gauge="heavy"> ARgh.

Here's the code:

#! /usr/local/bin/perl # use DBI; use DBD::CSV; my($dh, $sh); my($row); $dh = DBI->connect("DBI:CSV:") || die "Cannot connect: ". $DBI::errstr; $dh->{'csv_tables'}->{'passwd'} = { 'eol' => '\n', 'sep_char' => ':', 'quote_char' => undef, 'escape_char' => undef, 'file' => '/etc/passwd', 'col_names' => ["login", "password", "uid", "gid", "gecos", "dir", "shell"] }; $sh = $dh->prepare("SELECT * FROM passwd") || die "Cannot prepare: ". $dh->errstr(); $sh->execute() || die "Cannot execute: ". $sh->errstr(); while ($row = $sh->fetch) { printf "%s\n", $row; }

Data is the /etc/passwd file at work which, for obvious reasons, I cannot post here.

Suffice to say it is a file of greater than one line consisting of records of the format:

user:*:[0-9]+:[0-9]+:Real Name:/dir:/path/to/shell

The output I get is the first row in the passwd file and no more.

--*greywolf;
/* relayer halo gmail */