increment $VERSION after 1.003028 release
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / Globals.pm
index 798ba51..13e3d11 100644 (file)
@@ -1,6 +1,18 @@
+use strict;
+use warnings;
 package Devel::REPL::Plugin::CompletionDriver::Globals;
+# ABSTRACT: Complete global variables, packages, namespaced functions
+
+our $VERSION = '1.003029';
+
 use Devel::REPL::Plugin;
-use namespace::clean -except => [ 'meta' ];
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
+use namespace::autoclean;
+
+sub BEFORE_PLUGIN {
+    my $self = shift;
+    $self->load_plugin('Completion');
+}
 
 around complete => sub {
   my $orig = shift;
@@ -9,9 +21,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 +62,12 @@ around complete => sub {
 
 1;
 
+__END__
+
+=pod
+
+=head1 AUTHOR
+
+Shawn M Moore, C<< <sartak at gmail dot com> >>
+
+=cut