require should ignore directories found when searching @INC not just
[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
19$VERSION = '2.000_08';
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
251IO::Compress::RawDeflate - Perl interface to write RFC 1951 files/buffers
252
253
254=head1 SYNOPSIS
255
256 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
257
258
259 my $status = rawdeflate $input => $output [,OPTS]
260 or die "rawdeflate failed: $RawDeflateError\n";
261
262 my $z = new IO::Compress::RawDeflate $output [,OPTS]
263 or die "rawdeflate failed: $RawDeflateError\n";
264
265 $z->print($string);
266 $z->printf($format, $string);
267 $z->write($string);
268 $z->syswrite($string [, $length, $offset]);
269 $z->flush();
270 $z->tell();
271 $z->eof();
272 $z->seek($position, $whence);
273 $z->binmode();
274 $z->fileno();
275 $z->opened();
276 $z->autoflush();
277 $z->input_line_number();
278 $z->newStream( [OPTS] );
279
280 $z->deflateParams();
281
282 $z->close() ;
283
284 $RawDeflateError ;
285
286 # IO::File mode
287
288 print $z $string;
289 printf $z $format, $string;
290 tell $z
291 eof $z
292 seek $z, $position, $whence
293 binmode $z
294 fileno $z
295 close $z ;
296
297
298=head1 DESCRIPTION
299
300
301
302B<WARNING -- This is a Beta release>.
303
304=over 5
305
306=item * DO NOT use in production code.
307
308=item * The documentation is incomplete in places.
309
310=item * Parts of the interface defined here are tentative.
311
312=item * Please report any problems you find.
313
314=back
315
316
317
318
319This module provides a Perl interface that allows writing compressed
320data to files or buffer as defined in RFC 1951.
321
322
323
324
325
326Note that RFC 1951 data is not a good choice of compression format
327to use in isolation, especially if you want to auto-detect it.
328
329
330
331
332
333For reading RFC 1951 files/buffers, see the companion module
334L<IO::Uncompress::RawInflate|IO::Uncompress::RawInflate>.
335
336
337=head1 Functional Interface
338
339A top-level function, C<rawdeflate>, is provided to carry out
340"one-shot" compression between buffers and/or files. For finer
341control over the compression process, see the L</"OO Interface">
342section.
343
344 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
345
346 rawdeflate $input => $output [,OPTS]
347 or die "rawdeflate failed: $RawDeflateError\n";
348
349
350
351The functional interface needs Perl5.005 or better.
352
353
354=head2 rawdeflate $input => $output [, OPTS]
355
356
357C<rawdeflate> expects at least two parameters, C<$input> and C<$output>.
358
359=head3 The C<$input> parameter
360
361The parameter, C<$input>, is used to define the source of
362the uncompressed data.
363
364It can take one of the following forms:
365
366=over 5
367
368=item A filename
369
370If the C<$input> parameter is a simple scalar, it is assumed to be a
371filename. This file will be opened for reading and the input data
372will be read from it.
373
374=item A filehandle
375
376If the C<$input> parameter is a filehandle, the input data will be
377read from it.
378The string '-' can be used as an alias for standard input.
379
380=item A scalar reference
381
382If C<$input> is a scalar reference, the input data will be read
383from C<$$input>.
384
385=item An array reference
386
387If C<$input> is an array reference, each element in the array must be a
388filename.
389
390The input data will be read from each file in turn.
391
392The complete array will be walked to ensure that it only
393contains valid filenames before any data is compressed.
394
395
396
397=item An Input FileGlob string
398
399If C<$input> is a string that is delimited by the characters "<" and ">"
400C<rawdeflate> will assume that it is an I<input fileglob string>. The
401input is the list of files that match the fileglob.
402
403If the fileglob does not match any files ...
404
405See L<File::GlobMapper|File::GlobMapper> for more details.
406
407
408=back
409
410If the C<$input> parameter is any other type, C<undef> will be returned.
411
412
413
414=head3 The C<$output> parameter
415
416The parameter C<$output> is used to control the destination of the
417compressed data. This parameter can take one of these forms.
418
419=over 5
420
421=item A filename
422
423If the C<$output> parameter is a simple scalar, it is assumed to be a
424filename. This file will be opened for writing and the compressed
425data will be written to it.
426
427=item A filehandle
428
429If the C<$output> parameter is a filehandle, the compressed data
430will be written to it.
431The string '-' can be used as an alias for standard output.
432
433
434=item A scalar reference
435
436If C<$output> is a scalar reference, the compressed data will be
437stored in C<$$output>.
438
439
440
441=item An Array Reference
442
443If C<$output> is an array reference, the compressed data will be
444pushed onto the array.
445
446=item An Output FileGlob
447
448If C<$output> is a string that is delimited by the characters "<" and ">"
449C<rawdeflate> will assume that it is an I<output fileglob string>. The
450output is the list of files that match the fileglob.
451
452When C<$output> is an fileglob string, C<$input> must also be a fileglob
453string. Anything else is an error.
454
455=back
456
457If the C<$output> parameter is any other type, C<undef> will be returned.
458
459
460
461=head2 Notes
462
463When C<$input> maps to multiple files/buffers and C<$output> is a single
464file/buffer the compressed input files/buffers will all be stored
465in C<$output> as a single compressed stream.
466
467
468
469=head2 Optional Parameters
470
471Unless specified below, the optional parameters for C<rawdeflate>,
472C<OPTS>, are the same as those used with the OO interface defined in the
473L</"Constructor Options"> section below.
474
475=over 5
476
477=item AutoClose =E<gt> 0|1
478
479This option applies to any input or output data streams to
480C<rawdeflate> that are filehandles.
481
482If C<AutoClose> is specified, and the value is true, it will result in all
483input and/or output filehandles being closed once C<rawdeflate> has
484completed.
485
486This parameter defaults to 0.
487
488
489
490=item BinModeIn =E<gt> 0|1
491
492When reading from a file or filehandle, set C<binmode> before reading.
493
494Defaults to 0.
495
496
497
498
499
500=item -Append =E<gt> 0|1
501
502TODO
503
504
505=back
506
507
508
509=head2 Examples
510
511To read the contents of the file C<file1.txt> and write the compressed
512data to the file C<file1.txt.1951>.
513
514 use strict ;
515 use warnings ;
516 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
517
518 my $input = "file1.txt";
519 rawdeflate $input => "$input.1951"
520 or die "rawdeflate failed: $RawDeflateError\n";
521
522
523To read from an existing Perl filehandle, C<$input>, and write the
524compressed data to a buffer, C<$buffer>.
525
526 use strict ;
527 use warnings ;
528 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
529 use IO::File ;
530
531 my $input = new IO::File "<file1.txt"
532 or die "Cannot open 'file1.txt': $!\n" ;
533 my $buffer ;
534 rawdeflate $input => \$buffer
535 or die "rawdeflate failed: $RawDeflateError\n";
536
537To compress all files in the directory "/my/home" that match "*.txt"
538and store the compressed data in the same directory
539
540 use strict ;
541 use warnings ;
542 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
543
544 rawdeflate '</my/home/*.txt>' => '<*.1951>'
545 or die "rawdeflate failed: $RawDeflateError\n";
546
547and if you want to compress each file one at a time, this will do the trick
548
549 use strict ;
550 use warnings ;
551 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError) ;
552
553 for my $input ( glob "/my/home/*.txt" )
554 {
555 my $output = "$input.1951" ;
556 rawdeflate $input => $output
557 or die "Error compressing '$input': $RawDeflateError\n";
558 }
559
560
561=head1 OO Interface
562
563=head2 Constructor
564
565The format of the constructor for C<IO::Compress::RawDeflate> is shown below
566
567 my $z = new IO::Compress::RawDeflate $output [,OPTS]
568 or die "IO::Compress::RawDeflate failed: $RawDeflateError\n";
569
570It returns an C<IO::Compress::RawDeflate> object on success and undef on failure.
571The variable C<$RawDeflateError> will contain an error message on failure.
572
573If you are running Perl 5.005 or better the object, C<$z>, returned from
574IO::Compress::RawDeflate can be used exactly like an L<IO::File|IO::File> filehandle.
575This means that all normal output file operations can be carried out
576with C<$z>.
577For example, to write to a compressed file/buffer you can use either of
578these forms
579
580 $z->print("hello world\n");
581 print $z "hello world\n";
582
583The mandatory parameter C<$output> is used to control the destination
584of the compressed data. This parameter can take one of these forms.
585
586=over 5
587
588=item A filename
589
590If the C<$output> parameter is a simple scalar, it is assumed to be a
591filename. This file will be opened for writing and the compressed data
592will be written to it.
593
594=item A filehandle
595
596If the C<$output> parameter is a filehandle, the compressed data will be
597written to it.
598The string '-' can be used as an alias for standard output.
599
600
601=item A scalar reference
602
603If C<$output> is a scalar reference, the compressed data will be stored
604in C<$$output>.
605
606=back
607
608If the C<$output> parameter is any other type, C<IO::Compress::RawDeflate>::new will
609return undef.
610
611=head2 Constructor Options
612
613C<OPTS> is any combination of the following options:
614
615=over 5
616
617=item AutoClose =E<gt> 0|1
618
619This option is only valid when the C<$output> parameter is a filehandle. If
620specified, and the value is true, it will result in the C<$output> being
621closed once either the C<close> method is called or the C<IO::Compress::RawDeflate>
622object is destroyed.
623
624This parameter defaults to 0.
625
626=item Append =E<gt> 0|1
627
628Opens C<$output> in append mode.
629
630The behaviour of this option is dependent on the type of C<$output>.
631
632=over 5
633
634=item * A Buffer
635
636If C<$output> is a buffer and C<Append> is enabled, all compressed data
637will be append to the end if C<$output>. Otherwise C<$output> will be
638cleared before any data is written to it.
639
640=item * A Filename
641
642If C<$output> is a filename and C<Append> is enabled, the file will be
643opened in append mode. Otherwise the contents of the file, if any, will be
644truncated before any compressed data is written to it.
645
646=item * A Filehandle
647
648If C<$output> is a filehandle, the file pointer will be positioned to the
649end of the file via a call to C<seek> before any compressed data is written
650to it. Otherwise the file pointer will not be moved.
651
652=back
653
654This parameter defaults to 0.
655
656
657
658
659
660=item -Merge =E<gt> 0|1
661
662This option is used to compress input data and append it to an existing
663compressed data stream in C<$output>. The end result is a single compressed
664data stream stored in C<$output>.
665
666
667
668It is a fatal error to attempt to use this option when C<$output> is not an
669RFC 1951 data stream.
670
671
672
673There are a number of other limitations with the C<Merge> option:
674
675=over 5
676
677=item 1
678
679This module needs to have been built with zlib 1.2.1 or better to work. A
680fatal error will be thrown if C<Merge> is used with an older version of
681zlib.
682
683=item 2
684
685If C<$output> is a file or a filehandle, it must be seekable.
686
687=back
688
689
690This parameter defaults to 0.
691
692
693
694=item -Level
695
696Defines the compression level used by zlib. The value should either be
697a number between 0 and 9 (0 means no compression and 9 is maximum
698compression), or one of the symbolic constants defined below.
699
700 Z_NO_COMPRESSION
701 Z_BEST_SPEED
702 Z_BEST_COMPRESSION
703 Z_DEFAULT_COMPRESSION
704
705The default is Z_DEFAULT_COMPRESSION.
706
707Note, these constants are not imported by C<IO::Compress::RawDeflate> by default.
708
709 use IO::Compress::RawDeflate qw(:strategy);
710 use IO::Compress::RawDeflate qw(:constants);
711 use IO::Compress::RawDeflate qw(:all);
712
713=item -Strategy
714
715Defines the strategy used to tune the compression. Use one of the symbolic
716constants defined below.
717
718 Z_FILTERED
719 Z_HUFFMAN_ONLY
720 Z_RLE
721 Z_FIXED
722 Z_DEFAULT_STRATEGY
723
724The default is Z_DEFAULT_STRATEGY.
725
726
727
728
729
730
731=item -Strict =E<gt> 0|1
732
733
734
735This is a placeholder option.
736
737
738
739=back
740
741=head2 Examples
742
743TODO
744
745=head1 Methods
746
747=head2 print
748
749Usage is
750
751 $z->print($data)
752 print $z $data
753
754Compresses and outputs the contents of the C<$data> parameter. This
755has the same behaviour as the C<print> built-in.
756
757Returns true if successful.
758
759=head2 printf
760
761Usage is
762
763 $z->printf($format, $data)
764 printf $z $format, $data
765
766Compresses and outputs the contents of the C<$data> parameter.
767
768Returns true if successful.
769
770=head2 syswrite
771
772Usage is
773
774 $z->syswrite $data
775 $z->syswrite $data, $length
776 $z->syswrite $data, $length, $offset
777
778Compresses and outputs the contents of the C<$data> parameter.
779
780Returns the number of uncompressed bytes written, or C<undef> if
781unsuccessful.
782
783=head2 write
784
785Usage is
786
787 $z->write $data
788 $z->write $data, $length
789 $z->write $data, $length, $offset
790
791Compresses and outputs the contents of the C<$data> parameter.
792
793Returns the number of uncompressed bytes written, or C<undef> if
794unsuccessful.
795
796=head2 flush
797
798Usage is
799
800
801 $z->flush;
802 $z->flush($flush_type);
803
804
805Flushes any pending compressed data to the output file/buffer.
806
807
808This method takes an optional parameter, C<$flush_type>, that controls
809how the flushing will be carried out. By default the C<$flush_type>
810used is C<Z_FINISH>. Other valid values for C<$flush_type> are
811C<Z_NO_FLUSH>, C<Z_SYNC_FLUSH>, C<Z_FULL_FLUSH> and C<Z_BLOCK>. It is
812strongly recommended that you only set the C<flush_type> parameter if
813you fully understand the implications of what it does - overuse of C<flush>
814can seriously degrade the level of compression achieved. See the C<zlib>
815documentation for details.
816
817
818Returns true on success.
819
820
821=head2 tell
822
823Usage is
824
825 $z->tell()
826 tell $z
827
828Returns the uncompressed file offset.
829
830=head2 eof
831
832Usage is
833
834 $z->eof();
835 eof($z);
836
837
838
839Returns true if the C<close> method has been called.
840
841
842
843=head2 seek
844
845 $z->seek($position, $whence);
846 seek($z, $position, $whence);
847
848
849
850
851Provides a sub-set of the C<seek> functionality, with the restriction
852that it is only legal to seek forward in the output file/buffer.
853It is a fatal error to attempt to seek backward.
854
855Empty parts of the file/buffer will have NULL (0x00) bytes written to them.
856
857
858
859The C<$whence> parameter takes one the usual values, namely SEEK_SET,
860SEEK_CUR or SEEK_END.
861
862Returns 1 on success, 0 on failure.
863
864=head2 binmode
865
866Usage is
867
868 $z->binmode
869 binmode $z ;
870
871This is a noop provided for completeness.
872
873=head2 opened
874
875 $z->opened()
876
877Returns true if the object currently refers to a opened file/buffer.
878
879=head2 autoflush
880
881 my $prev = $z->autoflush()
882 my $prev = $z->autoflush(EXPR)
883
884If the C<$z> object is associated with a file or a filehandle, this method
885returns the current autoflush setting for the underlying filehandle. If
886C<EXPR> is present, and is non-zero, it will enable flushing after every
887write/print operation.
888
889If C<$z> is associated with a buffer, this method has no effect and always
890returns C<undef>.
891
892B<Note> that the special variable C<$|> B<cannot> be used to set or
893retrieve the autoflush setting.
894
895=head2 input_line_number
896
897 $z->input_line_number()
898 $z->input_line_number(EXPR)
899
900
901This method always returns C<undef> when compressing.
902
903
904
905=head2 fileno
906
907 $z->fileno()
908 fileno($z)
909
910If the C<$z> object is associated with a file or a filehandle, this method
911will return the underlying file descriptor.
912
913If the C<$z> object is is associated with a buffer, this method will
914return undef.
915
916=head2 close
917
918 $z->close() ;
919 close $z ;
920
921
922
923Flushes any pending compressed data and then closes the output file/buffer.
924
925
926
927For most versions of Perl this method will be automatically invoked if
928the IO::Compress::RawDeflate object is destroyed (either explicitly or by the
929variable with the reference to the object going out of scope). The
930exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
931these cases, the C<close> method will be called automatically, but
932not until global destruction of all live objects when the program is
933terminating.
934
935Therefore, if you want your scripts to be able to run on all versions
936of Perl, you should call C<close> explicitly and not rely on automatic
937closing.
938
939Returns true on success, otherwise 0.
940
941If the C<AutoClose> option has been enabled when the IO::Compress::RawDeflate
942object was created, and the object is associated with a file, the
943underlying file will also be closed.
944
945
946
947
948=head2 newStream([OPTS])
949
950Usage is
951
952 $z->newStream( [OPTS] )
953
954Closes the current compressed data stream and starts a new one.
955
956OPTS consists of the following sub-set of the the options that are
957available when creating the C<$z> object,
958
959=over 5
960
961
962
963=item * Level
964
965
966
967=back
968
969
970=head2 deflateParams
971
972Usage is
973
974 $z->deflateParams
975
976TODO
977
978
979=head1 Importing
980
981
982A number of symbolic constants are required by some methods in
983C<IO::Compress::RawDeflate>. None are imported by default.
984
985
986
987=over 5
988
989=item :all
990
991
992Imports C<rawdeflate>, C<$RawDeflateError> and all symbolic
993constants that can be used by C<IO::Compress::RawDeflate>. Same as doing this
994
995 use IO::Compress::RawDeflate qw(rawdeflate $RawDeflateError :constants) ;
996
997=item :constants
998
999Import all symbolic constants. Same as doing this
1000
1001 use IO::Compress::RawDeflate qw(:flush :level :strategy) ;
1002
1003=item :flush
1004
1005These symbolic constants are used by the C<flush> method.
1006
1007 Z_NO_FLUSH
1008 Z_PARTIAL_FLUSH
1009 Z_SYNC_FLUSH
1010 Z_FULL_FLUSH
1011 Z_FINISH
1012 Z_BLOCK
1013
1014=item :level
1015
1016These symbolic constants are used by the C<Level> option in the constructor.
1017
1018 Z_NO_COMPRESSION
1019 Z_BEST_SPEED
1020 Z_BEST_COMPRESSION
1021 Z_DEFAULT_COMPRESSION
1022
1023
1024=item :strategy
1025
1026These symbolic constants are used by the C<Strategy> option in the constructor.
1027
1028 Z_FILTERED
1029 Z_HUFFMAN_ONLY
1030 Z_RLE
1031 Z_FIXED
1032 Z_DEFAULT_STRATEGY
1033
1034
1035=back
1036
1037For
1038
1039=head1 EXAMPLES
1040
1041TODO
1042
1043
1044
1045
1046
1047
1048=head1 SEE ALSO
1049
1050L<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>
1051
1052L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
1053
1054L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
1055L<Archive::Tar|Archive::Tar>,
1056L<IO::Zlib|IO::Zlib>
1057
1058
1059For RFC 1950, 1951 and 1952 see
1060F<http://www.faqs.org/rfcs/rfc1950.html>,
1061F<http://www.faqs.org/rfcs/rfc1951.html> and
1062F<http://www.faqs.org/rfcs/rfc1952.html>
1063
1064The I<zlib> compression library was written by Jean-loup Gailly
1065F<gzip@prep.ai.mit.edu> and Mark Adler F<madler@alumni.caltech.edu>.
1066
1067The primary site for the I<zlib> compression library is
1068F<http://www.zlib.org>.
1069
1070The primary site for gzip is F<http://www.gzip.org>.
1071
1072
1073
1074
1075
1076
1077
1078=head1 AUTHOR
1079
1080The I<IO::Compress::RawDeflate> module was written by Paul Marquess,
1081F<pmqs@cpan.org>.
1082
1083
1084
1085=head1 MODIFICATION HISTORY
1086
1087See the Changes file.
1088
1089=head1 COPYRIGHT AND LICENSE
1090
1091
1092Copyright (c) 2005-2006 Paul Marquess. All rights reserved.
1093
1094This program is free software; you can redistribute it and/or
1095modify it under the same terms as Perl itself.
1096
1097