DBD:CSV problem on Solaris
am 28.06.2006 11:26:19 von Govinda.Pfister------_=_NextPart_001_01C69A94.E8600662
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
=20
I do have a problem with a littler perl script I wrote.
It uses DBD:CSV and I don=B4t know why it doesn=B4t work as I would =
expect it.
=20
After excuting the script it runs without output and ends without an =
error message.
It should read a CSV-File and print it contents out to STDOUT.
=20
I guess it might have something to do with file type (or record =
ending?), because I created the file with UltraEdit on windows and =
saved it via ftp on the solaris machine.
The user executing the scripts has the rights to read the file.
Would be great if someone could help me!
=20
This is the script:
--------------------------------
=20
#!/usr/local/bin/perl5.8.7 -w
=20
# modules used
use DBI;
use strict;
=20
my $dir =3D '/users/es7601a/user1/aradmin/govinda';
=20
my $dbh =3D DBI->connect("DBI:CSV:");
$dbh->{'csv_tables'}->{'test'} =3D { 'file' =3D> 'test02.csv'};
=20
$@ =3D '';
eval {
my $query =3D "SELECT * FROM test";
my $sth =3D $dbh->prepare($query);=20
$sth->execute();
while (my $row =3D $sth->fetchrow_hashref) {
print "Found result row: id =3D", $row->{'user_id'}, ", name =3D ", =
$row->{'last_name'}, "\n";
}
$sth->finish();
};
if ($@) { die "SQL database error: $@"; } =20
=20
$dbh->disconnect;
=20
--------------------------------
=20
the content of the csv-file I try to read:
--------------------------------=20
user_id,first_name,name_affix,last_name,form_of_address,titl e,e-mail,tel=
ephone,mobile,fax,company,org_short,org_long,cost_center,typ e_of_employe=
ment
"TMO02500003","Rita","","Bajaky","Frau","Dr.","rita.bajaky@t -mobile.net"=
,"+49
936 12309","TMO","JV3","Legal","0000059330","Aktive Markt"
=20
--------------------------------=20
=20
=20
my perl environment (perl -V):
--------------------------------
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=3Dsolaris, osvers=3D2.8, archname=3Dsun4-solaris
uname=3D'sunos solaris 5.8 generic_108528-11 sun4u sparc =
sunw,ultra-5_10 '
config_args=3D'-Dcc=3Dgcc -B/usr/ccs/bin/'
hint=3Drecommended, useposix=3Dtrue, d_sigaction=3Ddefine
usethreads=3Dundef use5005threads=3Dundef useithreads=3Dundef =
usemultiplicity=3Dundef
useperlio=3Ddefine d_sfio=3Dundef uselargefiles=3Ddefine =
usesocks=3Dundef
use64bitint=3Dundef use64bitall=3Dundef uselongdouble=3Dundef
usemymalloc=3Dn, bincompat5005=3Dundef
Compiler:
cc=3D'gcc -B/usr/ccs/bin/', ccflags =3D'-fno-strict-aliasing -pipe =
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64',
optimize=3D'-O',
cppflags=3D'-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion=3D'', gccversion=3D'3.3.2', gccosandvers=3D'solaris2.8'
intsize=3D4, longsize=3D4, ptrsize=3D4, doublesize=3D8, =
byteorder=3D4321
d_longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine, =
longdblsize=3D16
ivtype=3D'long', ivsize=3D4, nvtype=3D'double', nvsize=3D8, =
Off_t=3D'off_t', lseeksize=3D8
alignbytes=3D8, prototype=3Ddefine
Linker and Libraries:
ld=3D'gcc -B/usr/ccs/bin/', ldflags =3D' -L/usr/local/lib '
libpth=3D/usr/local/lib /usr/lib /usr/ccs/lib
libs=3D-lsocket -lnsl -ldl -lm -lc
perllibs=3D-lsocket -lnsl -ldl -lm -lc
libc=3D/lib/libc.so, so=3Dso, useshrplib=3Dfalse, =
libperl=3Dlibperl.a
gnulibc_version=3D''
Dynamic Linking:
dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef, ccdlflags=3D' =
'
cccdlflags=3D'-fPIC', lddlflags=3D'-G -L/usr/local/lib'
=20
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under solaris
Compiled at Dec 2 2005 01:34:16
@INC:
/usr/local/lib/perl5/5.8.7/sun4-solaris
/usr/local/lib/perl5/5.8.7
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.7
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
----------------------------------
my installed perl modules:
----------------------------------
ARS -- 1.84
AnyData -- 0.10
Archive::Tar -- 1.29
Archive::Zip -- 1.16
Compress::Zlib -- 1.41
Cwd -- 3.18
DBD::AnyData -- 0.08
DBD::CSV -- 0.22
DBD::Informix -- 2005.02
DBI -- 1.51
Digest::SHA -- 5.41
ExtUtils::AutoInstall -- 0.63
File::HomeDir -- 0.58
HTML-Tree -- ???
HTML::Parser -- 3.54
IO::Zlib -- 1.04
Irssi -- 0.9
Irssi::Irc -- 0.9
Irssi::TextUI -- 0.9
Irssi::UI -- 0.9
LWP -- 5.805
Module::Build -- 0.2801
Module::Signature -- 0.54
Net::Telnet -- 3.03
PAR::Dist -- 0.10
Perl -- 5.8.7
SQL::Statement -- 1.15
Sort::Versions -- 1.5
Spiffy -- 0.30
Term::ReadKey -- 2.30
Term::ReadLine -- 1.01
Test::Base -- 0.52
Test::Simple -- 0.62
Text::CSV_XS -- 0.23
Text::Glob -- 0.06
YAML -- 0.58
----------------------------------
=20
=20
Govinda Pfister=20
Remedy Approved Consultant, Clarify Certified Consultant, =
ITIL-Certified
Projectcenter Business Process Solutions
Solution & Service Center Business Enabling Solutions
Global Competence Center
T-Systems Enterprise Services GmbH
Memmelsdorfer Str. 209a, 96052 Bamberg
+49 951 4097-161 (Tel)
+49 951 4097-200 (Fax)
E-Mail: Govinda.Pfister
@t-systems.com
Internet:
=20
------_=_NextPart_001_01C69A94.E8600662--