| 1 | #-*-perl-*- | ||||||||||
| 2 | |||||||||||
| 3 | package Unicode::GCString; | ||||||||||
| 4 | 21 | require 5.008; | |||||||||
| 5 | |||||||||||
| 6 | =encoding utf-8 | ||||||||||
| 7 | |||||||||||
| 8 | =cut | ||||||||||
| 9 | |||||||||||
| 10 | ### Pragmas: | ||||||||||
| 11 | 21 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 21 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 21 | ▶ | use vars qw($VERSION @EXPORT_OK @ISA); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | ### Exporting: | ||||||||||
| 16 | 21 | ▶ | use Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 21 | our @EXPORT_OK = qw(); | |||||||||
| 18 | 21 | our %EXPORT_TAGS = ('all' => [@EXPORT_OK]); | |||||||||
| 19 | |||||||||||
| 20 | ### Inheritance: | ||||||||||
| 21 | 21 | our @ISA = qw(Exporter); | |||||||||
| 22 | |||||||||||
| 23 | ### Other modules: | ||||||||||
| 24 | 21 | ▶ | use Unicode::LineBreak; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | ### Globals | ||||||||||
| 27 | |||||||||||
| 28 | # The package version | ||||||||||
| 29 | 21 | our $VERSION = '2013.10'; | |||||||||
| 30 | |||||||||||
| 31 | use overload | ||||||||||
| 32 | 21 | '@{}' => \&as_arrayref, | |||||||||
| 33 | '${}' => \&as_scalarref, | ||||||||||
| 34 | '""' => \&as_string, | ||||||||||
| 35 | '.' => \&concat, | ||||||||||
| 36 | #XXX'.=' => \&concat, #FIXME:segfault | ||||||||||
| 37 | 'cmp' => \&cmp, | ||||||||||
| 38 | '<>' => \&next, | ||||||||||
| 39 | 21 | ▶ | ; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | sub new { | ||||||||||
| 42 | 416 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | |||||||||||
| 44 | 416 | my $self; | |||||||||
| 45 | 416 | ▶ | if (scalar @_ <= 2) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 16 | $self = __PACKAGE__->_new(@_); | |||||||||
| 47 | } else { | ||||||||||
| 48 | 400 | my $str = shift; | |||||||||
| 49 | 400 | my $lb = Unicode::LineBreak->new(@_); | |||||||||
| 50 | 400 | $self = __PACKAGE__->_new($str, $lb); | |||||||||
| 51 | } | ||||||||||
| 52 | 416 | bless $self, $class; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | sub as_arrayref { | ||||||||||
| 56 | 356 | ▶ | my @a = shift->as_array; | ||||||||
|
Subroutine
as_arrayref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | 356 | return \@a; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 21 | 1; | |||||||||