| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
2230
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
63
|
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
125
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Complete class or object method names |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.003029'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Devel::REPL::Plugin; |
|
8
|
2
|
|
|
2
|
|
11
|
use Devel::REPL::Plugin::Completion; # die early if cannot load |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
13
|
|
|
9
|
2
|
|
|
2
|
|
8767
|
use namespace::autoclean; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
54
|
|
|
10
|
2
|
|
|
2
|
|
11
|
|
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
|
|
my $self = shift; |
|
12
|
|
|
|
|
|
|
for (qw/Completion FindVariable/) { |
|
13
|
1
|
|
|
1
|
0
|
5
|
$self->load_plugin($_); |
|
14
|
1
|
|
|
|
|
3
|
} |
|
15
|
2
|
|
|
|
|
64
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
around complete => sub { |
|
18
|
|
|
|
|
|
|
my $orig = shift; |
|
19
|
|
|
|
|
|
|
my ($self, $text, $document) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $last = $self->last_ppi_element($document); |
|
22
|
|
|
|
|
|
|
my $incomplete = ''; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# handle an incomplete method name, and back up to the -> |
|
25
|
|
|
|
|
|
|
if ($last->isa('PPI::Token::Word')) { |
|
26
|
|
|
|
|
|
|
my $previous = $last->sprevious_sibling |
|
27
|
|
|
|
|
|
|
or return $orig->(@_); |
|
28
|
|
|
|
|
|
|
$previous->isa('PPI::Token::Operator') && $previous->content eq '->' |
|
29
|
|
|
|
|
|
|
or return $orig->(@_); |
|
30
|
|
|
|
|
|
|
$incomplete = $last->content; |
|
31
|
|
|
|
|
|
|
$last = $previous; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# require a -> here |
|
35
|
|
|
|
|
|
|
return $orig->(@_) |
|
36
|
|
|
|
|
|
|
unless $last->isa('PPI::Token::Operator') |
|
37
|
|
|
|
|
|
|
&& $last->content eq '->'; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# ..which is preceded by a word (class name) |
|
40
|
|
|
|
|
|
|
my $previous = $last->sprevious_sibling |
|
41
|
|
|
|
|
|
|
or return $orig->(@_); |
|
42
|
|
|
|
|
|
|
$previous->isa('PPI::Token::Word') || $previous->isa('PPI::Token::Symbol') |
|
43
|
|
|
|
|
|
|
or return $orig->(@_); |
|
44
|
|
|
|
|
|
|
my $class; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# we have a variable, need to look up its class |
|
47
|
|
|
|
|
|
|
if ($previous->isa('PPI::Token::Symbol')) { |
|
48
|
|
|
|
|
|
|
my $object_ref = $self->find_variable($previous->content) |
|
49
|
|
|
|
|
|
|
or return $orig->(@_); |
|
50
|
|
|
|
|
|
|
$class = blessed($$object_ref) |
|
51
|
|
|
|
|
|
|
or return $orig->(@_); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
else { |
|
54
|
|
|
|
|
|
|
$class = $previous->content; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# now we have $class->$incomplete |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $metaclass = Class::MOP::Class->initialize($class); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $re = qr/^\Q$incomplete/; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $orig->(@_), |
|
64
|
|
|
|
|
|
|
grep { $_ =~ $re } |
|
65
|
|
|
|
|
|
|
map { $_->name } |
|
66
|
|
|
|
|
|
|
$metaclass->get_all_methods; |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Devel::REPL::Plugin::CompletionDriver::Methods - Complete class or object method names |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 1.003029 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SUPPORT |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> |
|
87
|
|
|
|
|
|
|
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>). |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
|
90
|
|
|
|
|
|
|
L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |