Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: OO and <DATA>

by trs80 (Priest)
on Aug 25, 2002 at 16:05 UTC ( #192679=note: print w/replies, xml ) Need Help??


in reply to Re: OO and <DATA>
in thread OO and <DATA>

dws is correct, but I don't know if the __DATA__ concern is clear enough for newer users. __DATA__ is only read ONCE during the execution of a script, any secondary calls to it will result in an empty string.

I have found it helpful to use something like Text::Template to store information that will be read in multiple times and if setup correctly will allow for edits while the process is running. I like Text::Template for its simplicity, but there are dozens of templating options that might help here.

Replies are listed 'Best First'.
Re: Re: Re: OO and <DATA>
by BUU (Prior) on Aug 25, 2002 at 17:28 UTC
    Does seek data,0; not work?
      Yes, but don't forget to use tell first, lest you spit out the entire program via seek DATA,0,0 :
      use strict; my $pointer = tell DATA; print get_data(); seek DATA,$pointer,0; print get_data(); sub get_data { do {local $/;<DATA>} }

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://192679]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2020-07-08 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?