login about faq

I'm using the Chilkat CkCsv object from the Perl package on Windows XP, Perl 5.12. I'm encountering an issue where there appears to be a conflict with two other Perl modules, Regexp and DateTime. I'm using a CSV version of the following file: link:data and attempting to print out the number of rows.
My code is:


use strict;
use warnings;
use diagnostics;
use chilkat();

use Regexp::Common qw(time); #problematic module
use DateTime; #problematic module
my $csv2 = new chilkat::CkCsv();
my $success = $csv2->LoadFile("Parking_citations.csv");
if ($success != 1) {
print $csv2->lastErrorText() . "n";

my $n = $csv2->get_NumRows();
print $n;

The above code returns the wrong number of rows, while commenting out either of the two additional use statments also returns a different wrong number of rows. Only commenting out both returns the correct number of rows. What's weird is that in my test code I'm not even using the modules, just requiring them with the use statement.

The CkCsv module works correctly on other data files that I've tested, just not the parking citation file. It also appears to work correctly on my Linux box, so perhaps the problem is with Strawberry Perl?

Can anyone else test this by adding the two use statements from above to their Perl CkCsv code and see if the number of rows returned is correct?

I'm quite willing to test out any suggestions, the Chilkat module is more than twice as fast as what I've been using, but it needs to work correctly in my larger project. Thanks.

asked Jun 05 '12 at 08:29

glepore70's gravatar image


edited Jun 05 '12 at 08:34

I tried downloading the .csv file, but the "export" functionality at that particular web page doesn't seem to work. The file download never stops -- it was at 150MB and growing, and I didn't think the file could be that large. How large is it? Would you be able to send it to me in a .zip at support@chilkatsoft.com?

Best Regards, Matt


answered Jun 05 '12 at 11:33

chilkat's gravatar image

chilkat ♦♦


Unfortunately the file is pretty big, around 250MB, I haven't seen the bug with smaller files. The file has 1,632,811 lines in it, but ChkCsv only sees 228,139. Usually when I encounter these types of parsing issues it has to do with text encoding issues, but this definitely seems to be related to the USE statements for the other modules. Thanks for looking into this.


answered Jun 05 '12 at 11:40

glepore70's gravatar image


I tried the same code on a 64 bit installation of Strawberry Perl on Vista and it ran correctly...


answered Jun 05 '12 at 11:59

glepore70's gravatar image


Please try this new build: http://www.chilkatsoft.com/preRelease/chilkat-9.3.1-perl-5.12-win32_64.tar.gz

Also, load the file by calling LoadFile2 using "utf-8":

my $success = $csv2->LoadFile2("Parking_citations.csv", "utf-8");

This will improve performance. PS> My testing shows that the number of rows in the CSV is 1663273.


answered Jun 07 '12 at 11:13

chilkat's gravatar image

chilkat ♦♦

I forgot to mention that I'm on 32 bit, but I found the prerelease build for that. Adding the utf-8 parameter worked. I guess there's something wonky about the file. Thanks a ton for working this through, my code is now 3-6 times faster than using my previous method (Text::CSV_XS), although Text::CSV_XS has more parameters to handle "dirty" data such as uneven quoting and escape characters. I've implemented ChkCsv as a "fast mode" for cleaner data, then fall back to Text::CSV_XS for more complicated data. I still get 1632812 rows using both the parsers and "wc -l"..

Thanks again!


answered Jun 07 '12 at 11:26

glepore70's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jun 05 '12 at 08:29

Seen: 1,690 times

Last updated: Jun 07 '12 at 11:26

powered by OSQA