Skip to content

kentnl/Comment-Spell

Repository files navigation

NAME

Comment::Spell - Spell Checking for your comments

VERSION

version 0.001003

SYNOPSIS

Comment::Spell is a work-a-like for Perl Comments similar to Pod::Spell.

It offers no in-built spell checking services, merely streamlines extracting tokens to pass to a spell checker of your choice, while removing some basic useful items (stop-words).

It also, by default, ignores comments with two or more leading hashes so to avoid directive comments like those found in Perl::Critic

# Shorthand for CLI
perl -MComment::Spell -e 'Comment::Spell->new->parse_from_file(q[Foo.pm])' | spell -a

# Advanced Usage:

my $speller = Comment::Spell->new();

$speller->parse_from_file(q[Foo.pm]); # streams words to spell to STDOUT by default

$speller->parse_from_filehandle( $myfh ); # again to STDOUT

$speller->set_output_file('out.txt');

$speller->parse_from_file(q[Foo.pm]); # Now writes to out.txt

my $str;

$speller->set_output_string($str);

$speller->parse_from_file(q[Foo.pm]); # Now writes to $str

METHODS

new

->new(
  stopwords         => A Pod::Wordlist instance
  output_filehandle => A IO Handle ( default is STDOUT )
)

output_filehandle

The file handle to write to.

See "set_output_filehandle", "set_output_string" and "set_output_file"

set_output_filehandle

->set_output_filehandle( $fh );
->set_output_filehandle( \*STDOUT );

set_output_string

my $str;
->set_output_string( $str ); # will write to $str

set_output_file

->set_output_file('./out.txt');

parse_from_file

->parse_from_file('./in.pm'); # Read in.pm and stream tokens to current FH

parse_from_filehandle

->parse_from_filehandle( $fh ); # Slurps FH and streams its tokens to current FH

parse_from_string

->parse_from_string( $string ); # decode $string as a PPI document and stream its comments tokens to FH

parse_from_document

Lower level interface if you want to make PPI Objects yourself.

->parse_from_document( $ppi_document );

AUTHOR

Kent Fredric kentnl@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric kentfredric@gmail.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Spell Checking for your comments

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages