r61423@onn: sartak | 2008-06-02 16:00:33 -0400
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / Globals.pm
index 798ba51..0671f08 100644 (file)
@@ -9,9 +9,10 @@ around complete => sub {
   my $last = $self->last_ppi_element($document);
 
   return $orig->(@_)
-    unless $last->isa('PPI::Token::Symbol');
+    unless $last->isa('PPI::Token::Symbol')
+        || $last->isa('PPI::Token::Word');
 
-  my $sigil = substr($last, 0, 1, '');
+  my $sigil = $last =~ s/^[\$\@\%\&\*]// ? $1 : undef;
   my $re = qr/^\Q$last/;
 
   my @package_fragments = split qr/::|'/, $last;
@@ -49,3 +50,15 @@ around complete => sub {
 
 1;
 
+__END__
+
+=head1 NAME
+
+Devel::REPL::Plugin::CompletionDriver::Globals - Complete global variables, packages, namespaced functions
+
+=head1 AUTHOR
+
+Shawn M Moore, C<< <sartak at gmail dot com> >>
+
+=cut
+