From 6c40adee13e3b5322bb47284c0b8139cbcbc82d3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 13 Sep 2010 07:52:14 -0700 Subject: [PATCH] Fix line ending processing by the Thingy. It will now accept CSV files with any line endings. Fixes bug #11746. --- docs/changelog/7.x.x.txt | 1 + docs/gotcha.txt | 4 ++++ lib/WebGUI/Asset/Wobject/Thingy.pm | 3 ++- sbin/testEnvironment.pl | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 12c72b300..e347b58c7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,6 +1,7 @@ 7.10.1 - fixed #11851: Story Topic: top story variables should be available all the time - fixed #11854: CS doesn't return Not Found page + - fixed #11746: Thingy import CSV only supports one line ending 7.10.0 - fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters diff --git a/docs/gotcha.txt b/docs/gotcha.txt index b0ac64bd1..aacaa2fce 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -21,6 +21,10 @@ save you many hours of grief. Account Macro template Admin Toggle Macro template +7.10.1 +-------------------------------------------------------------------- + * WebGUI now depends on PerlIO::eol, for doing line ending translation. + 7.10.0 -------------------------------------------------------------------- * Due to a bug in the 7.8.24-7.9.11 upgrade, the ordering of template diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index e7456c3be..3b4285c57 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -17,6 +17,7 @@ use WebGUI::International; use WebGUI::Text; use WebGUI::Form::File; use WebGUI::DateTime; +use PerlIO::eol qw/NATIVE/; use Moose; use WebGUI::Definition::Asset; @@ -2797,7 +2798,7 @@ sub www_import { next unless ($storage->getFileExtension($file) eq "csv"); $error->info("Found import file $file"); - open my $importFile,"<",$storage->getPath($file); + open my $importFile,"<:raw:eol(NATIVE)",$storage->getPath($file); my $lineNumber = 0; my @data = (); diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index 01132c82f..bea2a0240 100755 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -156,6 +156,7 @@ checkModule('IO::Socket::SSL', ); checkModule('Package::Stash', ); checkModule('HTTP::Exception', ); checkModule('Net::Twitter', "3.13006" ); +checkModule('PerlIO::eol', "0.14" ); checkModule('Number::Format', ); checkModule('Email::Valid', ); checkModule('Facebook::Graph', '0.0505' );