File Coverage

blib/lib/Unicode/GCString.pm
Criterion Covered Total %
statement 28 28 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 40 40 100.0


line stmt bran cond sub pod time code
1             #-*-perl-*-
2              
3             package Unicode::GCString;
4             require 5.008;
5              
6             =encoding utf-8
7              
8             =cut
9              
10             ### Pragmas:
11 21     21   201364 use strict;
  21         78  
  21         688  
12 21     21   106 use warnings;
  21         43  
  21         661  
13 21     21   160 use vars qw($VERSION @EXPORT_OK @ISA);
  21         47  
  21         1137  
14              
15             ### Exporting:
16 21     21   115 use Exporter;
  21         41  
  21         1727  
17             our @EXPORT_OK = qw();
18             our %EXPORT_TAGS = ('all' => [@EXPORT_OK]);
19              
20             ### Inheritance:
21             our @ISA = qw(Exporter);
22              
23             ### Other modules:
24 21     21   981 use Unicode::LineBreak;
  21         45  
  21         2142  
25              
26             ### Globals
27              
28             # The package version
29             our $VERSION = '2013.10';
30              
31             use overload
32 21         230 '@{}' => \&as_arrayref,
33             '${}' => \&as_scalarref,
34             '""' => \&as_string,
35             '.' => \&concat,
36             #XXX'.=' => \&concat, #FIXME:segfault
37             'cmp' => \&cmp,
38             '<>' => \&next,
39 21     21   3844 ;
  21         2866  
40              
41             sub new {
42 416     416 1 301407 my $class = shift;
43              
44 416         696 my $self;
45 416 100       981 if (scalar @_ <= 2) {
46 16         142 $self = __PACKAGE__->_new(@_);
47             } else {
48 400         635 my $str = shift;
49 400         1218 my $lb = Unicode::LineBreak->new(@_);
50 400         3105 $self = __PACKAGE__->_new($str, $lb);
51             }
52 416         2132 bless $self, $class;
53             }
54              
55             sub as_arrayref {
56 356     356 1 3479 my @a = shift->as_array;
57 356         1110 return \@a;
58             }
59              
60             1;