Hello community,

here is the log from the commit of package perl-App-perlbrew for 
openSUSE:Factory checked in at 2012-02-08 15:40:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-App-perlbrew (Old)
 and      /work/SRC/openSUSE:Factory/.perl-App-perlbrew.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-App-perlbrew", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-App-perlbrew/perl-App-perlbrew.changes      
2012-01-09 11:16:15.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-App-perlbrew.new/perl-App-perlbrew.changes 
2012-02-08 15:40:54.000000000 +0100
@@ -1,0 +2,15 @@
+Mon Jan 02 07:18:12 UTC 2012 - [email protected]
+
+- update to 0.39:
+  * Fix GH #179. lib naming are more consistent
+  * Fix GH #171. bash users are suggestted to upgrad to this version
+  * Fix GH #152
+
+- changes from 0.38:
+  * fix deps
+
+- changes from 0.37:
+  * fix ENV mess after switching to diffirent libs multiple times
+  * add --sitecustomize option
+
+-------------------------------------------------------------------

Old:
----
  App-perlbrew-0.35.tar.gz

New:
----
  App-perlbrew-0.39.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-App-perlbrew.spec ++++++
--- /var/tmp/diff_new_pack.QASFUg/_old  2012-02-08 15:40:55.000000000 +0100
+++ /var/tmp/diff_new_pack.QASFUg/_new  2012-02-08 15:40:55.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-App-perlbrew
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -21,7 +21,7 @@
 %endif
 
 Name:           perl-App-perlbrew
-Version:        0.35
+Version:        0.39
 Release:        1
 License:        MIT
 %define cpan_name App-perlbrew
@@ -33,13 +33,15 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  perl
 BuildRequires:  perl-macros
-BuildRequires:  perl(Devel::PatchPerl) >= 0.26
+BuildRequires:  perl(Devel::PatchPerl) >= 0.46
 BuildRequires:  perl(Path::Class)
 BuildRequires:  perl(IO::All)
 BuildRequires:  perl(Try::Tiny)
 BuildRequires:  perl(File::Path::Tiny)
 BuildRequires:  perl(local::lib) >= 1.008
+BuildRequires:  perl(Capture::Tiny) >= 0.13
 %if 0%{?with_test}
+BuildRequires:  perl(Test::Simple) >= 0.98
 BuildRequires:  perl(Test::Spec)
 BuildRequires:  perl(Test::Output)
 BuildRequires:  perl(Test::Exception)
@@ -50,6 +52,7 @@
 Requires:       perl(Try::Tiny)
 Requires:       perl(File::Path::Tiny)
 Requires:       perl(local::lib) >= 1.008
+Requires:       perl(Capture::Tiny)
 %{perl_requires}
 
 %description

++++++ App-perlbrew-0.35.tar.gz -> App-perlbrew-0.39.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/Changes 
new/App-perlbrew-0.39/Changes
--- old/App-perlbrew-0.35/Changes       2011-12-17 06:03:00.000000000 +0100
+++ new/App-perlbrew-0.39/Changes       2011-12-31 17:00:05.000000000 +0100
@@ -1,3 +1,18 @@
+0.39:
+- Fix GH #179. lib naming are more consistent.
+- Fix GH #171. bash users are suggestted to upgrad to this version.
+- Fix GH #152.
+
+0.38:
+- fix deps
+
+0.37:
+- fix ENV mess after switching to diffirent libs multiple times
+- add --sitecustomize option
+
+0.36:
+- fix test errors on freebsd that makes it uninstallable
+
 0.35:
 - fixes for cpantester failures
 - requiers local::lib version 1.008
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/MANIFEST 
new/App-perlbrew-0.39/MANIFEST
--- old/App-perlbrew-0.35/MANIFEST      2011-12-16 00:22:45.000000000 +0100
+++ new/App-perlbrew-0.39/MANIFEST      2011-12-31 16:54:45.000000000 +0100
@@ -37,6 +37,7 @@
 t/10.resolve.t
 t/11.editdist.t
 t/11.root_from_arg.t
