The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PICA::Writer - Write and count PICA+ records and fields

SYNOPSIS

  my $writer = PICA::Writer->new(\*STDOUT);

  $writer->write( $record );
  $writer->write( $comment, $record );

  print $writer->counter() . " records, " . $writer->fields() . " fields\n";

  $writer->writefield( $field );
  $writer->reset();

DESCRIPTION

This module contains a simple class to write and count PICA+ records and fields (printing of single fields may not be possible in all implementations).

PUBLIC METHODS

new (file-or-handle)

Create a new parser. Needs a reference to a file handle or a file name. If no parameter is specified then the writer will not write but count only.

reset

Reset the writer by setting the counters to zero. You may also specify a new file handler or file name.

reset_handler

Reset the file handler or file name without resetting the counters.

write

Write a record(s) of type PICA::Record. You may specify strings before a record that will be used as a comment:

  $writer->write( $record );
  $writer->write( @records );
  $writer->write( "Record number: $counter", $record );

writefield

Write one ore more PICA::Field. Please be aware that the output will not be wellformed PICA+ if you have not written a start record marker before!

counter

Returns the number of written records.

fields

Returns the number of written fields.

name

Returns the name of the writer (usually the filename) if defined.

AUTHOR

Jakob Voss <jakob.voss@gbv.de>

LICENSE

Copyright (C) 2007 by Verbundzentrale Goettingen (VZG) and Jakob Voss

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.