Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Using the contents of

by JadeNB (Chaplain)
on Sep 22, 2008 at 18:53 UTC ( #713073=note: print w/ replies, xml ) Need Help??


in reply to Re: Using the contents of
in thread Using the contents of

You could tie the filehandle to a scalar, implementing the READLINE, GETC, and READ methods appropriately. See Tying Filehandles. (I thought there must be a CPAN module to do this—sort of the converse of Tie::File—but a cursory search didn't find it.)

UPDATE: IO::String and IO::Stringy both seem to be the sort of thing that you'd want here. The documentation suggests that they're only useful on older versions that don't support lexical filehandles, but it seems to me that lexical filehandles don't suffice for your situation.

UPDATE 2: ikegami pointed out what I was missing (i.e., why you shouldn't tie after all). Thanks!


Comment on Re^2: Using the contents of

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2014-09-02 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls