[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] DBI Question



# DBD::File::db do failed: # Can't locate object method "new" via package
"IO::File".
File 'Primus 8.5GB:Applications:MacPerl Ÿ:site_perl:DBD:File.pm'; Line 461

the ONLY change I made to this script was changing dbi:RAM to dbi:File

#!/usr/local/bin/perl -w
use strict;
use DBI;
my $dbh   = DBI->connect('dbi:File(RaiseError=>1):')
            || die $DBI::errstr;
my $table = 'testTable';
$dbh->do("CREATE TABLE $table ( name TEXT, sex TEXT, state TEXT )");
$dbh->do("INSERT INTO $table VALUES ('Joe','m','US')");
$dbh->do("INSERT INTO $table VALUES ('Sue','f','US')");
$dbh->do("INSERT INTO $table VALUES ('Bob','m','CA')");
$dbh->do("INSERT INTO $table VALUES ('Bev','f','US')");
$dbh->do("DELETE FROM $table WHERE name = 'Bev'");
$dbh->do("UPDATE $table SET state = 'CA' WHERE name = 'Sue'");
my $sth = $dbh->prepare(qq/
    SELECT * FROM $table WHERE name LIKE "%e%" ORDER BY name
/);
$sth->execute;
while (my $row = $sth->fetch) {
    foreach (@$row) {print "[$_] "};
    print "\n";
}
#$dbh->do("DROP TABLE $table");
__END__

Does this mean I need to update IO::File, and if so, to which version?



-- 
Scott R. Godin            | e-mail : webmaster@webdragon.net
Laughing Dragon Services  |    web : http://www.webdragon.net/



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org