Hello,
 
I do have a problem with a littler perl script I wrote.
It uses DBD:CSV and I don´t know why it doesn´t work as I would expect it.
 
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.
 
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!
 
This is the script:
--------------------------------
 
#!/usr/local/bin/perl5.8.7 -w
 
# modules used
use DBI;
use strict;
 

my $dir   = '/users/es7601a/user1/aradmin/govinda';
 
my $dbh = DBI->connect("DBI:CSV:");
$dbh->{'csv_tables'}->{'test'} = { 'file' => 'test02.csv'};
 

$@ = '';
eval {
 my $query = "SELECT * FROM test";
 my $sth = $dbh->prepare($query); 
 $sth->execute();
  while (my $row = $sth->fetchrow_hashref) {
   print "Found result row: id =", $row->{'user_id'}, ", name = ", 
$row->{'last_name'}, "\n";
  }
 $sth->finish();
};
if ($@) { die "SQL database error: $@"; }      
 
$dbh->disconnect;
 
--------------------------------
 
the content of the csv-file I try to read:
-------------------------------- 
user_id,first_name,name_affix,last_name,form_of_address,title,e-mail,telephone,mobile,fax,company,org_short,org_long,cost_center,type_of_employement
"TMO02500003","Rita","","Bajaky","Frau","Dr.","[EMAIL PROTECTED]","+49 
<mailto:[EMAIL PROTECTED]>  (228) 936 12313","","+49 (228) 936 
12309","TMO","JV3","Legal","0000059330","Aktive Markt"
 
-------------------------------- 
 
 
my perl environment (perl -V):
--------------------------------
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=solaris, osvers=2.8, archname=sun4-solaris
    uname='sunos solaris 5.8 generic_108528-11 sun4u sparc sunw,ultra-5_10 '
    config_args='-Dcc=gcc -B/usr/ccs/bin/'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef 
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc -B/usr/ccs/bin/', ccflags ='-fno-strict-aliasing -pipe 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.2', gccosandvers='solaris2.8'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
 

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
----------------------------------
 
 

Govinda Pfister 
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 <mailto:[EMAIL PROTECTED]> @t-systems.com
Internet:  <http://www.t-systems.com/> http://www.t-systems.com 




 

Reply via email to