in reply to Introspecting the current Perl file via DATA, even w/o DATA?
If no token is found (i suspect) that anyone that was reading the code close the file before any possible existence of a Perl filehandle. Infact DATA is not available during a BEGIN block, obviously. Also the fact that $. starts just after the token, with the value of 1 make me suspicious. I've still waiting for that trick solution.. but some test is still interesting (oneliners acts like plain file here):
perl -we "print tell DATA" Name "main::DATA" used only once: possible typo at -e line 1. tell() on unopened filehandle DATA at -e line 1. -1 perl -we "print tell DATA;__DATA__" -e"aaa" -e "bbb" + # uh?! no error! 0 perl -we "print tell DATA;__DATA__" -e"aaa" -e "bbb" -MO=Deparse BEGIN { $^W = 1; } print tell DATA; __DATA__ -e syntax OK
About the fool idea of opening $0 and just for curiosity, was my 7th post here.
L*
|
---|