line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
33874
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
127
|
|
2
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
156
|
|
3
|
|
|
|
|
|
|
package Devel::REPL::Plugin::CompletionDriver::LexEnv; |
4
|
|
|
|
|
|
|
# ABSTRACT: Complete variable names in the REPL's lexical environment |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003027'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
15
|
use Devel::REPL::Plugin; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
23
|
|
9
|
2
|
|
|
2
|
|
10097
|
use Devel::REPL::Plugin::Completion; # die early if cannot load |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
10
|
2
|
|
|
2
|
|
11
|
use namespace::autoclean; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
26
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BEFORE_PLUGIN { |
13
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
14
|
1
|
|
|
|
|
6
|
$self->load_plugin('Completion'); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
around complete => sub { |
18
|
|
|
|
|
|
|
my $orig = shift; |
19
|
|
|
|
|
|
|
my ($self, $text, $document) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $last = $self->last_ppi_element($document); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $orig->(@_) |
24
|
|
|
|
|
|
|
unless $last->isa('PPI::Token::Symbol'); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my ($sigil, $name) = split(//, $last, 2); |
27
|
|
|
|
|
|
|
my $re = qr/^\Q$name/; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $orig->(@_), |
30
|
|
|
|
|
|
|
# ReadLine is weirdly inconsistent |
31
|
|
|
|
|
|
|
map { $sigil eq '%' ? '%' . $_ : $_ } |
32
|
|
|
|
|
|
|
grep { /$re/ } |
33
|
|
|
|
|
|
|
map { substr($_, 1) } # drop lexical's sigil |
34
|
|
|
|
|
|
|
'$_REPL', keys %{$self->lexical_environment->get_context('_')}; |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Devel::REPL::Plugin::CompletionDriver::LexEnv - Complete variable names in the REPL's lexical environment |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 1.003027 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
62
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |