App-podispell
view release on metacpan or search on metacpan
bin/podispell view on Meta::CPAN
$VERSION =~ tr/_//d;
use IPC::Open2 qw(open2);
use Pod::SpellChecker::Stripper qw(strip_code);
sub new {
my $class = shift;
my $self = bless {@_}, $class;
}
sub dictionary { $_[0]{dictionary} }
sub backup { $_[0]{backup} }
sub check_file {
my ($self, $file) = @_;
open my $in, '<', $file
or die "Can't open $file: $!";
my $source = do { local $/; <$in> };
close $in;
my $checked = $self->check_pod($source);
my $outfile = "$file.$$";
open my $out, '>', $outfile
or die "Can't open $outfile: $!";
print { $out } $checked;
close $out;
if ($self->backup) {
rename $file, "$file.bak"
or die "unable to create backup file for $file!: $!";
}
rename $outfile, $file;
}
sub check_pod {
my ($self, $pod) = @_;
my ($check, $stopwords, $languages) = strip_code($pod);
$self->spellcheck(
bin/podispell view on Meta::CPAN
return $source;
}
}
{
use Getopt::Long qw(:config gnu_getopt no_auto_abbrev no_ignore_case);
GetOptions(
'd|dictionary=s@' => \(my $dictionary),
'b|backup' => \(my $backup),
'h|help' => sub {
require Pod::Usage;
Pod::Usage::pod2usage(-exitval => 0, -verbose => 1);
},
'V|version' => sub {
print "podispell version $Pod::SpellChecker::VERSION\n";
exit 0;
},
) or exit 1;
my $speller = Pod::SpellChecker->new(
($dictionary ? ( dictionary => $dictionary ) : ()),
($backup ? ( backup => $backup ) : ()),
);
if (!@ARGV) {
die "no files specified!\n";
}
for my $file (@ARGV) {
$speller->check_file($file);
}
}
bin/podispell view on Meta::CPAN
=head1 OPTIONS
=over 4
=item C<-d> C<--dictionary>
Sets the dictionary to use. Defaults to 'C<en_US>'. Can be specified multiple
times.
=item C<-b> C<--backup>
Keep backup files. A copy of the file will be saved with a C<.bak> extension
before being modified.
=item C<-h> C<--help>
Display this help text.
=item C<-V> C<--version>
Display the version number.
( run in 1.670 second using v1.01-cache-2.11-cpan-49f99fa48dc )