Add the following packages libalgorithm-diff-perl libspiffy-perl libtext-diff-perl...
[pkg-perl] / deb-src / libfilter-perl / libfilter-perl-1.34 / examples / filtdef
diff --git a/deb-src/libfilter-perl/libfilter-perl-1.34/examples/filtdef b/deb-src/libfilter-perl/libfilter-perl-1.34/examples/filtdef
new file mode 100755 (executable)
index 0000000..5128ec9
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+use strict ;
+use warnings ;
+
+my ($file, $output, $status) ;
+
+use Compress::Zlib ;
+
+die "Usage: mkdef file\n"
+    unless @ARGV == 1;
+
+foreach $file (@ARGV) 
+{
+    open (F, "<$file") or die "Cannot open $file: $!\n" ;
+    my $x = deflateInit()
+       or die "Cannot create a deflation stream\n" ;
+
+    print "use Filter::Decompress;\n" ;
+    while (<F>)
+    {
+        ($output, $status) = $x->deflate($_) ;
+    
+        $status == Z_OK
+            or die "deflation failed\n" ;
+    
+        print $output ;
+    }
+    
+    ($output, $status) = $x->flush() ;
+    
+    $status == Z_OK
+        or die "deflation failed\n" ;
+    
+    print $output ;
+    close F ;
+}