+t/12.sitecustomize.t
 t/command-available.t
 t/command-compgen.t
 t/command-display-rc.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/META.yml 
new/App-perlbrew-0.39/META.yml
--- old/App-perlbrew-0.35/META.yml      2011-12-17 06:04:56.000000000 +0100
+++ new/App-perlbrew-0.39/META.yml      2011-12-31 17:01:13.000000000 +0100
@@ -27,6 +27,7 @@
     - inc
     - t
 requires:
+  Capture::Tiny: 0.13
   Devel::PatchPerl: 0.46
   File::Path::Tiny: 0.1
   local::lib: 1.008
@@ -34,4 +35,4 @@
 resources:
   license: http://opensource.org/licenses/mit-license.php
   repository: git://github.com/gugod/App-perlbrew.git
-version: 0.35
+version: 0.39
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/Makefile.PL 
new/App-perlbrew-0.39/Makefile.PL
--- old/App-perlbrew-0.35/Makefile.PL   2011-12-17 06:02:25.000000000 +0100
+++ new/App-perlbrew-0.39/Makefile.PL   2011-12-29 03:10:13.000000000 +0100
@@ -9,7 +9,8 @@
 requires
     'File::Path::Tiny'  => '0.1',
     'Devel::PatchPerl'  => '0.46',
-    'local::lib'        => '1.008';
+    'local::lib'        => '1.008',
+    'Capture::Tiny'     => '0.13';
 
 test_requires
     'Test::Simple'    => '0.98',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/bin/perlbrew 
new/App-perlbrew-0.39/bin/perlbrew
--- old/App-perlbrew-0.35/bin/perlbrew  2011-12-16 00:23:32.000000000 +0100
+++ new/App-perlbrew-0.39/bin/perlbrew  2011-12-28 09:42:41.000000000 +0100
@@ -43,7 +43,7 @@
 
 Options for C<install> command:
 
-    -f --force     Fore installation
+    -f --force     Force installation
     -j $n          Parallel buildng and testing. ex. C<perlbrew install -j 5 
perl-5.14.2>
     -n --notest    Skip testing
 
@@ -53,6 +53,9 @@
     -D,-U,-A       Switches passed to perl Configure script.
                    ex. C<perlbrew install perl-5.10.1 -D usemymalloc -U 
uselargefiles>
 
+    --sitecustomize $filename
+                   Specify a file to be installed as sitecustomize.pl
+
 Generic command options:
 
     -q --quiet     Be quiet on informative output message.
@@ -140,7 +143,7 @@
 on the working convention of your team.
 
 If you wish to install CPAN modules only for yourself, you should use the 
C<lib>
-command to construct a perlsonal local::lib enviroment. local::lib enviroments
+command to construct a personal local::lib environment. local::lib environments
 are personal, and are not shared between different users. For more detail, read
 C<perlbrew help lib> and the documentation of L<local::lib>.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/lib/App/perlbrew.pm 
new/App-perlbrew-0.39/lib/App/perlbrew.pm
--- old/App-perlbrew-0.35/lib/App/perlbrew.pm   2011-12-17 06:03:00.000000000 
+0100
+++ new/App-perlbrew-0.39/lib/App/perlbrew.pm   2011-12-31 17:00:05.000000000 
+0100
@@ -2,12 +2,13 @@
 use strict;
 use warnings;
 use 5.008;
+use Capture::Tiny;
 use Getopt::Long ();
 use File::Spec::Functions qw( catfile catdir );
 use File::Path::Tiny;
 use FindBin;
 
-our $VERSION = "0.35";
+our $VERSION = "0.39";
 our $CONFIG;
 
 our $PERLBREW_ROOT = $ENV{PERLBREW_ROOT} || catdir($ENV{HOME}, "perl5", 
"perlbrew");
@@ -80,7 +81,7 @@
     local short_option
     export SHELL
 
