Skip Menu |
Report information
Id: 130456
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: comdog <brian.d.foy [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: brian d foy <brian.d.foy [...] gmail.com>
Date: Fri, 30 Dec 2016 04:05:37 -0500
To: rakudobug [...] perl.org
Subject: $*HOME blows up if HOME isn't set
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' Show quoted text
> $*HOME
(Any) Show quoted text
>


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org