diff options
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index bb4a48d65..3ecb13b6a 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -716,4 +716,15 @@ sub encoded_content { return encode_utf8($self->content); } +sub content_as_csv { + my $self = shift; + open my $data_handle, '<', \$self->content; + my $csv = Text::CSV->new({ binary => 1 }); + my @rows; + while (my $row = $csv->getline($data_handle)) { + push @rows, $row; + } + return @rows; +} + 1; |