line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Padre::PlayCode; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23758
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use base 'Padre::Plugin'; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1069
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Padre::Util ('_T'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub padre_interfaces { |
13
|
|
|
|
|
|
|
'Padre::Plugin' => '0.43', |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub menu_plugins_simple { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
return ('Acme::PlayCode' => [ |
19
|
|
|
|
|
|
|
_T('Averything'), sub { $self->play('Averything') }, |
20
|
|
|
|
|
|
|
_T('DoubleToSingle'), sub { $self->play('DoubleToSingle') }, |
21
|
|
|
|
|
|
|
_T('ExchangeCondition'), sub { $self->play('ExchangeCondition') }, |
22
|
|
|
|
|
|
|
_T('NumberPlus'), sub { $self->play('NumberPlus') }, |
23
|
|
|
|
|
|
|
_T('PrintComma'), sub { $self->play('PrintComma') }, |
24
|
|
|
|
|
|
|
]); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub play { |
28
|
|
|
|
|
|
|
my ( $self, $plugin ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $main = $self->main; |
31
|
|
|
|
|
|
|
my $doc = $main->current->document; |
32
|
|
|
|
|
|
|
return unless $doc; |
33
|
|
|
|
|
|
|
my $src = $main->current->text; |
34
|
|
|
|
|
|
|
my $code = $src ? $src : $doc->text_get; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return unless ( defined $code and length($code) ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
require Acme::PlayCode; |
39
|
|
|
|
|
|
|
my $playapp = new Acme::PlayCode; |
40
|
|
|
|
|
|
|
$playapp->load_plugin( $plugin ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $played = $playapp->play($code); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
if ( $src ) { |
45
|
|
|
|
|
|
|
my $editor = $main->current->editor; |
46
|
|
|
|
|
|
|
$editor->ReplaceSelection( $played ); |
47
|
|
|
|
|
|
|
} else { |
48
|
|
|
|
|
|
|
$doc->text_set( $played ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Acme::Padre::PlayCode - L<Acme::PlayCode> Plugin for L<Padre> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$>padre |
62
|
|
|
|
|
|
|
Plugins -> Acme::PlayCode -> * |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is a simple plugin to run L<Acme::PlayCode> on your source code. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
If there is any selection, just run with the text you selected. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
If not, run with the whole text from selected document. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Fayland Lam, C<< <fayland at gmail.com> >> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Ahmad M. Zawawi C<< <ahmad.zawawi at gmail.com> >> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Copyright 2008-2009 Fayland Lam and Ahmad M. Zawawi all rights reserved. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
83
|
|
|
|
|
|
|
under the same terms as Perl itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |