Perl-Critic / PPI

53 stars 44 forks source link

PPI::Token::Magic -- what is $::| #155

Open moregan opened 9 years ago

moregan commented 9 years ago

PPI::Token::Magic and the Changes file explicitly make "$::|" a magic variable, but I haven't found a version of perl that will compile it:

perl -le 'say STDOUT $::|'
syntax error at -e line 1, at EOF
Execution of -e aborted due to compilation errors.

Making it magic was committed 2005-01-17, but there's no subversion/GitHub history back that far.

t/data/08_regression/04_tinderbox.code tests that %:: is non-magic, but also wants $::|=1; to be magic.

Should %:: (and $::...) be magic or not? Is there any cause for '$::|' to be treated specially in Magic.pm?

moregan commented 9 years ago

Note that | exists in %:::

perl -WE '$| = 1; print ${"::|"}'
1

but you have to use ${ to get at it.

It's possible that forcing $::| to be magic came about via the $::|=1; example in 04_tinderbox.code mentioned above, since PPI at the time did not recognizing the |= operator.

adamkennedy commented 9 years ago

It's totally possible it was an oversight.

If is in the tinderbox test then it does match a real character sequence found in the wild. Might well have been a case of mistaken identity.

Adam On Dec 27, 2014 2:14 AM, "moregan" notifications@github.com wrote:

Note that | exists in %:::

perl -WE '$| = 1; print ${"::|"}' 1

but you have to use ${ to get at it.

It's possible that forcing $::| to be magic came about via the $::|=1; example in 04_tinderbox.code mentioned above, since PPI at the time did not recognizing the |= operator.

— Reply to this email directly or view it on GitHub https://github.com/adamkennedy/PPI/issues/155#issuecomment-68144527.