Finally, this "Negative repeat count" warning wasn't such a great
[p5sagit/p5-mst-13.2.git] / t / lib / TieOut.pm
index aa49465..072e8fd 100644 (file)
@@ -9,11 +9,15 @@ sub PRINT {
        $$self .= join('', @_);
 }
 
+sub PRINTF {
+       my $self = shift;
+    my $fmt  = shift;
+       $$self .= sprintf $fmt, @_;
+}
+
 sub read {
        my $self = shift;
-    my $out = $$self;
-    $$self = '';
-       return $out;
+       return substr($$self, 0, length($$self), '');
 }
 
 1;