gugod/App-perlbrew — Issue #179: 'perlbrew lib' behavior should be more consistent
Author: jwittkoski
Created: 2011-12-23 22:28:13+00:00
State: open

From `perlbrew help lib`:

A lib name can be a short name, containing alphanumeric, like 'awesome',
or a full name, prefixed by a perl installation name and a '@' sign, for
example, 'perl-5.14.2@awesome'.

The behavior when the perl installation name is empty or references a non-existent perl installation name is not defined.

However, it can be created:

$ perlbrew list
* perl-5.15.5
$ perlbrew lib create @foo
lib '@foo' is created.

But it doesn't appear in the list:

$ perlbrew list
* perl-5.15.5

It does appear here however:

$ perlbrew lib list
@foo

And 'use'-ing it doesn't fail but doesn't seem to change anything:

$ perl -V > orig
$ perlbrew use @foo
$ perl -V > new
$ diff orig new
$

It's there in the lib list so it can be deleted:

$ perlbrew lib delete @foo
lib '@foo' is deleted.
$ perlbrew lib delete @foo
'@foo' is not in the list of lib

Using a non-existent perl installation name gives similar results:

$ perlbrew lib create foo@bar
lib 'foo@bar' is created.
$ perlbrew list
* perl-5.15.5

Although unlike `use @foo` it does complain when trying to use this non-existent perl version:

$ perlbrew use foo@bar
Use of uninitialized value $perl_name in concatenation (.) or string at /loader/0x10083d6e8/App/perlbrew.pm line 1080.

The behaviors of `lib create/delete` seem inconsistent with the behavior of `use/switch` as changed in issue #153.

I suggest the use of 'perl-installation-name@lib-name' should be consistent for both `perlbrew use` and `perlbrew lib`:

* If perl-installation-name is blank (i.e. `@foo`), use the $PERLBREW_PERL value as in issue #153
* If perl-installation-name is blank and $PERLBREW_PERL is also blank it should be an error
* If perl-installation-name is not blank and references a version of perl that does not exist it should be an error