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

NAME

DDC::Format - Abstract output formatting API for DDC hits

SYNOPSIS

 use DDC::Concordance;

 $hitList = DDC::Client::Distributed->new()->query('foo&&bar'); ##-- get some hits

 $fmt  = DDC::Format->new(%some_args); ##-- new format
 $str = $fmt->toString($hitList);      ##-- conversion to string
 $fmt->toFile($hitList,$filename);     ##-- output to file
 $fmt->toFh($hitList,$fh);             ##-- output to filehandle

DESCRIPTION

Abstract class for hit formatting.

Constructors, etc.

new
 $fmt = $CLASS_OR_OBJ->new(%args);

Derived classes may accept keyword arguments in %args. The abstract implementation interprets them as literal keys in the underlying object structure (a HASH-ref).

reset
 $fmt = $fmt->reset();

Reset counters, etc.

API

toString
 $str = $fmt->toString($hitList);

Should format a DDC::HitList object $hitList to a string representation.

Dummy implementation.

toFile
 undef = $fmt->toFile($hitList,$file);

Should format a DDC::HitList object $hitList to a named file $file.

Default implementation calls $fmt->toFh().

toFh
 undef = $fmt->toFh($hitList,$fh);

Should format a DDC::HitList object $hitList to a filehandle $fh opened for output.

Default implementation calls $fmt->toString().

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2006-2016 by Bryan Jurish

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