in reply to Re^3: Reading session data
in thread Reading session data

G'day hippo,

"Perhaps someone who likes/uses postfix deref can explain where the compilation error comes from and how to fix it."

The problem revolves around the version of Perl being used, the feature bundle loaded, and additional features requested. Here's some examples:

v5.36 with full feature bundle
$ perl -E 'say $^V; my $x = "xyz"; my $r = \$x; say "PFDR: $r->$*";' v5.36.0 PFDR: xyz
v5.36 with no feature bundle
$ perl -e 'print $^V; my $x = "xyz"; my $r = \$x; print "PFDR: $r->$*" +;' $* is no longer supported as of Perl 5.30 at -e line 1.
v5.22 with default :5.22 feature bundle
$ perl -e 'use v5.22; say $^V; my $x = "xyz"; my $r = \$x; say "PFDR: +$r->$*";' $* is no longer supported as of Perl 5.30 at -e line 1.
v5.22 with default :5.22 feature bundle plus "postderef" feature
$ perl -e 'use v5.22; use feature "postderef"; say $^V; my $x = "xyz"; + my $r = \$x; say "PFDR: $r->$*";' $* is no longer supported as of Perl 5.30 at -e line 1.
v5.22 with default :5.22 feature bundle plus "postderef" feature (dereferencing outside of quotes)
$ perl -e 'use v5.22; use feature "postderef"; say $^V; my $x = "xyz"; + my $r = \$x; my $y = $r->$*; say "PFDR: $y";' v5.36.0 PFDR: xyz
v5.22 with default :5.22 feature bundle plus "postderef_qq" feature
$ perl -e 'use v5.22; use feature "postderef_qq"; say $^V; my $x = "xy +z"; my $r = \$x; say "PFDR: $r->$*";' v5.36.0 PFDR: xyz
v5.24 with default :5.24 feature bundle
$ perl -e 'use v5.24; say $^V; my $x = "xyz"; my $r = \$x; say "PFDR: +$r->$*";' v5.36.0 PFDR: xyz

I couldn't see it specifically documented anywhere but 'use feature "postderef_qq";' seems to imply 'use feature "postderef";'. This is borne out by my own tests (in particular, see the "v5.22" tests above) and documentation of feature bundles that include postderef_qq do not also include postderef.
[I have a niggling feeling that I did see such documentation a long time ago. If someone locates it, please share. Thankyou.]

Some relevant documentation links (in no particular order):

— Ken

Replies are listed 'Best First'.
Re^5: Reading session data
by hippo (Archbishop) on Jul 01, 2023 at 14:29 UTC

    Thanks for the detailed analysis, kcott. I am using 5.34 so adding in use v5.34; has allowed the construct to work for me. use feature 'postderef_qq'; also works.

    However, the version-dependent nature of all of this combined with the paucity of documentation and the arcane error message received has only served to reinforce my decision to avoid postfix dereferencing in general.


    🦛