C
cartercc
Can anyone tell me why this happens? Here is the code, the console
output, and the results.
First, the code. This copies data from five external files into
(empty) tables in my database:
eval
{
system('psql -U studentinfo -d studentinfo -c "\\copy student08t5
from \'/home/studentinfo/data/import_student.csv\' using delimiters \'|
\' "') or warn "I could not copy STUDENT file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy section08t5
from \'/home/studentinfo/data/import_section.csv\' using delimiters \'|
\' "') or warn "I could not copy SECTION file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy phone08t5
from \'/home/studentinfo/data/import_phone.csv\' using delimiters \'|
\' "') or warn "I could not copy PHONE file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy email08t5
from \'/home/studentinfo/data/import_email.csv\' using delimiters \'|
\' "') or warn "I could not copy EMAIL file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy address08t5
from \'/home/studentinfo/data/import_address.csv\' using delimiters \'|
\' "') or warn "I could not copy ADDRESS file to table, $!";
};
warn $@ if $@;
Next, the output. This is what is printed to the console when I run
the script:
[studentinfo@tsuse data]$ perl test02.plx
I could not copy STUDENT file to table, No such file or directory at
test02.plx line 24.
I could not copy SECTION file to table, No such file or directory at
test02.plx line 25.
I could not copy PHONE file to table, No such file or directory at
test02.plx line 26.
I could not copy EMAIL file to table, No such file or directory at
test02.plx line 27.
I could not copy ADDRESS file to table, No such file or directory at
test02.plx line 28.
[studentinfo@tsuse data]$
Finally, the results. Well, I won't bore you with the results (the
files contain about 21,000 records) but this successfully writes the
data to the database.
Question: Why do the warn statements print if the copy command works?
CC
output, and the results.
First, the code. This copies data from five external files into
(empty) tables in my database:
eval
{
system('psql -U studentinfo -d studentinfo -c "\\copy student08t5
from \'/home/studentinfo/data/import_student.csv\' using delimiters \'|
\' "') or warn "I could not copy STUDENT file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy section08t5
from \'/home/studentinfo/data/import_section.csv\' using delimiters \'|
\' "') or warn "I could not copy SECTION file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy phone08t5
from \'/home/studentinfo/data/import_phone.csv\' using delimiters \'|
\' "') or warn "I could not copy PHONE file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy email08t5
from \'/home/studentinfo/data/import_email.csv\' using delimiters \'|
\' "') or warn "I could not copy EMAIL file to table, $!";
system('psql -U studentinfo -d studentinfo -c "\\copy address08t5
from \'/home/studentinfo/data/import_address.csv\' using delimiters \'|
\' "') or warn "I could not copy ADDRESS file to table, $!";
};
warn $@ if $@;
Next, the output. This is what is printed to the console when I run
the script:
[studentinfo@tsuse data]$ perl test02.plx
I could not copy STUDENT file to table, No such file or directory at
test02.plx line 24.
I could not copy SECTION file to table, No such file or directory at
test02.plx line 25.
I could not copy PHONE file to table, No such file or directory at
test02.plx line 26.
I could not copy EMAIL file to table, No such file or directory at
test02.plx line 27.
I could not copy ADDRESS file to table, No such file or directory at
test02.plx line 28.
[studentinfo@tsuse data]$
Finally, the results. Well, I won't bore you with the results (the
files contain about 21,000 records) but this successfully writes the
data to the database.
Question: Why do the warn statements print if the copy command works?
CC