# New Ticket Created by  "brian d foy" 
# Please include the string:  [perl #130456]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130456 >


If the HOME environment variable is not set (say, as in
non-interactive sessions), using $*HOME throws an exception:

    $ unset HOME
    $ echo $HOME

    $ perl6 -e 'put "HOME is $*HOME"'
    Use of uninitialized value of type Any in string context.
    Methods .^name, .perl, .gist, or .say can be used to stringify it
to something meaningful.
      in block <unit> at -e line 1
    HOME is

Curiously, $*TMPDIR is /tmp if the TMPDIR environment variable is not
set.

Maybe that's good and maybe not. But, trying to use homedir blows up the
same way tmpdir does (https://rt.perl.org/Ticket/Display.html?id=130455):

    $ perl6 -e 'homedir( "/Users/brian" ); put "HOME is $*HOME"'
    No such method 'chdir' for invocant of type 'Any'
      in block <unit> at -e line 1

But, homedir isn't documented outside of S16 even though it appears to
be there somewhere. Trying to set $*HOME directly doesn't work either,
which is certainly perplexing:

    $ perl6 -e '$*HOME = "/Users/brian"; put "HOME is $*HOME"'
    Cannot modify an immutable Any
      in block <unit> at -e line 1

I can set a key is a completely different variable to get it to work:

    $ perl6 -e '%*ENV<HOME> = "/Users/brian"; put "HOME is $*HOME"'
    HOME is /Users/brian

And I can even set it to a directory that does not exist:

    $ perl6 -e '%*ENV<HOME> = "/Users/brian/not-there"; put "HOME is $*HOME"'
    HOME is /Users/brian/not-there

The $*HOME variable is listed in . If it isn't set, it's documented to
be Nil, but it is apparently Any. That also appears to mess with the REPL:

    $ perl6
    I ran into a problem while trying to set up Linenoise: Cannot
resolve caller new(IO::Path: Any); none of these signatures match:
        (IO::Path $: Cool $path, :$SPEC = { ... }, :$CWD = { ... }, *%_)
        (IO::Path $: :$basename!, :$dirname = "", :$volume = "",
:$SPEC = { ... }, :$CWD = { ... }, *%_)
        (IO::Path $: *%_)
    Continuing without tab completions or line editor
    You may want to consider using rlwrap for simple line editor functionality

    To exit type 'exit' or '^D'
    > $*HOME
    (Any)
    >

Reply via email to