In perl special tokens like __PACKAGE__
, __SUB__
, __FILE__
, __LINE__
exists and available from script.
I may get
You can look them up one by one in toke.c
for the compile-time values:
__PACKAGE__
=> HvNAME(PL_curstash)
or PL_curstname
__FILE__
=> CopFILE(PL_curcop)
(at compile-time)__LINE__
=> CopLINE(PL_curcop)
(at compile-time)__SUB__
=> PL_compcv
If you need them at run-time look at the various data fields available in the context caller_cx
and current sub (cv
). There's no context struct as in parrot or perl6 passed around, rather a stack of active context blocks.