Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list-modules doesn't work with alias #336

Closed
gmorten1 opened this issue May 31, 2013 · 6 comments
Closed

list-modules doesn't work with alias #336

gmorten1 opened this issue May 31, 2013 · 6 comments
Labels

Comments

@gmorten1
Copy link

> perlbrew --version
/opt/perl5/bin/perlbrew  - App::perlbrew/0.63
> perlbrew list
* perl-5.14.2
  perl-5.16.3
> perlbrew list-modules
[ returns long list ]
> perlbrew alias create perl-5.14.2 alias1
> perlbrew use alias1
> perlbrew list
* alias1 (5.14.2)
  perl-5.14.2
  perl-5.16.3
> perlbrew list-modules
> 
[returns nothing]
@gugod
Copy link
Owner

gugod commented Jun 2, 2013

Confirmed. The current implementation of the command depends on "exec" and that exclude aliases. Apparently it can resolve the alias before invoking the exec command.

@ViktorNacht
Copy link

Is this considered a bug, and will it be fixed?

Not trying to rush you, just curious. :) Thank you for perlbrew.

@gugod
Copy link
Owner

gugod commented Aug 6, 2013

@ViktorNacht yes.

Feel free to send a pull request, I'll be glad merge it.

@y
Copy link

y commented May 9, 2016

This appears to work:

diff --git a/lib/App/perlbrew.pm b/lib/App/perlbrew.pm
index 128ae0f..0aafdc5 100644
--- a/lib/App/perlbrew.pm
+++ b/lib/App/perlbrew.pm
@@ -2285,9 +2285,16 @@ sub run_command_upgrade_perl {
sub run_command_list_modules {
    my ($self) = @_;
    my $class = ref($self) || __PACKAGE__;
+
+    my $name = $self->current_env;
+    if (-l (my $path = joinpath($self->root, 'perls', $name))) {
+        require File::Basename;
+        $name = File::Basename::basename(readlink $path);
+    }
+
    my $app = $class->new(
        qw(--quiet exec --with),
-        $self->current_env,
+        $name,
        'perl', '-MExtUtils::Installed', '-le',
        'BEGIN{@INC=grep {$_ ne q!.!} @INC}; print for ExtUtils::Installed->new->modules;'
    );

@y
Copy link

y commented May 9, 2016

But maybe --exec should be a bit smarter and ignore aliases only when no explicit perls have been specified with --with. Right now you can't run --exec --with alias. I think that should be allowed.

@grr
Copy link

grr commented Jun 5, 2017

@gugod i just tested @y's patch and it works great. can you merge it, or resolve this another way?

@gugod gugod closed this as completed in a7d7167 Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants