in reply to Re^3: Why shows B::Deparse __END__ as __DATA__? (BUG #2)
in thread Why shows B::Deparse __END__ as __DATA__?

no_data.pl has no DATA section at all, but B::Deparse includes the part from the used module.

This example shows that neither \*main::DATA nor \*last_pckg::DATA can be reliably used without further information.

We either need a mechanism to get the real filehandle of the current file (maybe thru B ?) or a way to identify the file associated to those filehandles (for check against $0)

lanx@nc10-ubuntu:/tmp$ cat no_data.pl use wrong_data; print <DATA>; lanx@nc10-ubuntu:/tmp$ cat wrong_data.pm 1; __DATA__ wrong main::DATA lanx@nc10-ubuntu:/tmp$ perl -MO=Deparse no_data.pl use wrong_data; print <DATA>; __DATA__ wrong main::DATA no_data.pl syntax OK lanx@nc10-ubuntu:/tmp$ perl no_data.pl wrong_main::DATA

for completeness: The deparsed code will produce the same results now in this special case!

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Replies are listed 'Best First'.
Re^5: Why shows B::Deparse __END__ as __DATA__? (BUG #3)
by karlgoethebier (Abbot) on Oct 12, 2014 at 17:10 UTC
    "Es ist immer komplizierter." (Ludwig Marcuse)

    Thank you LanX for investigations, explanations and clarifications.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»