Scroll to navigation

Catmandu::Exporter::Mock(3pm) User Contributed Perl Documentation Catmandu::Exporter::Mock(3pm)

NAME

Catmandu::Exporter::Mock - a exporter that doesn't export anything

SYNOPSIS

    # From the commandline
    $ catmandu convert JSON --fix myfixes to Mock < /tmp/data.json
    # From Perl
    use Catmandu;
    # Print to STDOUT
    my $exporter = Catmandu->exporter('Mock',fix => 'myfix.txt');
    $exporter->add_many($arrayref);
    $exporter->add_many($iterator);
    $exporter->add_many(sub { });
    $exporter->add($hashref);
    printf "exported %d items\n" , $exporter->count;
    # Get an array ref of all records exported
    my $data = $exporter->as_arrayref;

DESCRIPTION

This exporter exports nothing and can be used as in situations where you e.g. export data from a fix. Other the Null exporter, the Mock exporter will keep an internal array of all the records exported which can be retrieved with the 'as_arrayref' method.

SEE ALSO

Catmandu::Exporter::Null

2023-03-03 perl v5.36.0