> On Tue, Aug 18, 2009 at 11:04 AM, David Green<david.gr...@telus.net> wrote:
>> On 2009-Aug-18, at 2:29 am, Carlin Bingham wrote:
>>>
>>> chdir provides functionality that would be quite convoluted to mimic
>>> through manually setting $*CWD, such as changing to a relative
>>> directory.
>>
>> Maybe setting $*CWD just calls chdir() under the hood?  Same implementation,
>> brand new shiny Perl-style interface!

If $*CWD is really a Path object and not a Str, then it should be easy
to use mutator methods to change to a relative directory and do other
chdir()ish things.  Say, concatenation works in terms of path
components, for instance:

$*CWD ~= $subdir;   # chdir($subdir)

With a method for getting the parent:

given $*CWD { $_ = $_.up ~ $sibling }   # chdir("../$sibling")

and so on.  My favorite kshism is "cd old new" which does a
search/replace on the current working directory; the bash equivalent
"cd ${PWD/old/new}" which is not quite as handy.  $*CWD could make
that simple, too.

-- 
Mark J. Reed <markjr...@gmail.com>

Reply via email to