develooper Front page | | Postings from May 2007

Re: _detildefy -- r9408

Thread Previous
Ken Williams
May 2, 2007 18:56
Re: _detildefy -- r9408
Message ID:

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") :

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.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About