Question : Is there a way to get this filehandle without specifying a __DATA__ or __END__ section, i.e. without reopening $0 and always pointing behind the last codeline after compilation (even if there is already a __DATA__ section defined)
No, I don't think so, only stuff like open DATA, '<', \'this works too';
Otherwise if I have defined DATA filehandles in various packages, can I check which file (if existent) is associated with it?
No, I don't think so, you cannot get filename from filehandle, there is no api and no guarantee there exists a filename, but %INC ought to have package/filename associations ...
Or if there is no pure Perl way to do it, is it possible to inspect this info with help of the B backend or other magic?
I don't know but I doubt it :)
if (tmp && tmp != KEY___DATA__ && tmp != KEY___END__
http://perl5.git.perl.org/perl.git/blob?f=t/io/data.t
In reply to Re: Filehandle of the current sourcecode, pointing after last code line?
by Anonymous Monk
in thread Filehandle of the current sourcecode, pointing after last code line?
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |