This file is indexed.

/usr/share/perl5/Padre/Plugin/SpellCheck.pm is in libpadre-plugin-spellcheck-perl 1.32-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
package Padre::Plugin::SpellCheck;

use 5.010001;
use strict;
use warnings;

use Padre::Plugin ();
use Padre::Unload ();
use File::Which   ();
use Try::Tiny;

our $VERSION = '1.32';
use parent qw( Padre::Plugin );

# Child modules we need to unload when disabled
use constant CHILDREN => qw{
	Padre::Plugin::SpellCheck
	Padre::Plugin::SpellCheck::Checker
	Padre::Plugin::SpellCheck::FBP::Checker
	Padre::Plugin::SpellCheck::Engine
	Padre::Plugin::SpellCheck::Preferences
	Padre::Plugin::SpellCheck::FBP::Preferences
	Text::Aspell
	Text::Hunspell
};

#######
# Define Plugin Name Spell Checker
#######
sub plugin_name {
	return Wx::gettext('Spell Checker');
}

#######
# Define Padre Interfaces required
#######
sub padre_interfaces {
	return (
		'Padre::Plugin' => '0.96',
		'Padre::Unload' => '0.96',

		# used by my sub packages
		'Padre::Locale'         => '0.96',
		'Padre::Logger'         => '0.96',
		'Padre::Wx'             => '0.96',
		'Padre::Wx::Role::Main' => '0.96',
		'Padre::Util'           => '0.97',
	);
}

#######
# plugin menu
#######
sub menu_plugins {
	my $self = shift;
	my $main = $self->main;

	# Create a manual menu item
	my $menu_item = Wx::MenuItem->new( undef, -1, $self->plugin_name . "...\tF7", );
	Wx::Event::EVT_MENU(
		$main,
		$menu_item,
		sub {
			$self->spell_check;
		},
	);

	return $menu_item;
}

#########
# We need plugin_enable
# as we have an external dependency
#########
sub plugin_enable {
	my $self                        = shift;
	my $local_dictionary_bin_exists = 0;

	# Tests for externals used by Preference's
	try {
		if ( require Text::Aspell ) {
			$local_dictionary_bin_exists = 1;
		}
	};
	try {
		if ( File::Which::which('hunspell') ) {
			$local_dictionary_bin_exists = 1;
		}
	};

	#Set/ReSet Config data
	if ($local_dictionary_bin_exists) {
		$self->_config;
	}

	return $local_dictionary_bin_exists;
}

#######
# Composed Method _config
# called on enable in plugin manager, bit like run/setup for a Plugin
#######
sub _config {
	my $self   = shift;
	my $config = $self->config_read;

	###
	#	Info P-P-SpellCheck 	< 1.21
	#	$config->{dictionary}   = iso
	#
	#	Info P-P-SpellCheck     = 1.22
	#	- $config->{dictionary} = iso
	#	+ $config->{Aspell}     = en_GB
	#	+ $config->{Hunspell}   = en_AU
	#	+ $config->{Version}    = $VERSION
	#
	#	Info P-P-SpellCheck    >= 1.23
	#	+ $config->{Engine}     = 'Aspell'
	###

	try {
		if ( $config->{Version} >= 1.23 ) {
			return;
		}
	};

	try {
		if ( $config->{Version} < 1.23 ) {

			$config->{Version} = $VERSION;
			$config->{Engine}  = 'Aspell';
			$self->config_write($config);
			return;
		}
	};

	try {
		if ( $config->{dictionary} ) {
			my $tmp_iso = $config->{dictionary};
			$self->config_write( {} );
			$config             = $self->config_read;
			$config->{Aspell}   = $tmp_iso;
			$config->{Hunspell} = $tmp_iso;
			$config->{Version}  = $VERSION;
			$config->{Engine}   = 'Aspell';
			$self->config_write($config);
			return;
		}
	}
	catch {
		$self->config_write( {} );
		$config->{Aspell}   = 'en_GB';
		$config->{Hunspell} = 'en_GB';
		$config->{Version}  = $VERSION;
		$config->{Engine}   = 'Aspell';
		$self->config_write($config);
		return;
	};

	return;
}

########
# plugin_disable
########
sub plugin_disable {
	my $self = shift;

	# Close the dialog if it is hanging around
	$self->clean_dialog;

	# Unload all our child classes
	for my $package (CHILDREN) {
		require Padre::Unload;
		Padre::Unload->unload($package);
	}

	$self->SUPER::plugin_disable(@_);

	return 1;
}

########
# Composed Method clean_dialog
########
sub clean_dialog {
	my $self = shift;

	# Close the main dialog if it is hanging around
	if ( $self->{dialog} ) {
		$self->{dialog}->Hide;
		$self->{dialog}->Destroy;
		delete $self->{dialog};
	}

	return 1;
}


#######
# plugin_preferences
#######
sub plugin_preferences {
	my $self = shift;
	my $main = $self->main;

	# Clean up any previous existing dialog
	$self->clean_dialog;

	try {
		require Padre::Plugin::SpellCheck::Preferences;
		$self->{dialog} = Padre::Plugin::SpellCheck::Preferences->new($main);
		$self->{dialog}->ShowModal;
	}
	catch {
		$self->main->error( sprintf Wx::gettext('Error: %s'), $_ );
	};

	return;
}

#######
# spell_check
#######
sub spell_check {
	my $self = shift;
	my $main = $self->main;

	# Clean up any previous existing dialog
	$self->clean_dialog;

	try {
		require Padre::Plugin::SpellCheck::Checker;
		$self->{dialog} = Padre::Plugin::SpellCheck::Checker->new($main);
		$self->{dialog}->Show;
	}
	catch {
		$self->main->error( sprintf Wx::gettext('Error: %s'), $_ );
	};

	return;
}

#######
# Add icon to Plugin
#######
sub plugin_icon {
	my $class = shift;
	my $share = $class->plugin_directory_share or return;
	my $file  = File::Spec->catfile( $share, 'icons', '16x16', 'spellcheck.png' );
	return unless -f $file;
	return unless -r $file;
	return Wx::Bitmap->new( $file, Wx::wxBITMAP_TYPE_PNG );
}

#######
# Add SpellCheck Preferences to Context Menu
#######
sub event_on_context_menu {
	my ( $self, $document, $editor, $menu, $event ) = @_;

	#Test for valid file type
	return if not $document->filename;

	$menu->AppendSeparator;

	my $item = $menu->Append( -1, Wx::gettext('SpellCheck Preferences...') );
	Wx::Event::EVT_MENU(
		$self->main,
		$item,
		sub { $self->plugin_preferences },
	);

	return;
}


1;

__END__

# DO NOT REMOVE


sub menu_plugins_simple {
	my $self = shift;
	return Wx::gettext('Spell Check') => [
		Wx::gettext("Check spelling...\tF7") => sub { $self->spell_check },
		Wx::gettext('Preferences')           => sub { $self->plugin_preferences },
	];
}

=pod

=encoding utf8

=head1 NAME

Padre::Plugin::SpellCheck - Check spelling in Padre, The Perl IDE.

=head1 VERSION

version: 1.32

=head1 DESCRIPTION

For Padre 0.98

This plug-in allows one to check there spelling within Padre using
C<F7> (standard spelling short-cut across text processors).

One can change the dictionary language used (based upon install languages) in
 the preferences window via Plug-in Manager.
Note that preferences can B<only> be setup while the plugin is B<disabled>.
Preferences are persistent. You need to Save your preferred language.

This plug-in is using C<Text::Aspell> default (legacy). You can also use C<Text::Hunspell>, so check these module's
pod for more information and install the one for you.

Of course, you need to have the relevant Dictionary binary, dev and dictionary installed.


=head1 SYNOPSIS

    Check your file or selected text for spelling errors in your preferred language.
    F7

=head1 PUBLIC METHODS

=head2 Standard Padre::Plugin API

C<Padre::Plugin::SpellCheck> defines a plug-in which follows
C<Padre::Plugin> API. Refer to this module's documentation for more
information.

The following methods are implemented:

=over 7

=item clean_dialog()

=item menu_plugins()

=item padre_interfaces()

=item plugin_disable()

=item plugin_enable()

Return the plug-in's configuration, or a suitable default one if none exist previously.

=item plugin_name()

=item plugin_preferences()

Spelling preferences window normally access via Plug-in Manager

=item plugin_icon()

Used by Plug-in Manager

=item event_on_context_menu

Add access to spelling preferences window.

=back


=head2 Spell checking methods

=over 1

=item * spell_check()

Spell checks the current selection (or the whole document).


=back

=head1 BUGS and LIMITATIONS

If you upgrade your OS, and run Perl from a local/lib,
 you may find Hunspell stops showing local dictionary in preferences,
 you will need to un-install Text::Hunspell and re-install in CPAN.


Spell-checking non-ascii files has bugs: the selection does not
match the word boundaries, and as the spell checks moves further in
the document, offsets are totally irrelevant. This is a bug in
C<Wx::StyledTextCtrl> that has some Unicode problems... So
unfortunately, there's nothing that I can do in this plug-in to
tackle this bug.

Please report any bugs or feature requests to C<padre-plugin-spellcheck
at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Padre-Plugin-
SpellCheck>. I will be notified, and then you'll automatically be
notified of progress on your bug as I make changes.




=head1 SEE ALSO

Plug-in icon courtesy of Mark James, at
L<http://www.famfamfam.com/lab/icons/silk/>.

=over 2

=item * Padre-Plugin-SpellCheck web page

L<http://padre.perlide.org/trac/wiki/PadrePluginSpellCheck>

=item * Our svn repository

L<http://svn.perlide.org/padre/trunk/Padre-Plugin-SpellCheck>,
 and can be browsed at
 L<http://padre.perlide.org/browser/trunk/Padre-Plugin-SpellCheck>.

=back

You can also look for information on this module at:

=over 4

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Padre-Plugin-SpellCheck>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Padre-Plugin-SpellCheck>

=item * Open bugs

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Padre-Plugin-SpellCheck>

=back

Everything Aspell related: L<http://aspell.net>.

Everything Hunspell related: L<http://hunspell.sourceforge.net/>.

=head1 AUTHORS

Kevin Dawson E<lt>bowtie@cpan.orgE<gt>

Ahmad M. Zawawi E<lt>ahmad.zawawi@gmail.comE<gt>

Fayland Lam E<lt>fayland at gmail.comE<gt>

Jerome Quelin E<lt>jquelin@gmail.comE<gt>


=head1 COPYRIGHT

This software is Copyright E<copy> 2010 by Fayland Lam, Jerome Quelin.
Also Copyright E<copy> 2012-2013 AUTHORS and "CONTRIBUTORS" as listed above.

=head1 LICENSE

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

=cut

# Copyright 2008-2013 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.