Upgrade to Unicode::Normalize 1.01
[p5sagit/p5-mst-13.2.git] / ext / Compress / IO / Zlib / lib / IO / Compress / RawDeflate.pm
CommitLineData
25f0751f 1package IO::Compress::RawDeflate ;
2
3# create RFC1951
4#
5use strict ;
6use warnings;
7use bytes;
8
9
10use IO::Compress::Base;
11use IO::Compress::Base::Common qw(:Status createSelfTiedObject);
12use IO::Compress::Adapter::Deflate ;
13
14require Exporter ;
15
16
17our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
18
c70c1701 19$VERSION = '2.000_12';
25f0751f 20$RawDeflateError = '';
21
22@ISA = qw(Exporter IO::Compress::Base);
23@EXPORT_OK = qw( $RawDeflateError rawdeflate ) ;
24push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
25
26%EXPORT_TAGS = ( flush => [qw{
27 Z_NO_FLUSH
28 Z_PARTIAL_FLUSH
29 Z_SYNC_FLUSH
30 Z_FULL_FLUSH
31 Z_FINISH
32 Z_BLOCK
33 }],
34 level => [qw{
35 Z_NO_COMPRESSION
36 Z_BEST_SPEED
37 Z_BEST_COMPRESSION
38 Z_DEFAULT_COMPRESSION
39 }],
40 strategy => [qw{
41 Z_FILTERED
42 Z_HUFFMAN_ONLY
43 Z_RLE
44 Z_FIXED
45 Z_DEFAULT_STRATEGY
46 }],
47
48 );
49
50{
51 my %seen;
52 foreach (keys %EXPORT_TAGS )
53 {
54 push @{$EXPORT_TAGS{constants}},
55 grep { !$seen{$_}++ }
56 @{ $EXPORT_TAGS{$_} }
57 }
58 $EXPORT_TAGS{all} = $EXPORT_TAGS{constants} ;
59}
60
61%DEFLATE_CONSTANTS = %EXPORT_TAGS;
62
63Exporter::export_ok_tags('all');
64
65
66
67sub new
68{
69 my $class = shift ;
70
71 my $obj = createSelfTiedObject($class, \$RawDeflateError);
72
73 return $obj->_create(undef, @_);
74}
75
76sub rawdeflate
77{
78 my $obj = createSelfTiedObject(undef, \$RawDeflateError);
79 return $obj->_def(@_);
80}
81
82sub ckParams
83{
84 my $self = shift ;
85 my $got = shift;
86
87 return 1 ;
88}
89
90sub mkComp
91{
92 my $self = shift ;
93 my $class = shift ;
94 my $got = shift ;
95
96 my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject(
97 $got->value('CRC32'),
98 $got->value('Adler32'),
99 $got->value('Level'),
100 $got->value('Strategy')
101 );
102
103 return $self->saveErrorString(undef, $errstr, $errno)
104 if ! defined $obj;
105
106 return $obj;
107}
108
109
110sub mkHeader
111{
112 my $self = shift ;
113 return '';
114}
115
116sub mkTrailer
117{
118 my $self = shift ;
119 return '';
120}
121
122sub mkFinalTrailer
123{
124 return '';
125}
126
127
128#sub newHeader
129#{
130# my $self = shift ;
131# return '';
132#}
133
134sub getExtraParams
135{
136 my $self = shift ;
137 return $self->getZlibParams();
138}
139
140sub getZlibParams
141{
142 my $self = shift ;
143
144 use IO::Compress::Base::Common qw(:Parse);
145 use Compress::Raw::Zlib qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
146
147
148 return (
149
150 # zlib behaviour
151 #'Method' => [0, 1, Parse_unsigned, Z_DEFLATED],
152 'Level' => [0, 1, Parse_signed, Z_DEFAULT_COMPRESSION],
153 'Strategy' => [0, 1, Parse_signed, Z_DEFAULT_STRATEGY],
154
155 'CRC32' => [0, 1, Parse_boolean, 0],
156 'ADLER32' => [0, 1, Parse_boolean, 0],
157 'Merge' => [1, 1, Parse_boolean, 0],
158 );
159
160
161}
162
163sub getInverseClass
164{
165 return ('IO::Uncompress::RawInflate',
166 \$IO::Uncompress::RawInflate::RawInflateError);
167}
168
169sub getFileInfo
170{
171 my $self = shift ;
172 my $params = shift;
173 my $file = shift ;
174
175}
176
177use IO::Seekable qw(SEEK_SET);
178
179sub createMerge
180{
181 my $self = shift ;
182 my $outValue = shift ;
183 my $outType = shift ;
184
185 my ($invClass, $error_ref) = $self->getInverseClass();
186 eval "require $invClass"
187 or die "aaaahhhh" ;
188
189 my $inf = $invClass->new( $outValue,
190 Transparent => 0,
191 #Strict => 1,
192 AutoClose => 0,
193 Scan => 1)
194 or return $self->saveErrorString(undef, "Cannot create InflateScan object: $$error_ref" ) ;
195
196 my $end_offset = 0;
197 $inf->scan()
198 or return $self->saveErrorString(undef, "Error Scanning: $$error_ref", $inf->errorNo) ;
199 $inf->zap($end_offset)
200 or return $self->saveErrorString(undef, "Error Zapping: $$error_ref", $inf->errorNo) ;
201
202 my $def = *$self->{Compress} = $inf->createDeflate();
203
204 *$self->{Header} = *$inf->{Info}{Header};
205 *$self->{UnCompSize_32bit} =
206 *$self->{BytesWritten} = *$inf->{UnCompSize_32bit} ;
207
208
209 if ( $outType eq 'buffer')
210 { substr( ${ *$self->{Buffer} }, $end_offset) = '' }
211 elsif ($outType eq 'handle' || $outType eq 'filename') {
212 *$self->{FH} = *$inf->{FH} ;
213 delete *$inf->{FH};
214 *$self->{FH}->flush() ;
215 *$self->{Handle} = 1 if $outType eq 'handle';
216
217 #seek(*$self->{FH}, $end_offset, SEEK_SET)
218 *$self->{FH}->seek($end_offset, SEEK_SET)
219 or return $self->saveErrorString(undef, $!, $!) ;
220 }
221
222 return $def ;
223}
224
225#### zlib specific methods
226
227sub deflateParams
228{
229 my $self = shift ;
230
231 my $level = shift ;
232 my $strategy = shift ;
233
234 my $status = *$self->{Compress}->deflateParams(Level => $level, Strategy => $strategy) ;
235 return $self->saveErrorString(0, *$self->{Compress}{Error}, *$self->{Compress}{ErrorNo})
236 if $status == STATUS_ERROR;
237
238 return 1;
239}
240
241
242
243
2441;
245
246__END__
247
248=head1 NAME
249
250
cb7abd7f 251
252IO::Compress::RawDeflate - Write RFC 1951 files/buffers
253
25f0751f 254
255
256=head1 SYNOPSIS
257
258 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
259
260
261 my $status = rawdeflate $input => $output [,OPTS]
262 or die "rawdeflate failed: $RawDeflateError\n";
263
264 my $z = new IO::Compress::RawDeflate $output [,OPTS]
265 or die "rawdeflate failed: $RawDeflateError\n";
266
267 $z->print($string);
268 $z->printf($format, $string);
269 $z->write($string);
270 $z->syswrite($string [, $length, $offset]);
271 $z->flush();
272 $z->tell();
273 $z->eof();
274 $z->seek($position, $whence);
275 $z->binmode();
276 $z->fileno();
277 $z->opened();
278 $z->autoflush();
279 $z->input_line_number();
280 $z->newStream( [OPTS] );
281
282 $z->deflateParams();
283
284 $z->close() ;
285
286 $RawDeflateError ;
287
288 # IO::File mode
289
290 print $z $string;
291 printf $z $format, $string;
292 tell $z
293 eof $z
294 seek $z, $position, $whence
295 binmode $z
296 fileno $z
297 close $z ;
298
299
300=head1 DESCRIPTION
301
302
303
304B<WARNING -- This is a Beta release>.
305
306=over 5
307
308=item * DO NOT use in production code.
309
310=item * The documentation is incomplete in places.
311
312=item * Parts of the interface defined here are tentative.
313
314=item * Please report any problems you find.
315
316=back
317
318
319
320
321This module provides a Perl interface that allows writing compressed
322data to files or buffer as defined in RFC 1951.
323
324
325
326
327
328Note that RFC 1951 data is not a good choice of compression format
329to use in isolation, especially if you want to auto-detect it.
330
331
332
333
334
335For reading RFC 1951 files/buffers, see the companion module
336L<IO::Uncompress::RawInflate|IO::Uncompress::RawInflate>.
337
338
339=head1 Functional Interface
340
341A top-level function, C<rawdeflate>, is provided to carry out
342"one-shot" compression between buffers and/or files. For finer
343control over the compression process, see the L</"OO Interface">
344section.
345
346 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
347
348 rawdeflate $input => $output [,OPTS]
349 or die "rawdeflate failed: $RawDeflateError\n";
350
351
352
353The functional interface needs Perl5.005 or better.
354
355
356=head2 rawdeflate $input => $output [, OPTS]
357
358
359C<rawdeflate> expects at least two parameters, C<$input> and C<$output>.
360
361=head3 The C<$input> parameter
362
363The parameter, C<$input>, is used to define the source of
364the uncompressed data.
365
366It can take one of the following forms:
367
368=over 5
369
370=item A filename
371
372If the C<$input> parameter is a simple scalar, it is assumed to be a
373filename. This file will be opened for reading and the input data
374will be read from it.
375
376=item A filehandle
377
378If the C<$input> parameter is a filehandle, the input data will be
379read from it.
380The string '-' can be used as an alias for standard input.
381
382=item A scalar reference
383
384If C<$input> is a scalar reference, the input data will be read
385from C<$$input>.
386
387=item An array reference
388
389If C<$input> is an array reference, each element in the array must be a
390filename.
391
392The input data will be read from each file in turn.
393
394The complete array will be walked to ensure that it only
395contains valid filenames before any data is compressed.
396
397
398
399=item An Input FileGlob string
400
401If C<$input> is a string that is delimited by the characters "<" and ">"
402C<rawdeflate> will assume that it is an I<input fileglob string>. The
403input is the list of files that match the fileglob.
404
405If the fileglob does not match any files ...
406
407See L<File::GlobMapper|File::GlobMapper> for more details.
408
409
410=back
411
412If the C<$input> parameter is any other type, C<undef> will be returned.
413
414
415
416=head3 The C<$output> parameter
417
418The parameter C<$output> is used to control the destination of the
419compressed data. This parameter can take one of these forms.
420
421=over 5
422
423=item A filename
424
425If the C<$output> parameter is a simple scalar, it is assumed to be a
426filename. This file will be opened for writing and the compressed
427data will be written to it.
428
429=item A filehandle
430
431If the C<$output> parameter is a filehandle, the compressed data
432will be written to it.
433The string '-' can be used as an alias for standard output.
434
435
436=item A scalar reference
437
438If C<$output> is a scalar reference, the compressed data will be
439stored in C<$$output>.
440
441
442
443=item An Array Reference
444
445If C<$output> is an array reference, the compressed data will be
446pushed onto the array.
447
448=item An Output FileGlob
449
450If C<$output> is a string that is delimited by the characters "<" and ">"
451C<rawdeflate> will assume that it is an I<output fileglob string>. The
452output is the list of files that match the fileglob.
453
454When C<$output> is an fileglob string, C<$input> must also be a fileglob
455string. Anything else is an error.
456
457=back
458
459If the C<$output> parameter is any other type, C<undef> will be returned.
460
461
462
463=head2 Notes
464
c70c1701 465
466
25f0751f 467When C<$input> maps to multiple files/buffers and C<$output> is a single
c70c1701 468file/buffer the input files/buffers will be stored
469in C<$output> as a concatenated series of compressed data streams.
470
471
472
25f0751f 473
474
475
476=head2 Optional Parameters
477
478Unless specified below, the optional parameters for C<rawdeflate>,
479C<OPTS>, are the same as those used with the OO interface defined in the
480L</"Constructor Options"> section below.
481
482=over 5
483
484=item AutoClose =E<gt> 0|1
485
486This option applies to any input or output data streams to
487C<rawdeflate> that are filehandles.
488
489If C<AutoClose> is specified, and the value is true, it will result in all
490input and/or output filehandles being closed once C<rawdeflate> has
491completed.
492
493This parameter defaults to 0.
494
495
496
497=item BinModeIn =E<gt> 0|1
498
499When reading from a file or filehandle, set C<binmode> before reading.
500
501Defaults to 0.
502
503
504
505
506
507=item -Append =E<gt> 0|1
508
509TODO
510
511
512=back
513
514
515
516=head2 Examples
517
518To read the contents of the file C<file1.txt> and write the compressed
519data to the file C<file1.txt.1951>.
520
521 use strict ;
522 use warnings ;
523 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
524
525 my $input = "file1.txt";
526 rawdeflate $input => "$input.1951"
527 or die "rawdeflate failed: $RawDeflateError\n";
528
529
530To read from an existing Perl filehandle, C<$input>, and write the
531compressed data to a buffer, C<$buffer>.
532
533 use strict ;
534 use warnings ;
535 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
536 use IO::File ;
537
538 my $input = new IO::File "<file1.txt"
539 or die "Cannot open 'file1.txt': $!\n" ;
540 my $buffer ;
541 rawdeflate $input => \$buffer
542 or die "rawdeflate failed: $RawDeflateError\n";
543
544To compress all files in the directory "/my/home" that match "*.txt"
545and store the compressed data in the same directory
546
547 use strict ;
548 use warnings ;
549 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
550
551 rawdeflate '</my/home/*.txt>' => '<*.1951>'
552 or die "rawdeflate failed: $RawDeflateError\n";
553
554and if you want to compress each file one at a time, this will do the trick
555
556 use strict ;
557 use warnings ;
558 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
559
560 for my $input ( glob "/my/home/*.txt" )
561 {
562 my $output = "$input.1951" ;
563 rawdeflate $input => $output
564 or die "Error compressing '$input': $RawDeflateError\n";
565 }
566
567
568=head1 OO Interface
569
570=head2 Constructor
571
572The format of the constructor for C<IO::Compress::RawDeflate> is shown below
573
574 my $z = new IO::Compress::RawDeflate $output [,OPTS]
575 or die "IO::Compress::RawDeflate failed: $RawDeflateError\n";
576
577It returns an C<IO::Compress::RawDeflate> object on success and undef on failure.
578The variable C<$RawDeflateError> will contain an error message on failure.
579
580If you are running Perl 5.005 or better the object, C<$z>, returned from
581IO::Compress::RawDeflate can be used exactly like an L<IO::File|IO::File> filehandle.
582This means that all normal output file operations can be carried out
583with C<$z>.
584For example, to write to a compressed file/buffer you can use either of
585these forms
586
587 $z->print("hello world\n");
588 print $z "hello world\n";
589
590The mandatory parameter C<$output> is used to control the destination
591of the compressed data. This parameter can take one of these forms.
592
593=over 5
594
595=item A filename
596
597If the C<$output> parameter is a simple scalar, it is assumed to be a
598filename. This file will be opened for writing and the compressed data
599will be written to it.
600
601=item A filehandle
602
603If the C<$output> parameter is a filehandle, the compressed data will be
604written to it.
605The string '-' can be used as an alias for standard output.
606
607
608=item A scalar reference
609
610If C<$output> is a scalar reference, the compressed data will be stored
611in C<$$output>.
612
613=back
614
615If the C<$output> parameter is any other type, C<IO::Compress::RawDeflate>::new will
616return undef.
617
618=head2 Constructor Options
619
620C<OPTS> is any combination of the following options:
621
622=over 5
623
624=item AutoClose =E<gt> 0|1
625
626This option is only valid when the C<$output> parameter is a filehandle. If
627specified, and the value is true, it will result in the C<$output> being
628closed once either the C<close> method is called or the C<IO::Compress::RawDeflate>
629object is destroyed.
630
631This parameter defaults to 0.
632
633=item Append =E<gt> 0|1
634
635Opens C<$output> in append mode.
636
637The behaviour of this option is dependent on the type of C<$output>.
638
639=over 5
640
641=item * A Buffer
642
643If C<$output> is a buffer and C<Append> is enabled, all compressed data
644will be append to the end if C<$output>. Otherwise C<$output> will be
645cleared before any data is written to it.
646
647=item * A Filename
648
649If C<$output> is a filename and C<Append> is enabled, the file will be
650opened in append mode. Otherwise the contents of the file, if any, will be
651truncated before any compressed data is written to it.
652
653=item * A Filehandle
654
655If C<$output> is a filehandle, the file pointer will be positioned to the
656end of the file via a call to C<seek> before any compressed data is written
657to it. Otherwise the file pointer will not be moved.
658
659=back
660
661This parameter defaults to 0.
662
663
664
665
666
cb7abd7f 667=item Merge =E<gt> 0|1
25f0751f 668
669This option is used to compress input data and append it to an existing
670compressed data stream in C<$output>. The end result is a single compressed
671data stream stored in C<$output>.
672
673
674
675It is a fatal error to attempt to use this option when C<$output> is not an
676RFC 1951 data stream.
677
678
679
680There are a number of other limitations with the C<Merge> option:
681
682=over 5
683
684=item 1
685
686This module needs to have been built with zlib 1.2.1 or better to work. A
687fatal error will be thrown if C<Merge> is used with an older version of
688zlib.
689
690=item 2
691
692If C<$output> is a file or a filehandle, it must be seekable.
693
694=back
695
696
697This parameter defaults to 0.
698
699
700
701=item -Level
702
703Defines the compression level used by zlib. The value should either be
704a number between 0 and 9 (0 means no compression and 9 is maximum
705compression), or one of the symbolic constants defined below.
706
707 Z_NO_COMPRESSION
708 Z_BEST_SPEED
709 Z_BEST_COMPRESSION
710 Z_DEFAULT_COMPRESSION
711
712The default is Z_DEFAULT_COMPRESSION.
713
714Note, these constants are not imported by C<IO::Compress::RawDeflate> by default.
715
716 use IO::Compress::RawDeflate qw(:strategy);
717 use IO::Compress::RawDeflate qw(:constants);
718 use IO::Compress::RawDeflate qw(:all);
719
720=item -Strategy
721
722Defines the strategy used to tune the compression. Use one of the symbolic
723constants defined below.
724
725 Z_FILTERED
726 Z_HUFFMAN_ONLY
727 Z_RLE
728 Z_FIXED
729 Z_DEFAULT_STRATEGY
730
731The default is Z_DEFAULT_STRATEGY.
732
733
734
735
736
737
738=item -Strict =E<gt> 0|1
739
740
741
742This is a placeholder option.
743
744
745
746=back
747
748=head2 Examples
749
750TODO
751
752=head1 Methods
753
754=head2 print
755
756Usage is
757
758 $z->print($data)
759 print $z $data
760
761Compresses and outputs the contents of the C<$data> parameter. This
762has the same behaviour as the C<print> built-in.
763
764Returns true if successful.
765
766=head2 printf
767
768Usage is
769
770 $z->printf($format, $data)
771 printf $z $format, $data
772
773Compresses and outputs the contents of the C<$data> parameter.
774
775Returns true if successful.
776
777=head2 syswrite
778
779Usage is
780
781 $z->syswrite $data
782 $z->syswrite $data, $length
783 $z->syswrite $data, $length, $offset
784
785Compresses and outputs the contents of the C<$data> parameter.
786
787Returns the number of uncompressed bytes written, or C<undef> if
788unsuccessful.
789
790=head2 write
791
792Usage is
793
794 $z->write $data
795 $z->write $data, $length
796 $z->write $data, $length, $offset
797
798Compresses and outputs the contents of the C<$data> parameter.
799
800Returns the number of uncompressed bytes written, or C<undef> if
801unsuccessful.
802
803=head2 flush
804
805Usage is
806
807
808 $z->flush;
809 $z->flush($flush_type);
810
811
812Flushes any pending compressed data to the output file/buffer.
813
814
815This method takes an optional parameter, C<$flush_type>, that controls
816how the flushing will be carried out. By default the C<$flush_type>
817used is C<Z_FINISH>. Other valid values for C<$flush_type> are
818C<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It is
819strongly recommended that you only set the C<flush_type> parameter if
820you fully understand the implications of what it does - overuse of C<flush>
821can seriously degrade the level of compression achieved. See the C<zlib>
822documentation for details.
823
824
825Returns true on success.
826
827
828=head2 tell
829
830Usage is
831
832 $z->tell()
833 tell $z
834
835Returns the uncompressed file offset.
836
837=head2 eof
838
839Usage is
840
841 $z->eof();
842 eof($z);
843
844
845
846Returns true if the C<close> method has been called.
847
848
849
850=head2 seek
851
852 $z->seek($position, $whence);
853 seek($z, $position, $whence);
854
855
856
857
858Provides a sub-set of the C<seek> functionality, with the restriction
859that it is only legal to seek forward in the output file/buffer.
860It is a fatal error to attempt to seek backward.
861
862Empty parts of the file/buffer will have NULL (0x00) bytes written to them.
863
864
865
866The C<$whence> parameter takes one the usual values, namely SEEK_SET,
867SEEK_CUR or SEEK_END.
868
869Returns 1 on success, 0 on failure.
870
871=head2 binmode
872
873Usage is
874
875 $z->binmode
876 binmode $z ;
877
878This is a noop provided for completeness.
879
880=head2 opened
881
882 $z->opened()
883
884Returns true if the object currently refers to a opened file/buffer.
885
886=head2 autoflush
887
888 my $prev = $z->autoflush()
889 my $prev = $z->autoflush(EXPR)
890
891If the C<$z> object is associated with a file or a filehandle, this method
892returns the current autoflush setting for the underlying filehandle. If
893C<EXPR> is present, and is non-zero, it will enable flushing after every
894write/print operation.
895
896If C<$z> is associated with a buffer, this method has no effect and always
897returns C<undef>.
898
899B<Note> that the special variable C<$|> B<cannot> be used to set or
900retrieve the autoflush setting.
901
902=head2 input_line_number
903
904 $z->input_line_number()
905 $z->input_line_number(EXPR)
906
907
908This method always returns C<undef> when compressing.
909
910
911
912=head2 fileno
913
914 $z->fileno()
915 fileno($z)
916
917If the C<$z> object is associated with a file or a filehandle, this method
918will return the underlying file descriptor.
919
920If the C<$z> object is is associated with a buffer, this method will
921return undef.
922
923=head2 close
924
925 $z->close() ;
926 close $z ;
927
928
929
930Flushes any pending compressed data and then closes the output file/buffer.
931
932
933
934For most versions of Perl this method will be automatically invoked if
935the IO::Compress::RawDeflate object is destroyed (either explicitly or by the
936variable with the reference to the object going out of scope). The
937exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
938these cases, the C<close> method will be called automatically, but
939not until global destruction of all live objects when the program is
940terminating.
941
942Therefore, if you want your scripts to be able to run on all versions
943of Perl, you should call C<close> explicitly and not rely on automatic
944closing.
945
946Returns true on success, otherwise 0.
947
948If the C<AutoClose> option has been enabled when the IO::Compress::RawDeflate
949object was created, and the object is associated with a file, the
950underlying file will also be closed.
951
952
953
954
955=head2 newStream([OPTS])
956
957Usage is
958
959 $z->newStream( [OPTS] )
960
961Closes the current compressed data stream and starts a new one.
962
963OPTS consists of the following sub-set of the the options that are
964available when creating the C<$z> object,
965
966=over 5
967
968
969
970=item * Level
971
972
973
974=back
975
976
977=head2 deflateParams
978
979Usage is
980
981 $z->deflateParams
982
983TODO
984
985
986=head1 Importing
987
988
989A number of symbolic constants are required by some methods in
990C<IO::Compress::RawDeflate>. None are imported by default.
991
992
993
994=over 5
995
996=item :all
997
998
999Imports C<rawdeflate>, C<$RawDeflateError> and all symbolic
1000constants that can be used by C<IO::Compress::RawDeflate>. Same as doing this
1001
1002 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError :constants) ;
1003
1004=item :constants
1005
1006Import all symbolic constants. Same as doing this
1007
2b4e0969 1008
25f0751f 1009 use IO::Compress::RawDeflate qw(:flush :level :strategy) ;
1010
2b4e0969 1011
25f0751f 1012=item :flush
1013
1014These symbolic constants are used by the C<flush> method.
1015
1016 Z_NO_FLUSH
1017 Z_PARTIAL_FLUSH
1018 Z_SYNC_FLUSH
1019 Z_FULL_FLUSH
1020 Z_FINISH
1021 Z_BLOCK
1022
1023=item :level
1024
1025These symbolic constants are used by the C<Level> option in the constructor.
1026
1027 Z_NO_COMPRESSION
1028 Z_BEST_SPEED
1029 Z_BEST_COMPRESSION
1030 Z_DEFAULT_COMPRESSION
1031
1032
1033=item :strategy
1034
1035These symbolic constants are used by the C<Strategy> option in the constructor.
1036
1037 Z_FILTERED
1038 Z_HUFFMAN_ONLY
1039 Z_RLE
1040 Z_FIXED
1041 Z_DEFAULT_STRATEGY
2b4e0969 1042
1043
25f0751f 1044
1045
1046=back
1047
1048For
1049
1050=head1 EXAMPLES
1051
1052TODO
1053
1054
1055
1056
1057
1058
1059=head1 SEE ALSO
1060
1061L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
1062
1063L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
1064
1065L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
1066L<Archive::Tar|Archive::Tar>,
1067L<IO::Zlib|IO::Zlib>
1068
1069
1070For RFC 1950, 1951 and 1952 see
1071F<http://www.faqs.org/rfcs/rfc1950.html>,
1072F<http://www.faqs.org/rfcs/rfc1951.html> and
1073F<http://www.faqs.org/rfcs/rfc1952.html>
1074
1075The I<zlib> compression library was written by Jean-loup Gailly
1076F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
1077
1078The primary site for the I<zlib> compression library is
1079F<http://www.zlib.org>.
1080
1081The primary site for gzip is F<http://www.gzip.org>.
1082
1083
1084
1085
25f0751f 1086=head1 AUTHOR
1087
cb7abd7f 1088This module was written by Paul Marquess, F<pmqs@cpan.org>.
25f0751f 1089
1090
1091
1092=head1 MODIFICATION HISTORY
1093
1094See the Changes file.
1095
1096=head1 COPYRIGHT AND LICENSE
25f0751f 1097
1098Copyright (c) 2005-2006 Paul Marquess. All rights reserved.
1099
1100This program is free software; you can redistribute it and/or
1101modify it under the same terms as Perl itself.
1102
1103