View on
MetaCPAN
Nicolas Steenlant > Catmandu-0.0302 > Catmandu::Exporter::CSV

Download:
Catmandu-0.0302.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: Catmandu-1.07

NAME ^

Catmandu::Exporter::CSV - a CSV exporter

SYNOPSIS ^

    use Catmandu::Exporter::CSV;

    my $exporter = Catmandu::Exporter::CSV->new(
                                fix => 'myfix.txt'
                                quote_char => '"' ,
                                split_char => ',' ,
                                header => 1);

    $exporter->fields("f1,f2,f3");

    $exporter->add_many($arrayref);
    $exporter->add_many($iterator);
    $exporter->add_many(sub { });

    $exporter->add($hashref);

    printf "exported %d objects\n" , $exporter->count;

METHODS ^

new(quote_char => STRING, split_char => STRING, header => 0|1, fields => ARRAY|HASH|STRING)

Creates a new Catmandu::Exporter::CSV. Optionally set the field and column boundaries with quote_char and split_char. If header is set to 1, then a header line with field names will be included. Field names can be read from the first item exported or set by the fields argument (see: fields).

fields($arrayref)

Set the field names by an ARRAY reference.

fields($hashref)

Set the field names by the keys of a HASH reference.

fields($string)

Set the fields by a comma delimited string.

SEE ALSO ^

Catmandu::Exporter

syntax highlighting: