This file is indexed.

/usr/share/perl5/Padre/Plugin/Snippet.pm is in libpadre-plugin-snippet-perl 0.01-2.

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
package Padre::Plugin::Snippet;

use 5.008;
use strict;
use warnings;
use Padre::Plugin ();

our $VERSION = '0.01';
our @ISA     = 'Padre::Plugin';

# Child modules we need to unload when disabled
use constant CHILDREN => qw{
	Padre::Plugin::Snippet::Role::NeedsSaveAsEvent
	Padre::Plugin::Snippet::Document
	Padre::Plugin::Snippet::Preferences
	Padre::Plugin::Snippet::FBP::Preferences
};

# Store the current configuration object for _plugin_config consumers
my $config;

# Called when Padre wants to check what package versions this
# plugin needs
sub padre_interfaces {
	'Padre::Plugin' => 0.94, 'Padre::Wx::Editor' => 0.94, 'Padre::Wx::Role::Main' => 0.94;
}

# Called when Padre wants a name for the plugin
sub plugin_name {
	Wx::gettext('Snippet');
}

# Called when the plugin is enabled by Padre
sub plugin_enable {
	my $self = shift;

	# Read the plugin configuration, and
	my $config = $self->config_read;
	unless ( defined $config ) {

		# No configuration, let us create it
		$config = {};
	}

	# Make sure defaults are respected if they are undefined.
	unless ( defined $config->{type} ) {
		$config->{type} = 'Moose';
	}
	unless ( defined $config->{feature_snippets} ) {
		$config->{feature_snippets} = 'Moose';
	}

	# Write the plugin's configuration
	$self->config_write($config);

	# Update configuration attribute
	$self->{config} = $config;

	# Generate missing Padre's events
	# TODO remove once Padre 0.96 is released
	require Padre::Plugin::Snippet::Role::NeedsPluginEvent;
	Padre::Plugin::Snippet::Role::NeedsPluginEvent->meta->apply( $self->main );

	# Highlight the current editor. This is needed when a plugin is enabled
	# for the first time
	$self->editor_changed;

	return 1;
}

# Called when the plugin is disabled by Padre
sub plugin_disable {
	my $self = shift;

	# TODO: Switch to Padre::Unload once Padre 0.96 is released
	for my $package (CHILDREN) {
		require Padre::Unload;
		Padre::Unload->unload($package);
	}
}

# # Called when Padre wants to display plugin menu items
# sub menu_plugins {
# my $self      = shift;
# my $main      = $self->main;
# my $menu_item = Wx::MenuItem->new( undef, -1, Wx::gettext('Snippet') . "...\tF9", );

# Wx::Event::EVT_MENU(
# $main,
# $menu_item,
# sub {
# },
# );

# return $menu_item;
# }

sub editor_changed {
	my $self     = shift;
	my $document = $self->current->document or return;
	my $editor   = $self->current->editor or return;

	# Always cleanup current document
	if ( defined $self->{document} ) {
		$self->{document}->cleanup;
		$self->{document} = undef;
	}

	# Only on Perl documents
	return unless $document->isa('Padre::Document::Perl');

	# Create a new snippet document
	require Padre::Plugin::Snippet::Document;
	$self->{document} = Padre::Plugin::Snippet::Document->new(
		editor   => $editor,
		document => $document,
		config   => $self->{config},
	);

	return;
}

1;

__END__

=pod

=head1 NAME

Padre::Plugin::Snippet - TextMate-like snippets for Padre

=head1 SYNOPSIS

    cpan Padre::Plugin::Snippet

Then use it via L<Padre>, The Perl IDE.

=head1 DESCRIPTION

Once you enable this Plugin under Padre, you'll get TextMate-style TAB triggered
snippets for the following:

=over

=item Perl

=item Moose

=item Mouse

=item MooseX::Declare

=back

=head1 Example

For those who don't who this Text mate bloke is, just try to type in Padre
something like:

 for<tab>
 if<tab>
 ife<tab>
 cfor<tab>

While editing the generated construct, you can type again <TAB>. Your
cursor will be moved to the next point needing some attention in the
generated construct.

You can check the available keyword in the yaml files (perl.yml...)
shipped with this module.

=head1 BUGS

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

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Padre::Plugin::Snippet

You can also look for information at:

=over 4

=item * RT: CPAN's request tracker

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

=item * AnnoCPAN: Annotated CPAN documentation

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

=item * CPAN Ratings

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

=item * Search CPAN

L<http://search.cpan.org/dist/Padre-Plugin-Snippet/>

=back

=head1 SEE ALSO

L<Padre>

=head1 AUTHORS

Ahmad M. Zawawi <ahmad.zawawi@gmail.com>

=head1 CONTRIBUTORS

Adam Kennedy <adamk@cpan.org>

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


=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Ahmad M. Zawawi

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

=cut