line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
6829
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
2
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
103
|
|
3
|
|
|
|
|
|
|
package Devel::REPL::Plugin::CompletionDriver::LexEnv; |
4
|
|
|
|
|
|
|
# ABSTRACT: Complete variable names in the REPL's lexical environment |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003028'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
8
|
use Devel::REPL::Plugin; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
13
|
|
9
|
2
|
|
|
2
|
|
6124
|
use Devel::REPL::Plugin::Completion; # die early if cannot load |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
36
|
|
10
|
2
|
|
|
2
|
|
8
|
use namespace::autoclean; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BEFORE_PLUGIN { |
13
|
1
|
|
|
1
|
0
|
2
|
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.003028 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SUPPORT |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> |
56
|
|
|
|
|
|
|
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>). |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
59
|
|
|
|
|
|
|
L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
70
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |