File Coverage

Fracture.pm
Criterion Covered Total %
statement 6 10 60.0
branch 0 4 0.0
condition 0 9 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 27 29.6


line stmt bran cond sub pod time code
1             #
2             # Fracture.pm
3             #
4             # Copyright (c) 2007-2008, Juergen Weigert, Novell Inc.
5             # This module is free software. It may be used, redistributed
6             # and/or modified under the same terms as perl.
7             #
8              
9             package Text::Fracture;
10              
11 1     1   108976 use strict;
  1         4  
  1         53  
12 1     1   7 use warnings;
  1         2  
  1         2274  
13              
14             require Exporter;
15              
16             our @ISA = qw(Exporter);
17             our %EXPORT_TAGS = ( 'all' => [ qw(init fract) ] ); # exportable
18             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
19             our @EXPORT = qw(); # autoexport
20             our $VERSION = '1.02';
21              
22             require XSLoader;
23             XSLoader::load('Text::Fracture', $VERSION);
24              
25             sub fract
26             {
27 0     0 0   my $r = do_fract(@_);
28              
29             # do_fract() may put an empty element at the end of the list.
30             # check for that and clean up.
31             # (This cleanup code is easier done in perl than in C.)
32              
33             # a) an empty element may be trailing.
34 0 0 0       pop @$r if $r and $r->[-1] and ($r->[-1][1] == 0);
      0        
35              
36             # b) our end of file recognition always has one newline too many at the end.
37 0 0 0       $r->[-1][3]-- if $r and $r->[-1];
38              
39 0           return $r;
40             }
41              
42             1;
43             __END__