KBD

Keith Devens .com

Friday, March 19, 2010 Flag waving
Anything is possible if you don't know what you're talking about. – unknown
← Switching spam filtersUnicode design flaws? →

Daily link icon Saturday, August 23, 2003

Pretend a string is a file in Perl

Cool, there's a way to treat a string like a filehandle (but only in Perl 5.8).

← Switching spam filtersUnicode design flaws? →

Comments XML gif

Sam Kington (http://www.illuminated.co.uk/blog/) wrote:

Alternatively, for other versions of Perl, use IO::Scalar.

∴ Sam Kington | 23-Aug-2003 6:50am est | http://www.illuminated.co.uk/blog/ | #2777

Keith (http://www.keithdevens.com/) wrote:

Man, I need to be better acquainted with Perl's standard library and CPAN. Thanks.

Keith | 23-Aug-2003 10:37am est | http://www.keithdevens.com/ | #2780

Harry Fuecks (http://www.phppatterns.com) wrote:

If you ever try the same thing in PHP, you might be interested in stream_wrapper_register

∴ Harry Fuecks | 23-Aug-2003 6:48pm est | http://www.phppatterns.com | #2782

Keith (http://www.keithdevens.com/) wrote:

Man, that's awesome. I had no clue that existed either.

Keith | 23-Aug-2003 8:40pm est | http://www.keithdevens.com/ | #2783

Mark (http://diveintomark.org/) wrote:

In Python, use the StringIO module (or cStringIO if available):

from StringIO import StringIO
stream = StringIO('foo')
print stream.read() # or whatever

∴ Mark | 23-Aug-2003 11:30pm est | http://diveintomark.org/ | #2784

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

March 2010
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

I hate ASP.NET

I hate ASP... I was doing wonders​with PHP, then suddenly one of my​clients...

Johnies: Mar 17, 6:14am

Quantum physics and free will

I knew you were going to say that....

Tom Massey: Mar 15, 9:26pm

Generated in about 0.115s.

(Used 8 db queries)