Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I dedicated a few hours to this today to see if there's a way to explicitly gain access to and modify the __DATA__ target into existence, when it wasn't explicitly defined, or gain access to $0 without opening it.

I tried all manner of hacking the Symbol Table, trying to force things into position, tried to merge the current running script into something that could be used, and alas, I honestly think it can't be done the way you desire.

I agree with AnonymousMonk, that you're going to have to load __FILE__. Do it in BEGIN, stash the results, and deal with the penalty.

I have modules that'll do this, but your efficiency goes down the toilet.

Discipulus said "I hope to hear working solutions but i humbly suspect we'll not", and I agree. I have one module that does deep file 'stuff', but from what I can tell, there's no way to hack a file handle to point to the current running script without opening it directly (I'm hoping with all I have that someone will direct us to a different understanding).

I keenly await responses from those who might be able to correct this understanding, through perhaps perlapi, symtab or otherwise.

Good question.


In reply to Re: Introsepcting the current Perl file via DATA, even w/o DATA? by stevieb
in thread Introspecting the current Perl file via DATA, even w/o DATA? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found