develooper Front page | perl.module.build | Postings from May 2007

Re: _detildefy -- r9408

Thread Previous
From:
Ken Williams
Date:
May 2, 2007 18:56
Subject:
Re: _detildefy -- r9408
Message ID:
E3AA5C58-75FB-4597-9A74-89418F7638B9@mathforum.org

On Apr 28, 2007, at 9:52 PM, Eric Wilhelm wrote:

> Maybe we do "s/(~\w*(?:/|$))//" and then "glob($1) . $_" ?  Does that
> cover everything?  (Well, everything except the backslash duality  
> issue
> on windows.)  If people want "~my user name is cool/" to work, I don't
> think I can bring myself to think about it.

Yeah, me neither.

Here's what MakeMaker does, which is pretty close to that, but  
doesn't invoke the shell:

         if ($value =~ m/^~(\w+)?/) { # tilde with optional username
             $value =~ s [^~(\w*)]
                 [$1 ?
                  ((getpwnam($1))[7] || "~$1") :
                  (getpwuid($>))[7]
                  ]ex;
         }

We should probably just steal it out of there, since at least then  
we'll be consistent.

Can you verify that on Windows (getpwuid $>)[7] returns $ENV{HOME} if  
set?  Or at least something reasonable?  Or even if it doesn't, we  
can easily just override _detildefy in the Windows subclass.

  -Ken


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About