.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Data::TableReader::Decoder::IdiotCSV 3pm" .TH Data::TableReader::Decoder::IdiotCSV 3pm 2024-04-12 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Data::TableReader::Decoder::IdiotCSV \- Access rows of a badly formatted comma\-delimited text file .SH VERSION .IX Header "VERSION" version 0.014 .SH DESCRIPTION .IX Header "DESCRIPTION" This decoder is like ::Decoder::CSV, but can additionally parse the garbage resulting from those special people who write "CSV Export" code that looks like .PP .Vb 1 \& print join(",", map qq{"$_"}, @record)."\en"; .Ve .PP (or rather, the equivalent code in Visual Basic or PHP which is what they're probably using) regardless of their data containing quote characters or newlines, resulting in garbage like: .PP .Vb 2 \& "First Name","Last Name","email" \& "Joseph "Joe","Smith",""Smith, Joe" " .Ve .PP This can actually be processed by (recent versions of) the Text::CSV module with the following configuration: .PP .Vb 6 \& { \& binary => 1, \& allow_loose_quotes => 1, \& allow_whitespace => 1, \& escape_char => undef, \& } .Ve .PP And so this module is simply a subclass of Data::TableReader::Decoder::CSV which provides those defaults to the parser. .PP How does the parsing work though? Well, some guesswork and patterns. It's not super reliable, and you should always complain loudly to whoever generated that data, unless they're a much larger company than you and would never listen, or went out of business a while back, in which case you can justify using this module in production. .SH AUTHOR .IX Header "AUTHOR" Michael Conrad .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2024 by Michael Conrad. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.