File Coverage

blib/lib/File/Extract/Plain.pm
Criterion Covered Total %
statement 13 13 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 4 4 100.0
pod 2 2 100.0
total 21 24 87.5


line stmt bran cond sub pod time code
1             # $Id: /mirror/perl/File-Extract/trunk/lib/File/Extract/Plain.pm 4210 2007-10-27T13:43:07.499967Z daisuke $
2             #
3             # Copyright (c) 2005 Daisuke Maki
4             # All rights reserved.
5              
6             package File::Extract::Plain;
7 2     2   19 use strict;
  2         3  
  2         138  
8 2     2   14 use base qw(File::Extract::Base);
  2         4  
  2         570  
9              
10 3     3 1 29244 sub mime_type { 'text/plain' }
11             sub extract
12             {
13 1     1 1 3 my $self = shift;
14 1         3 my $file = shift;
15              
16 1 50       43 open(F, $file) or Carp::croak("Failed to open file $file: $!");
17 1         9 local $/ = undef;
18 1         24 my $text = scalar();
19             my $r = File::Extract::Result->new(
20 1   33     3 text => eval { $self->recode($text) } || $text,
21             mime_type => $self->mime_type,
22             filename => $file,
23             );
24             }
25              
26             1;
27              
28             __END__