Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

After several years of silence, I received maintainership on Text::CSV_XS
from Jochen Wiedman. Please enjoy the new features

  file: $CPAN/authors/id/H/HM/HMBRAND/Text-CSV_XS-0.25.tgz
  size: 22857 bytes
   md5: 1b57894ccdb711e76d368257757ce8ea

Request entered by: HMBRAND (H.Merijn Brand)
Request entered on: Mon, 07 May 2007 15:10:01 GMT

        * Merijn got the maintainership
        - code reformat and code cleanup
        - renamed internal (Encode, Decode) to (Combine, Parse) to
          prevent misinterpretation with upcoming Unicode changes
          and possible name clashes
        - added pod check (and fixed pod)
        - added pod coverage and small additions to the pod.
          More to do in this area
        - renamed test to fixate the sequence
        - Added t/50_utf8.t
        - tests now use Test::More
          . Makefile.PL requires Test::More
        - checked proclaimed version compatibility
          . 5.9.x-64int     works @31159
          . 5.8.x-64int-dor works @31162
          . 5.8.0-dor       works
          . 5.6.2           works
          . 5.005.04        works
          . 5.004.05        fails
        - 5.005 is now prerequisite
        - Added missing info in docs for new ()
        - Added meta_info () method and docs
        - Added keep_meta_info in new ()
        - Added t/15_flags.t
        - Added test_cover make target
        - Added test for error_input ()
        - Added tests for fields () and meta_info () before parse ()
        - Added tests for ->types () as method
        - Added tests for deleting types (coverage now over 99%)
        - Added is_quoted (), is_binary () and tests
        - Added COPYRIGHT section to pod
        - Added the parse example from the pod to test.pl
        - Added accessor methods for internals: quote_char () et all
        - Added tests for the new accessor methods
        - Added always_quote to the missing places in the doc and in new ()
        - Changed the tests to use the accessors instead of the hash keys
          except for the -> and ->
        - Moved test.pl to examples/speed.pl

           To sum it up,

            $csv = Text::CSV_XS$,1x2(B>new ();

           is equivalent to

            $csv = Text::CSV_XS$,1x2(B>new ({
                quote_char     => $,1ry(B"$,1ry(B,
                escape_char    => $,1ry(B"$,1ry(B,
                sep_char       => $,1ry(B,$,1ry(B,
                eol            => $,1ryry(B,
                always_quote   => 0,
                binary         => 0,
                keep_meta_info => 0,

           For all of the above mentioned flags, there is an accessor  method
           available where you can inquire for the current value, or change
           the value

            my $quote = $csv$,1x2(B>quote_char;
            $csv$,1x2(B>binary (1);
            @flags = $csv$,1x2(B>meta_info ();

           This object function returns the flags of the input to "combine  ()"
           or the flags of the resultant decomposed fields of "parse ()",
           whichever was called more recently.

           For each field, a meta_info field will hold flags that tell
           something about the field returned by the "fields ()" method or
           passed to the "combine ()" method. The flags are
bitwise$,1rp(Bor$,1ry(Bd  like:

               The field was quoted.

               The field was binary.

           See the "is_*** ()" methods below.

             my $quoted = $csv$,1x2(B>is_quoted ($column_idx);

           Where $column_idx is the (zero$,1rp(Bbased) index of the column in
           last result of "parse ()".

           This returns a true value if the data in the indicated column  was
           enclused in "quote_char" quotes. This might be important for  data
           where ",20070108," is to be treated as a numeric value, and  where
           ","20070108"," is explicitely marked as character string data.

             my $binary = $csv$,1x2(B>is_binary ($column_idx);

           Where $column_idx is the (zero$,1rp(Bbased) index of the column in
           last result of "parse ()".

           This returns a true value if the data in the indicated column
           contained any byte in the range

       An example for parsing CSV lines:

         use Text::CSV_XS;

         my $csv = Text::CSV_XS$,1x2(B>new ({ keep_meta_info => 1, binary => 1

         my $sample_input_string =
             qq{"I said, ""Hi!""",Yes,"",2.34,,"1.09","\x",};
         if ($csv$,1x2(B>parse ($sample_input_string)) {
             my @field = $csv$,1x2(B>fields;
             foreach my $col (0 .. $#field) {
                 my $quo = $csv$,1x2(B>is_quoted ($col) ?
$csv$,1x2(B> :  "";
                 printf "%2d: %s%s%s\n", $col, $quo, $field[$col], $quo;
         else {
             my $err = $csv$,1x2(B>error_input;
             print "parse () failed on argument: ", $err, "\n";

H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org /)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers /

Site Timeline