Skip Menu |

This queue is for tickets about the local-lib CPAN distribution.

Report information
The Basics
Id: 60072
Status: resolved
Priority: 0/
Queue: local-lib

People
Owner: Nobody in particular
Requestors: fs5 [...] sanger.ac.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.008026



Subject: patch to enable same set-up in cshrc as in bashrc
Date: Wed, 04 Aug 2010 16:12:24 +0100
To: bug-local-lib [...] rt.cpan.org
From: Frank Schwach <fs5 [...] sanger.ac.uk>
For csh, the documentation currently suggests to hardcode the 'setenv' statements, generated by local::lib into .cshrc, whereas the bashrc set-up makes use of dynamic command substitution, i.e. bash: echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc csh: /bin/csh perl -I$HOME/perl5/lib/perl5 -Mlocal::lib >> ~/.cshrc As far as I can see, the only reason why the dynamic command substitution approach doesn't work in csh is that csh removes the newlines between the 'setenv' commands. All that is needed to circumvent the problem is to seperate the 'setenv' commands with semicolons. In sub build_bourne_env_declaration { my $class = shift; my($name, $value) = @_; return qq{export ${name}="${value}"\n}; } changing the last line to: to return qq{export ${name}="${value}";\n}; works fine for me and now I can use eval `perl -I$HOME/perl5/lib/perl5 -Mlocal::lib` in my .cshrc to get the same behaviour as under bash. Hope this can be useful. Cheers, Frank -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
I apologize for taking so long on getting back to this. I'm not sure I understand: you suggest to change the function for bourne variable generation to add a feature for csh?
Subject: Re: [rt.cpan.org #60072] patch to enable same set-up in cshrc as in bashrc
Date: Thu, 14 Jul 2011 09:13:38 +0100
To: bug-local-lib [...] rt.cpan.org
From: Frank Schwach <fs5 [...] sanger.ac.uk>
I'm suggesting to change the sub "build_bourne_env_declaration" to add semicolons between statements. When yuo do that, you can use the exact same dynamic approach to set local:lib in bash and csh. Currently, the dynamic aproach - evaluating a Perl expression - doesn't work in csrhc just because of the newlines and this simple change would get rid of the problem. On Wed, 2011-07-13 at 22:41 -0400, Chris Nehren via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=60072 > > > I apologize for taking so long on getting back to this. > > I'm not sure I understand: you suggest to change the function for bourne variable > generation to add a feature for csh?
-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
From: ppisar [...] redhat.com
Dne Čt 14.čec.2011 04:13:56, fs5@sanger.ac.uk napsal(a): Show quoted text
> I'm suggesting to change the sub "build_bourne_env_declaration" to add > semicolons between statements. When yuo do that, you can use the exact > same dynamic approach to set local:lib in bash and csh.
You cannot because `export' does not work in CSH. Attached patch implements your idea in proper function.
Subject: local-lib-1.008004-Append-semicolon-to-setenv.patch
From 0bcf85f024efcb8067bad99c7e9b7dee64ff7edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Mon, 20 Aug 2012 11:32:32 +0200 Subject: [PATCH] Append semicolon to setenv This allows to "eval `perl -Mlocal::lib`" in CSH. <https://rt.cpan.org/Public/Bug/Display.html?id=60072> --- lib/local/lib.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 87d1869..cef5ebf 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -333,7 +333,7 @@ sub build_bourne_env_declaration { sub build_csh_env_declaration { my $class = shift; my($name, $value) = @_; - return defined($value) ? qq{setenv ${name} "${value}"\n} : qq{unsetenv ${name}\n}; + return defined($value) ? qq{setenv ${name} "${value}";\n} : qq{unsetenv ${name};\n}; } sub build_win32_env_declaration { -- 1.7.11.4
From: frankschwach [...] yahoo.de
On Mon Aug 20 06:36:01 2012, ppisar wrote: Show quoted text
> Dne Čt 14.čec.2011 04:13:56, fs5@sanger.ac.uk napsal(a):
> > I'm suggesting to change the sub "build_bourne_env_declaration" to add > > semicolons between statements. When yuo do that, you can use the exact > > same dynamic approach to set local:lib in bash and csh.
> > You cannot because `export' does not work in CSH. > > Attached patch implements your idea in proper function.
Great! Yes, of course you are right, it should be done in build_csh_env_declaration. The reason why my approach worked in my environment is that I have a cshrs that is executed first but then I replace the shell with bash but the local::lib needs to be set up in the csh already (long story...). Anyway, thanks for addressing this issue!
This will be fixed in the next release.
Fixed in 1.008026