Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You really ought to be using __END__ instead of __DATA__. See the SelfLoader POD explanation of the way the __DATA__ is intended to be used.

Maybe you can explain this better. I read the SelfLoader POD, and it seems to indicate that __END__ indicates the end of any subroutines in the __DATA__ section. Sort of. It seems to be talking about using the __DATA__ section in packages other than main (I'm referring to sections of the POD that say "works just like __END__ in main"). So if I simply replace __DATA__ with __END__ I can't read from the section. while (my $line = <END>) doesn't work at all. If I add the __END__ token after the __DATA__ then __END__ is read in as a line.

The SelfLoader documentation, as far as I can tell, is used to replace the AutoLoader to be able to do something. I don't write packages, so I am not understanding a lot of the POD. But my best guess is that the __DATA__ section is used for subroutines that might not be called, so you can load them only when they are used. Which doesn't do anything for me, since I'm not writing packages, I'm tossing some input onto the end of my script. I could put the information into another file, and read that, but I don't really see the point of that.

So tell me what it is that I am missing, please.


In reply to Re^2: odd behavior with DATA section by Nkuvu
in thread odd behavior with DATA section by Nkuvu

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 about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found