in reply to Problem parsing semicolon delimited file with DBD::CSV

Your problem is your connect statement. It has several problems. In the first place you omitted the second and third parameters (username and password). In the second place you neglected to put curly braces around the hash reference of attributes. In the third place you used a backslash before the semicolon but inside single quote marks which will not inerpolate the backslash. You made the same mistake with backslashes inside single quotes in your call to ad_catalog. Here's how you should connect and pass the arguments:
my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):'); $dbh->func( 'callsigns', 'CSV', 'C:/Documents and Settings/My Documents/MyProjects/ParsingXML/log +.jdb', { sep_char => ';' }, 'ad_catalog' );

Replies are listed 'Best First'.
Re^2: Problem parsing semicolon delimited file with DBD::CSV
by sxmwb (Pilgrim) on Jul 27, 2006 at 23:59 UTC
    Thanks for the information, I knew the samples I was using would not get me to the exact place.

    I made the suggested changes and still get the same error as above. I find through some research that it is not figuring out the columns from the first row.

    Anything else I can check?

    Thanks - Mike
      try using field_sep instead of sep_char. I can't find any mention of the latter in the sources.
        Thanks, tried the field_sep and still the same result. It does not look like it is recognizing the code to tell it to use the semicolon as a separator character and is still using commas.
      Try to also directly set the eol character to "\n". Try to change the names of Date and Time (because they are SQL keywords). I ran your code with your data and the changes I suggested above and it worked for me.
        I tried as you suggested.

        If I use DBD::CSV without DBD::AnyData it works great, when I use DBD::AnyData and pass the eol and field separator character through it dies with the messages in the original message.

        I am running ActivePerl 5.8 on Windows using Komodo 3.5 to do the development and debugging.

        As I run the debugger, I find that as the code moves from DBD::AnyData to DBD::CSV, CSV parses the first record correctly but for some reason as the code jumps back to DBD::AnyData, AnyData does not see the parsed record and dies with the messages in the original message.

        Being a novice not sure why or whatelse to look for but it is interesting your code works and mine does not. One other thing I found is my records are terminated with CRLF which I was able to pass to DBD::AnyData and parse the records fine and with DBD::CSV I use just the \n and it parses the records fine while if I pass DBD::AnyData just the \n it does not parse the records at all.

        Sorry this is so long wind and may be rambling but I am trying my best to provide reasonably good information to help.

        Thanks
        Mike