[Catalyst-commits] r11402 - in
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk: .
lib/Catalyst/Action/Serialize t t/lib/TestApp/Controller
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Thu Sep 24 10:25:46 GMT 2009
Author: caelum
Date: 2009-09-24 10:25:46 +0000 (Thu, 24 Sep 2009)
New Revision: 11402
Modified:
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Changes
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Makefile.PL
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/lib/Catalyst/Action/Serialize/SimpleExcel.pm
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/excel.t
Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/lib/TestApp/Controller/REST.pm
Log:
added keep_leading_zeros
Modified: Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Changes
===================================================================
--- Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Changes 2009-09-24 04:41:05 UTC (rev 11401)
+++ Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Changes 2009-09-24 10:25:46 UTC (rev 11402)
@@ -1,5 +1,8 @@
Revision history for Catalyst-Action-Serialize-SimpleExcel
+0.013 2009-09-24 10:22:22
+ Added $worksheet->keep_leading_zeros(1)
+
0.012 2008-11-17 15:24:22 PDT
Added automatic column widths support.
Modified: Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Makefile.PL
===================================================================
--- Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Makefile.PL 2009-09-24 04:41:05 UTC (rev 11401)
+++ Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/Makefile.PL 2009-09-24 10:25:46 UTC (rev 11402)
@@ -1,4 +1,4 @@
-use inc::Module::Install 0.87;
+use inc::Module::Install 0.91;
name 'Catalyst-Action-Serialize-SimpleExcel';
all_from 'lib/Catalyst/Action/Serialize/SimpleExcel.pm';
Modified: Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/lib/Catalyst/Action/Serialize/SimpleExcel.pm
===================================================================
--- Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/lib/Catalyst/Action/Serialize/SimpleExcel.pm 2009-09-24 04:41:05 UTC (rev 11401)
+++ Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/lib/Catalyst/Action/Serialize/SimpleExcel.pm 2009-09-24 10:25:46 UTC (rev 11402)
@@ -14,11 +14,11 @@
=head1 VERSION
-Version 0.012
+Version 0.013
=cut
-our $VERSION = '0.012';
+our $VERSION = '0.013';
=head1 SYNOPSIS
@@ -78,7 +78,7 @@
=head1 DESCRIPTION
-Your entity should be either an array of arrays, or the more embellished format
+Your entity should be either an array of arrays or a hash with the keys as
described below and in the L</SYNOPSIS>.
If entity is a hashref, keys should be:
@@ -120,6 +120,8 @@
my $workbook = Spreadsheet::WriteExcel->new($fh);
my $worksheet = $workbook->add_worksheet;
+ $worksheet->keep_leading_zeros(1);
+
my ($row, $col) = (0,0);
my @auto_widths;
Modified: Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/excel.t
===================================================================
--- Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/excel.t 2009-09-24 04:41:05 UTC (rev 11401)
+++ Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/excel.t 2009-09-24 10:25:46 UTC (rev 11402)
@@ -7,7 +7,7 @@
use Catalyst::Test 'TestApp';
use Spreadsheet::ParseExcel ();
-use Test::More tests => 14;
+use Test::More tests => 17;
use Test::Deep;
# Test array of array
@@ -24,6 +24,19 @@
'array_of_array -> sheet'
);
+# test that number-like data does not get numified
+ok(($file = get '/rest/no_numify?content-type=application%2Fvnd.ms-excel'),
+ 'received file');
+ok(($excel = Spreadsheet::ParseExcel::Workbook->Parse(\$file)),
+ 'parsed file');
+$sheet = $excel->{Worksheet}[0];
+
+cmp_deeply(
+ read_sheet($sheet),
+ [['01',' 2',3],[4,5,'006']],
+ 'data is not numified'
+);
+
# Test automatic column widths
ok(($file = get '/rest/auto_widths?content-type=application%2Fvnd.ms-excel'),
Modified: Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/lib/TestApp/Controller/REST.pm
===================================================================
--- Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/lib/TestApp/Controller/REST.pm 2009-09-24 04:41:05 UTC (rev 11401)
+++ Catalyst-Action-Serialize-SimpleExcel/1.000/trunk/t/lib/TestApp/Controller/REST.pm 2009-09-24 10:25:46 UTC (rev 11402)
@@ -20,6 +20,21 @@
);
}
+sub no_numify : Local ActionClass('REST') {}
+
+# test that strings that parse as numbers pass through unmolested
+sub no_numify_GET {
+ my ($self, $c) = @_;
+
+ $self->status_ok(
+ $c,
+ entity => [
+ ['01',' 2',3],
+ [4,5,'006']
+ ]
+ );
+}
+
sub fancy : Local ActionClass('REST') {}
sub fancy_GET {
More information about the Catalyst-commits
mailing list