| 1 | package Cikl::Smrt::Decoders::Gzip; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Cikl::Smrt::DecoderRole; | ||
| 6 | use Cikl::Smrt::AutoDecodableRole; | ||
| 7 | use namespace::autoclean; | ||
| 8 | use Mouse; | ||
| 9 | with 'Cikl::Smrt::DecoderRole'; | ||
| 10 | with 'Cikl::Smrt::AutoDecodableRole'; | ||
| 11 | |||
| 12 | use IO::Uncompress::Gunzip qw/gunzip $GunzipError/; | ||
| 13 | |||
| 14 | use constant MIME_TYPES => ( | ||
| 15 | 'application/x-gzip' | ||
| 16 | ); | ||
| 17 | sub mime_types { return MIME_TYPES; } | ||
| 18 | |||
| 19 | sub decode { | ||
| 20 | my $class = shift; | ||
| 21 | my $fh = shift; | ||
| 22 | my $gzfh = IO::Uncompress::Gunzip->new($fh, AutoClose => 1) or die($!); | ||
| 23 | return $gzfh; | ||
| 24 | } | ||
| 25 | |||
| 26 | __PACKAGE__->meta->make_immutable(); | ||
| 27 | |||
| 28 | 1; | ||
| 29 |