Herbert Breunung > Perl6-Doc-0.36 > Perl6::Overview::Magic

Download:
Perl6-Doc-0.36.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Perl6::Overview::Magic - Magical Variables

DESCRIPTION ^

Secondary Sigils (also known as "twigils"):

    $+   # currently compiling scope (see S02)
    $?   # lexically-scoped (compile time, see S02)
    $*   # global (run time, see S02)
    $=   # file-scoped (see S02)
    $^   # implicit block argument (see S06 placeholder variables)
    $<   # current $/ scope (see S02)
    $.   # public attribute (see S12 attributes)
    $!   # private attribute (see S12 attributes)

Named variables (see S02):

    $/             # match object from last rule
    $0             # first captured value from match: $/.[0]
    @*ARGS         # command-line arguments
    &?BLOCK        # current block (itself, see S06)
    @?BLOCK        # current blocks (themselves, see S06)
    $?BLOCKLABEL   # label of current block (see S06) 
                   #   XXX redundant with $?LABEL?
    ::?CLASS       # current class (as package name)
    $?CLASS        # current class (as variable)
    @?CLASS        # current classes
    %?CONFIG       # configuration hash
    $=DATA         # data block handle (=begin DATA ... =end)
    $*EGID         # effective group id
    %*ENV          # system environment
    $*ERR          # standard error handle
    $*EUID         # effective user id
    $*EXECUTABLE_NAME    # executable name
    $?FILE         # current file
    $?GRAMMAR      # current grammar
    @?GRAMMAR      # current grammars
    $*GID          # group id
    $*IN           # standard input handle
    $?LABEL        # label of current block
    @?LABEL        # labels of current blocks
    $?LINE         # current line
    $?MODULE       # current module
    @?MODULE       # current modules
    $?OS           # operating system compiled for
    $*OS           # operating system running under
    $?OSVER        # operating system version compiled for
    $*OSVER        # operating system version running under
    $*OUT          # standard output handle
    $?PACKAGE      # current package (as object)
    @?PACKAGE      # current packages
    $?PACKAGENAME  # name of current package (see S10) 
    $?PERLVER      # perl version compiled for
    $*PERLVER      # perl version running under
    $*PROGRAM_NAME # name of the program being executed
    $*PID          # system process id
    $?PUGS_VERSION # Pugs version (not canonical)
    $*PUGS_HAS_HSPLUGINS # True if Pugs was compiled with support for hsplugins
                         # (not canonical)
    ::?ROLE        # current role (as package name)
    $?ROLE         # current role (as variable)
    @?ROLE         # current roles
    &?ROUTINE      # current sub or method (itself, see S06)
    @?ROUTINE      # current subs or methods (themselves)
    $*UID          # system user id

There were threads on p6l about unifying all variables which concern the OS or the VM ($*UID, $*PROGRAM_NAME, etc.) into two variables, $?ENV (compile-time environment) and $*ENV (runtime environment). Larry did like the idea, but "ENV" is probably to overloaded to mean the hash of environment variables (which would be found under $*ENV.environment or some-such).

syntax highlighting: