Hey Malcolm,<br><br>If you&#39;re can have your contents in a file, you could get away with what you want by using mmap:<br><br>  $ dd if=/dev/urandom count=1000000 of=/tmp/randfile<br>
<br>-- 8&lt; --<br><br>#!/usr/bin/perl<br><br>use strict;<br>use warnings;<br><br>use IO::String;<br>use File::Map qw{<br>    map_file<br>    unmap<br>};<br><br>print_size();<br><br>map_file my $v, &quot;/tmp/randfile&quot;;<br>
print_size();<br><br>my $string = IO::String-&gt;new( $v );<br>print_size();<br><br>$string-&gt;getline();<br>print_size();<br><br>$string-&gt;close();<br>unmap( $v );<br>print_size();<br><br>sub print_size {<br>    open my $statm, &#39;&lt; /proc/self/statm&#39;<br>
        or die $!;<br><br>    my ( $size ) = split /\s/, &lt;$statm&gt;;<br>    $size *= 4096;<br><br>    print &quot;size: $size\n&quot;;<br>}<br><br>-- &gt;8 --<br><br>Output on a 512Mb file is:<br><br>  size: 21381120<br>
  size: 533381120<br>  size: 533381120<br>  size: 533381120<br>  size: 21381120<br><br>If you can&#39;t put the contents in a file, you might still be able to get away with using mmap but you&#39;ll have to play with Sys::Mmap (don&#39;t give new() the OPTIONALFILENAME param).<br>
<br>Alfie<br><br><div class="gmail_quote">On Sat, Sep 11, 2010 at 8:03 AM, Malcolm Herbert <span dir="ltr">&lt;<a href="mailto:melbourne-pm@mjch.net">melbourne-pm@mjch.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sent again from the correct address ...<br>
<br>
On Sat, 11 Sep 2010 07:23 +1000, &quot;Malcolm Herbert&quot; &lt;<a href="mailto:mjch@mjch.net">mjch@mjch.net</a>&gt;<br>
wrote:<br>
&gt; I want to be able to use an IO::String file handle interface in order to<br>
&gt; interact with one particular class, however I don&#39;t want all the data I<br>
&gt; shove into the string to remain hanging around but be able to be retired<br>
&gt; without closing and re-opening the handle - is there a way to do this?<br>
&gt;<br>
&gt; I have tried to resize the underlying tied variable with substr and<br>
&gt; remove the aging data that way however this seems to remove the<br>
&gt; association with the original tied variable ... plus leads to problems if<br>
&gt; the class I&#39;m using keeps internal state about the handle ...<br>
&gt;<br>
&gt; Regards,<br>
&gt; Malcolm<br>
<font color="#888888"><br>
--<br>
Malcolm Herbert                                This brain intentionally<br>
<a href="mailto:mjch@mjch.net">mjch@mjch.net</a>                                                left blank<br>
<br>
_______________________________________________<br>
Melbourne-pm mailing list<br>
<a href="mailto:Melbourne-pm@pm.org">Melbourne-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/melbourne-pm" target="_blank">http://mail.pm.org/mailman/listinfo/melbourne-pm</a><br>
</font></blockquote></div><br>