From: Torsten Raudssus Date: Thu, 9 Dec 2010 20:38:46 +0000 (+0100) Subject: Added guess_shelltype method, fixed documentation about new changes X-Git-Tag: 1.006009 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Ftags%2F1.006009;hp=efe8889a0a012a66577cdd41f7ef79a5747dd88d;p=p5sagit%2Flocal-lib.git Added guess_shelltype method, fixed documentation about new changes --- diff --git a/Changes b/Changes index 88c819b..5123875 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for local::lib +1.006009 2010-12-09 + + - Splitted up method guess_shelltype from parts of print_environment_vars_for + - Updated documentation about change of use with .modulebuildrc + 1.006008 2010-11-17 - Finally move to PERL_MB_OPT rather than using .modulebuildrc. diff --git a/lib/POD2/DE/local/lib.pod b/lib/POD2/DE/local/lib.pod index 5a1ee49..6681975 100644 --- a/lib/POD2/DE/local/lib.pod +++ b/lib/POD2/DE/local/lib.pod @@ -23,10 +23,10 @@ Von der Shell - # Gibt die Shell Kommandos aus um die Umgebung vorzubereiten $ perl -Mlocal::lib - export MODULEBUILDRC=/home/username/perl/.modulebuildrc - export PERL_MM_OPT='INSTALL_BASE=/home/username/perl' - export PERL5LIB='/home/username/perl/lib/perl5:/home/username/perl/lib/perl5/i386-linux' - export PATH="/home/username/perl/bin:$PATH" + export PERL_MB_OPT='--install_base /home/username/perl5' + export PERL_MM_OPT='INSTALL_BASE=/home/username/perl5' + export PERL5LIB='/home/username/perl5/lib/perl5/i386-linux:/home/username/perl5/lib/perl5' + export PATH="/home/username/perl5/bin:$PATH" =head2 Die Bootstrapping Methode @@ -137,7 +137,7 @@ Um die nötigen Umgebungsvariablen für diese Variablen in der derzeitigen Sitzung mit C zu setzen, kann man folgendes kommando nutzen: C:\>perl -Mlocal::lib - set MODULEBUILDRC=C:\DOCUME~1\ADMINI~1\perl5\.modulebuildrc + set PERL_MB_OPT=--install_base C:\DOCUME~1\ADMINI~1\perl5 set PERL_MM_OPT=INSTALL_BASE=C:\DOCUME~1\ADMINI~1\perl5 set PERL5LIB=C:\DOCUME~1\ADMINI~1\perl5\lib\perl5;C:\DOCUME~1\ADMINI~1\perl5\lib\perl5\MSWin32-x86-multi-thread set PATH=C:\DOCUME~1\ADMINI~1\perl5\bin;%PATH% @@ -202,7 +202,7 @@ nötigen Werten: =over 4 -=item MODULEBUILDRC +=item PERL_MB_OPT =item PERL_MM_OPT @@ -320,19 +320,6 @@ Gibt den Pfad zurück, wo ausführbare Programme installiert werden, basierend auf der Basis des angegebenen Pfad. Basierend auf L Rückgabewert, hängt diese Methode noch C an. -=head2 modulebuildrc_path - -=over 4 - -=item Parameter: $pfad - -=item Rückgabewert: $modulebuildrc_pfad - -=back - -Gibt den Pfad zurück wo die C<.modulebuildrc> Datei angelegt wird, basierend -auf der Basis des angegebenen Pfad. - =head2 resolve_empty_path =over 4 @@ -423,7 +410,7 @@ nicht gesetzt ist, eine Bourne Shell wird angenommen. Bootstrap ist leider ein Hack, und wird auf jedenfall CPAN.pm benutzen für ExtUtils::MakeMaker, auch wenn CPANPLUS installiert ist. -Es setzt definitiv PERL5LIB, PERL_MM_OPT und MODULEBUILDRC neu und vernichtet +Es setzt definitiv PERL5LIB, PERL_MM_OPT und PERL_MB_OPT neu und vernichtet jeden Wert der vorher gesetzt war. Es sollte vielleicht eine automatische Korrektur der CPAN Config machen, wenn diff --git a/lib/POD2/PT_BR/local/lib.pod b/lib/POD2/PT_BR/local/lib.pod index ee748fa..3d21e99 100644 --- a/lib/POD2/PT_BR/local/lib.pod +++ b/lib/POD2/PT_BR/local/lib.pod @@ -23,10 +23,10 @@ Pela linha de comando (shell) - # Apenas exibe alguns comandos úteis para a shell $ perl -Mlocal::lib - export MODULEBUILDRC=/home/username/perl/.modulebuildrc - export PERL_MM_OPT='INSTALL_BASE=/home/username/perl' - export PERL5LIB='/home/username/perl/lib/perl5:/home/username/perl/lib/perl5/i386-linux' - export PATH="/home/username/perl/bin:$PATH" + export PERL_MB_OPT='--install_base /home/username/perl5' + export PERL_MM_OPT='INSTALL_BASE=/home/username/perl5' + export PERL5LIB='/home/username/perl5/lib/perl5/i386-linux:/home/username/perl5/lib/perl5' + export PATH="/home/username/perl5/bin:$PATH" =head2 A técnica de 'bootstrapping' @@ -134,7 +134,7 @@ Para configurar as variáveis de ambiente apropriadas para sua sessão atual do C, você pode fazer assim: C:\>perl -Mlocal::lib - set MODULEBUILDRC=C:\DOCUME~1\ADMINI~1\perl5\.modulebuildrc + set PERL_MB_OPT=--install_base C:\DOCUME~1\ADMINI~1\perl5 set PERL_MM_OPT=INSTALL_BASE=C:\DOCUME~1\ADMINI~1\perl5 set PERL5LIB=C:\DOCUME~1\ADMINI~1\perl5\lib\perl5;C:\DOCUME~1\ADMINI~1\perl5\lib\perl5\MSWin32-x86-multi-thread set PATH=C:\DOCUME~1\ADMINI~1\perl5\bin;%PATH% @@ -194,7 +194,7 @@ seguintes variáveis de ambiente: =over 4 -=item MODULEBUILDRC +=item PERL_MB_OPT =item PERL_MM_OPT @@ -312,19 +312,6 @@ Retorna um caminho de diretório indicando onde instalar programas executáveis para essa instalação local de bibliotecas. Baseia-se no valor de retorno do método L, adicionando o diretório C. -=head2 modulebuildrc_path - -=over 4 - -=item Argumentos: $caminho_do_diretorio - -=item Valor de Retorno: $caminho_para_modulebuildrc - -=back - -Retorna um caminho de diretório indicando onde instalar o arquivo -C<.modulebuildrc>, baseado no caminho fornecido. - =head2 resolve_empty_path =over 4 @@ -413,7 +400,7 @@ A técnica de bootstrap é um hack e usará o CPAN.pm para o ExtUtils::MakeMaker mesmo que você tenha o CPANPLUS instalado. Destrói qualquer valor pré-existente nas variáveis de ambiente PERL5LIB, -PERL_MM_OPT e MODULEBUILDRC. +PERL_MM_OPT e PERL_MB_OPT. Provavelmente deveria auto-configurar o CPAN caso isso ainda não tenha sido feito. diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 7586070..96e5a1c 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -11,7 +11,7 @@ use File::Path (); use Carp (); use Config; -our $VERSION = '1.006008'; # 1.6.8 +our $VERSION = '1.006009'; # 1.6.9 our @KNOWN_FLAGS = qw(--self-contained); @@ -230,16 +230,7 @@ sub ensure_dir_structure_for { sub INTERPOLATE_ENV () { 1 } sub LITERAL_ENV () { 0 } -sub print_environment_vars_for { - my ($class, $path) = @_; - my @envs = $class->build_environment_vars_for($path, LITERAL_ENV); - my $out = ''; - - # rather basic csh detection, goes on the assumption that something won't - # call itself csh unless it really is. also, default to bourne in the - # pathological situation where a user doesn't have $ENV{SHELL} defined. - # note also that shells with funny names, like zoid, are assumed to be - # bourne. +sub guess_shelltype { my $shellbin = 'sh'; if(defined $ENV{'SHELL'}) { my @shell_bin_path_parts = File::Spec->splitpath($ENV{'SHELL'}); @@ -271,6 +262,21 @@ sub print_environment_vars_for { } }; } + return $shelltype; +} + +sub print_environment_vars_for { + my ($class, $path) = @_; + my @envs = $class->build_environment_vars_for($path, LITERAL_ENV); + my $out = ''; + + # rather basic csh detection, goes on the assumption that something won't + # call itself csh unless it really is. also, default to bourne in the + # pathological situation where a user doesn't have $ENV{SHELL} defined. + # note also that shells with funny names, like zoid, are assumed to be + # bourne. + + my $shelltype = $class->guess_shelltype; while (@envs) { my ($name, $value) = (shift(@envs), shift(@envs)); @@ -368,9 +374,9 @@ From the shell - # Just print out useful shell commands $ perl -Mlocal::lib export PERL_MB_OPT='--install_base /home/username/perl5' - export PERL_MM_OPT='INSTALL_BASE=/home/username/perl' - export PERL5LIB='/home/username/perl/lib/perl5:/home/username/perl/lib/perl5/i386-linux' - export PATH="/home/username/perl/bin:$PATH" + export PERL_MM_OPT='INSTALL_BASE=/home/username/perl5' + export PERL5LIB='/home/username/perl5/lib/perl5/i386-linux:/home/username/perl5/lib/perl5' + export PATH="/home/username/perl5/bin:$PATH" =head2 The bootstrapping technique