You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use v5.16;
format =
@<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<
eval q<__SUB__//"undef", *STDOUT{FORMAT}>
.
write for 1..5
__END__
use v5.16;
format =
@<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<
__SUB__//"undef", *STDOUT{FORMAT}
.
write for 1..5
__END__
Notice that whether we have a string eval inside the format determines the output of __SUB__. Notice also that when __SUB__ is defined it is the same as the format originally invoked, even though the currently running format is a clone of it (though that is perhaps an implementation detail that should not be leaked).
What *should* __SUB__ produce inside a format? Maybe it should always just be undef.
(For those interested, the difference in behaviour has to do with the optimisation of the runcv op to a constant at compile time. Though now I don’t remember why string eval needs to affect that optimisation. I may have copied and pasted the logic from elsewhere.)
Migrated from rt.perl.org#128450 (status was 'new')
Searchable as RT128450$
The text was updated successfully, but these errors were encountered: