DDC::Format::Text - human-readable text formatting for DDC hits
use DDC::Concordance; $hitList = DDC::Client::Distributed->new()->query('foo&&bar'); ##-- get some hits $fmt = DDC::Format::Text->new(columns=>$ncols); $str = $fmt->toString($hitList); ##-- conversion to string $fmt->toFile($hitList,$filename); ##-- output to file $fmt->toFh($hitList,$fh); ##-- output to filehandle
Class for formatting DDC::Hit objects as plain text.
DDC::Format::Text inherits from DDC::Format.
$fmt = $CLASS_OR_OBJ->new(%args);
Accepted keywords in %args:
( start=>$previous_hit_num, ##-- pre-initial hit number (default=0) highlight=>[$pre,$post], ##-- highlighting substrings columns=>$ncols, ##-- for text wrapping [default=80] useMatchIds=>$bool, ##-- whether to use match-ids if available; undef (default) if non-trivial match-ids are specified wsAttr=>$attr, ##-- token attribute to use for preceding whitespace (default='ws') )
$fmt = $fmt->reset();
Resets the formatting object.
$hitStr = $fmt->hitString($hit);
Formats a single $hit as a string, incrementing the counter $fmt->{start} as a side-effect.
$hit
$fmt->{start}
$str = $fmt->toString($hitList);
Implements DDC::Format::toString().
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2006-2020 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.
To install DDC::Concordance, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DDC::Concordance
CPAN shell
perl -MCPAN -e shell install DDC::Concordance
For more information on module installation, please visit the detailed CPAN module installation guide.