-    if [[ `echo $1 | awk 'BEGIN{FS=""}{print $1}'` = '-' ]]; then
+    if [[ $1 == -* ]]; then
         short_option=$1
         shift
     else
@@ -100,7 +101,12 @@
                 if [ -z "$code" ]; then
                     exit_status=1
                 else
-                    eval $code
+                    OLD_IFS=$IFS
+                    IFS="$(echo -e "\n\r")"
+                    for line in $code; do
+                        eval $line
+                    done
+                    IFS=$OLD_IFS
                     __perlbrew_set_path
                 fi
             fi
@@ -265,6 +271,7 @@
         D => [],
         U => [],
         A => [],
+        sitecustomize => '',
     );
 
     # build a local @ARGV to allow us to use an older
@@ -293,7 +300,9 @@
         'U=s@',
         'A=s@',
 
-        'j=i'
+        'j=i',
+        # options that affect Configure and customize post-build
+        'sitecustomize=s',
     )
       or run_command_help(1);
 
@@ -920,9 +929,17 @@
     my @d_options = @{ $self->{D} };
     my @u_options = @{ $self->{U} };
     my @a_options = @{ $self->{A} };
+    my $sitecustomize = $self->{sitecustomize};
     $as = $self->{as} if $self->{as};
 
-    unshift @d_options, qq(prefix=@{[ $self->root ]}/perls/$as);
+    if ( $sitecustomize ) {
+        die "Could not read sitecustomize file '$sitecustomize'\n"
+            unless -r $sitecustomize;
+        push @d_options, "usesitecustomize";
+    }
+
+    my $perlpath = $self->root . "/perls/$as";
+    unshift @d_options, qq(prefix=$perlpath);
     push @d_options, "usedevel" if $dist_version =~ /5\.1[13579]|git|blead/;
     print "Installing $dist_extracted_dir into " . $self->path_with_tilde("@{[ 
$self->root ]}/perls/$as") . "\n";
     print <<INSTALL if !$self->{verbose};
@@ -978,11 +995,22 @@
 
     delete $ENV{$_} for qw(PERL5LIB PERL5OPT);
 
-    if (!system($cmd)) {
-        unless (-e catfile($self->root, "perls", $as, "bin", "perl")) {
+    if ($self->do_system($cmd)) {
+        my $newperl = catfile($self->root, "perls", $as, "bin", "perl"); 
+        unless (-e $newperl) {
             $self->run_command_symlink_executables($as);
         }
-
+        if ( $sitecustomize ) {
+            my $capture = $self->do_capture("$newperl -V:sitelib");
+            my ($sitelib) = $capture =~ /sitelib='(.*)';/;
+            mkpath($sitelib) unless -d $sitelib;
+            my $target = "$sitelib/sitecustomize.pl";
+            open my $dst, ">", $target
+                or die "Could not open '$target' for writing: $!\n";
+            open my $src, "<", $sitecustomize
+                or die "Could not open '$sitecustomize' for reading: $!\n";
+            print {$dst} do { local $/; <$src> };
+        }
         print <<SUCCESS;
 Installed $dist_extracted_dir as $as successfully. Run the following command 
to switch to it.
 
@@ -1002,6 +1030,18 @@
     return;
 }
 
+sub do_system {
+  my ($self, $cmd) = @_;
+  return ! system($cmd);
+}
+
+sub do_capture {
+  my ($self, $cmd) = @_;
+  return Capture::Tiny::capture {
+    $self->do_system($cmd);
+  };
+}
+
 sub format_perl_version {
     my $self    = shift;
     my $version = shift;
@@ -1085,11 +1125,21 @@
 
         if ($lib_name) {
             require local::lib;
+
+            if (
+                $ENV{PERL_LOCAL_LIB_ROOT}
+                && $ENV{PERL_LOCAL_LIB_ROOT} =~ /^$PERLBREW_HOME/
+            ) {
+                my %deactivate_env = 
local::lib->build_deact_all_environment_vars_for($ENV{PERL_LOCAL_LIB_ROOT});
+                @env{keys %deactivate_env} = values %deactivate_env;
+            }
+
             my $base = "$PERLBREW_HOME/libs/${perl_name}\@${lib_name}";
 
             if (-d $base) {
                 delete $ENV{PERL_LOCAL_LIB_ROOT};
-                my %lib_env = local::lib->build_environment_vars_for($base, 0, 
0);
+                @ENV{keys %env} = values %env;
+                my %lib_env = local::lib->build_environment_vars_for($base, 0, 
1);
 
                 $env{PERLBREW_PATH}    = catdir($base, "bin") . ":" . 
$env{PERLBREW_PATH};
                 $env{PERLBREW_MANPATH} = catdir($base, "man") . ":" . 
$env{PERLBREW_MANPATH};
@@ -1123,7 +1173,7 @@
     for my $i ( $self->installed_perls ) {
         print $i->{is_current} ? '* ': '  ',
             $i->{name},
-            (index($i->{name}, $i->{version}) < $[) ? " ($i->{version})" : "",
+            (index($i->{name}, $i->{version}) < 0) ? " ($i->{version})" : "",
             "\n";
 
         for my $lib (@{$i->{libs}}) {
@@ -1594,8 +1644,16 @@
 sub run_command_lib_create {
     my ($self, $name) = @_;
 
-    my $fullname = ($name =~ /@/) ? $name : $self->current_perl . '@' . $name;
+    $name =~ s/^/@/ unless $name =~ /@/;
+
+    my ($perl_name, $lib_name) = $self->resolve_installation_name($name);
 
+    if (!$perl_name) {
+        my ($perl_name, $lib_name) = split('@', $name);
+        die "ERROR: '$perl_name' is not installed yet, '$name' cannot be 
created.\n";
+    }
+
+    my $fullname = $perl_name . '@' . $lib_name;
     my $dir = catdir($PERLBREW_HOME,  "libs", $fullname);
 
     if (-d $dir) {
@@ -1613,8 +1671,16 @@
 sub run_command_lib_delete {
     my ($self, $name) = @_;
 
+    $name =~ s/^/@/ unless $name =~ /@/;
+
+    my ($perl_name, $lib_name) = $self->resolve_installation_name($name);
+
+    if (!$perl_name) {
+    }
+
+    my $fullname = $perl_name . '@' . $lib_name;
+
     my $current  = $self->current_perl . '@' . ($self->env("PERLBREW_LIB") || 
"");
-    my $fullname = ($name =~ /@/) ? $name : $self->current_perl . '@' . $name;
 
     my $dir = catdir($PERLBREW_HOME,  "libs", $fullname);
 
@@ -1630,8 +1696,7 @@
             unless $self->{quiet};
     }
     else {
-        print "'$fullname' is not in the list of lib\n"
-            unless $self->{quiet};
+        die "ERROR: '$fullname' does not exist.\n";
     }
 
     return;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/05.get_current_perl.t 
new/App-perlbrew-0.39/t/05.get_current_perl.t
--- old/App-perlbrew-0.35/t/05.get_current_perl.t       2011-12-15 
19:51:32.000000000 +0100
+++ new/App-perlbrew-0.39/t/05.get_current_perl.t       2011-12-23 
07:21:57.000000000 +0100
@@ -1,18 +1,37 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use lib qw(lib);
-use Test::More tests => 1;
+
+use FindBin;
+use lib $FindBin::Bin;
 use App::perlbrew;
+require 'test_helpers.pl';
+
+use Test::More;
 use Test::Output;
 
-my $app = App::perlbrew->new();
-my $version = $App::perlbrew::VERSION;
+mock_perlbrew_install("perl-5.12.3");
+mock_perlbrew_install("perl-5.12.4");
+mock_perlbrew_install("perl-5.14.1");
+mock_perlbrew_install("perl-5.14.2");
+
+subtest "perlbrew version" => sub {
+    my $app = App::perlbrew->new();
+    my $version = $App::perlbrew::VERSION;
+    stdout_is(
+        sub {
+            $app->run_command('version');
+        },
+        "t/05.get_current_perl.t  - App::perlbrew/$version\n"
+    );
+};
+
+subtest "Current perl is decided from environment variable PERLBREW_PERL" => 
sub {
+    for my $v (qw(perl-5.12.3 perl-5.12.3 perl-5.14.1 perl-5.14.2)) {
+        local $ENV{PERLBREW_PERL} = $v;
+        my $app = App::perlbrew->new;
+        is $app->current_perl, $v;
+    }
+};
 
-stdout_is(
-    sub {
-        $app->run_command('version');
-    },
-    "t/05.get_current_perl.t  - App::perlbrew/$version\n",
-    'Test version'
-);
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/12.sitecustomize.t 
new/App-perlbrew-0.39/t/12.sitecustomize.t
--- old/App-perlbrew-0.35/t/12.sitecustomize.t  1970-01-01 01:00:00.000000000 
+0100
+++ new/App-perlbrew-0.39/t/12.sitecustomize.t  2011-12-28 09:42:41.000000000 
+0100
@@ -0,0 +1,104 @@
+#!perl
+use strict;
+use Path::Class;
+use Capture::Tiny qw/capture/;
+use IO::All;
+BEGIN {
+    $ENV{PERLBREW_ROOT} = file(__FILE__)->dir->subdir("mock_perlbrew_root");
+}
+
+use Test::More;
+
+use App::perlbrew;
+
+## setup
+
+App::perlbrew::rmpath( $ENV{PERLBREW_ROOT} );
+
+## mock
+
+no warnings 'redefine';
+
+sub App::perlbrew::do_system {
+    my ($self, $cmd) = @_;
+    if ($cmd =~ /sitelib/) {
+        print 
"sitelib='$ENV{PERLBREW_ROOT}/perls/perl-5.14.2/lib/site_perl/5.14.2';";
+        return 1;
+    }
+    elsif ($cmd =~ /Configure/) {
+        # pretend to succeed
+        return 1;
+    }
+    else {
+        # fail to run
+        $? = 1<<8;
+        $! = "Could not run '$cmd'";
+        return 0;
+    }
+}
+
+sub App::perlbrew::do_install_release {
+    my ($self, $dist) = @_;
+    my ($dist_name, $dist_version) = $dist =~ m/^(.*)-([\d.]+(?:-RC\d+)?)$/;
+
+    my $name = $dist;
+    $name = $self->{as} if $self->{as};
+
+    my $root = dir($ENV{PERLBREW_ROOT});
+    my $installation_dir = $root->subdir("perls", $name);
+    App::perlbrew::mkpath($installation_dir);
+    App::perlbrew::mkpath($root->subdir("perls", $name, "bin"));
+
+    my $perl = $root->subdir("perls", $name, "bin")->file("perl");
+    io($perl)->print("#!/bin/sh\nperl \"\$@\";\n");
+    chmod 0755, $perl;
+
+    # fake the install
+    $self->do_install_this("/tmp/fake-src/perl-5.14.2", $dist_version, $dist);
+}
+
+use warnings;
+
+## main
+
+note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
+
+subtest "No perls yet installed" => sub {
+    my $app = App::perlbrew->new;
+    my @installed = grep { !$_->{is_external} } $app->installed_perls;
+    is 0+@installed, 0, "no perls installed";
+};
+
+subtest "--sitecustomize option can be set" => sub {
+    my $app = App::perlbrew->new('install', 'perl-5.14.2',
+        '--sitecustomize=mysitecustomize.pl'
+    );
+
+    is join(' ', $app->args), join(' ', qw(install perl-5.14.2)), "post-option 
args correct";
+    is $app->{sitecustomize}, 'mysitecustomize.pl', '--sitecustomize set as 
expected';
+};
+
+subtest "mock installing" => sub {
+    my $sitefile = File::Temp->new;
+    print $sitefile "use strict;\n";
+    close $sitefile;
+    my $app = App::perlbrew->new('install', 'perl-5.14.2',
+        "--sitecustomize=$sitefile"
+    );
+    my ($output,$error) = capture { $app->run };
+
+    my @installed = grep { !$_->{is_external} } $app->installed_perls;
+    is 0+@installed, 1, "found 1 installed perl";
+
+    is $installed[0]->{name}, "perl-5.14.2", "found expected perl";
+    my $root = dir($ENV{PERLBREW_ROOT});
+    my $perldir = $root->subdir("perls", "perl-5.14.2");
+    my $installedsite = $perldir->file('lib', 'site_perl', '5.14.2', 
'sitecustomize.pl');
+    ok( -f $installedsite, "sitecustomize.pl installed" );
+
+    my $guts = do { local (@ARGV, $/) = $installedsite; <> };
+    is( $guts, "use strict;\n", "sitecustomize.pl contents correct" );
+};
+
+done_testing;
+# vim: ts=4 sts=4 sw=4 et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/command-exec.t 
new/App-perlbrew-0.39/t/command-exec.t
--- old/App-perlbrew-0.35/t/command-exec.t      2011-12-17 06:03:00.000000000 
+0100
+++ new/App-perlbrew-0.39/t/command-exec.t      2011-12-23 07:21:57.000000000 
+0100
@@ -32,11 +32,14 @@
     # NOTE: this script may need to change if the usage of these perlbrew vars 
changes
     test_env => {
         content => '', # don't create a file for this one
-        args    => [ qw( exec sh -c ), 'echo "$PERLBREW_PERL--$PERLBREW_PATH" 
>> $1', '-' ],
+        args    => [ qw( exec sh -c ), 'echo "$PERLBREW_PERL--$PERLBREW_PATH" 
>> $0' ],
         output  => join('', sort map { "$_--$root/bin:$root/perls/$_/bin\n" } 
@perls),
     },
 );
 
+close STDOUT;
+close STDERR;
+
 # build a fake root with some fake perls (most of this was modified from stuff 
found in t/installation.t)
 foreach my $name ( @perls ) {
     my $bin = $root->subdir("perls", $name, "bin");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/command-lib.t 
new/App-perlbrew-0.39/t/command-lib.t
--- old/App-perlbrew-0.35/t/command-lib.t       2011-10-13 17:29:25.000000000 
+0200
+++ new/App-perlbrew-0.39/t/command-lib.t       2011-12-31 16:59:58.000000000 
+0100
@@ -8,9 +8,13 @@
 use File::Path::Tiny;
 use Test::Spec;
 use Test::Output;
+use Test::Exception;
 use App::perlbrew;
 
 require "test_helpers.pl";
+mock_perlbrew_install("perl-5.14.1");
+mock_perlbrew_install("perl-5.14.2");
+mock_perlbrew_install("perl-5.14.3");
 
 describe "lib command," => sub {
     it "shows a page of usage synopsis when no sub-command are given." => sub {
@@ -21,14 +25,72 @@
     };
 
     describe "`create` sub-command," => sub {
-        it "creates the local::lib folder" => sub {
-            stdout_is {
-                my $app = App::perlbrew->new("lib", "create", "nobita");
-                
$app->expects("current_perl")->returns("perl-5.14.2")->at_least_once;
-                $app->run;
-            } qq{lib 'perl-5.14.2\@nobita' is created.\n};
+        my ($app, $libdir);
+
+        before each => sub {
+            $app = App::perlbrew->new;
+            
$app->expects("current_perl")->returns("perl-5.14.2")->at_least_once;
+
+            $libdir = dir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.14.2@nobita');
+        };
+
+        after each => sub {
+            $libdir->rmtree;
+        };
+
+        describe "with a bare lib name," => sub {
+            it "creates the lib folder for current perl" => sub {
+                stdout_is {
+                    $app->{args} = [ "lib", "create", "nobita" ];
+                    $app->run;
+                } qq{lib 'perl-5.14.2\@nobita' is created.\n};
 
-            ok -d catdir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.14.2@nobita');
+                ok -d $libdir;
+            };
+        };
+
+        describe "with \@ in the beginning of lib name," => sub {
+            it "creates the lib folder for current perl" => sub {
+                stdout_is {
+                    $app->{args} = [ "lib", "create", '@nobita' ];
+
+                    $app->run;
+                } qq{lib 'perl-5.14.2\@nobita' is created.\n};
+
+                ok -d $libdir;
+            }
+        };
+
+        describe "with perl name and \@  as part of lib name," => sub {
+            it "creates the lib folder for the specified perl" => sub {
+                stdout_is {
+                    $app->{args} = [ "lib", "create", 'perl-5.14.2@nobita' ];
+                    $app->run;
+                } qq{lib 'perl-5.14.2\@nobita' is created.\n};
+
+                ok -d $libdir;
+            };
+
+            it "creates the lib folder for the specified perl" => sub {
+                stdout_is {
+                    $app->{args} = [ "lib", "create", 'perl-5.14.1@nobita' ];
+                    $app->run;
+                } qq{lib 'perl-5.14.1\@nobita' is created.\n};
+
+                $libdir = dir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.14.1@nobita');
+                ok -d $libdir;
+            };
+
+            it "shows errors if the specified perl does not exist." => sub {
+                throws_ok {
+                    ## perl-5.8.8 is not mock-installed
+                    $app->{args} = [ "lib", "create", 'perl-5.8.8@nobita' ];
+                    $app->run;
+                } qr{^ERROR: 'perl-5.8.8' is not installed yet, 
'perl-5.8.8\@nobita' cannot be created.\n};
+
+                $libdir = dir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.8.8@nobita');
+                ok !-d $libdir;
+            };
         };
     };
 
@@ -49,6 +111,14 @@
             ok !-d catdir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.14.2@nobita');
             ok !-e catdir($App::perlbrew::PERLBREW_HOME, "libs", 
'perl-5.14.2@nobita');
         };
+
+        it "shows errors when the given lib does not exists " => sub {
+            throws_ok {
+                my $app = App::perlbrew->new("lib", "delete", "yoga");
+                
$app->expects("current_perl")->returns("perl-5.14.2")->at_least_once;
+                $app->run;
+            } qr{^ERROR: 'perl-5\.14\.2\@yoga' does not exist\.};
+        };
     };
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/installation-perlbrew.t 
new/App-perlbrew-0.39/t/installation-perlbrew.t
--- old/App-perlbrew-0.35/t/installation-perlbrew.t     2011-12-16 
22:52:45.000000000 +0100
+++ new/App-perlbrew-0.39/t/installation-perlbrew.t     2011-12-23 
07:21:57.000000000 +0100
@@ -10,7 +10,7 @@
 use Path::Class;
 use Test::More;
 
-note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
+diag "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
 
 subtest "`perlbrew self-install` initialize the required dir structure under 
PERLBREW_ROOT", sub {
     my $app = App::perlbrew->new('--quiet', 'self-install');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/App-perlbrew-0.35/t/test_helpers.pl 
new/App-perlbrew-0.39/t/test_helpers.pl
--- old/App-perlbrew-0.35/t/test_helpers.pl     2011-12-17 06:02:25.000000000 
+0100
+++ new/App-perlbrew-0.39/t/test_helpers.pl     2011-12-23 07:21:57.000000000 
+0100
@@ -47,7 +47,7 @@
 
     chmod 0755, $perl;
 
-    note "(mock) installed $name to $installation_dir";
+    diag "(mock) installed $name to $installation_dir";
 }
 
 sub mock_perlbrew_install {

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to