summaryrefslogtreecommitdiff
path: root/ext/Compress-Zlib/examples/gzstream
diff options
context:
space:
mode:
Diffstat (limited to 'ext/Compress-Zlib/examples/gzstream')
-rwxr-xr-xext/Compress-Zlib/examples/gzstream19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/Compress-Zlib/examples/gzstream b/ext/Compress-Zlib/examples/gzstream
new file mode 100755
index 0000000000..faacb0a0dd
--- /dev/null
+++ b/ext/Compress-Zlib/examples/gzstream
@@ -0,0 +1,19 @@
+#!/usr/local/bin/perl
+
+use strict ;
+use warnings ;
+
+use Compress::Zlib ;
+
+binmode STDOUT; # gzopen only sets it on the fd
+
+#my $gz = gzopen(\*STDOUT, "wb")
+my $gz = gzopen('-', "wb")
+ or die "Cannot open stdout: $gzerrno\n" ;
+
+while (<>) {
+ $gz->gzwrite($_)
+ or die "error writing: $gzerrno\n" ;
+}
+
+$gz->gzclose ;