| 1 | package Text::Darts; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | our $VERSION = sprintf "%d.%02d", q$Revision: 0.10 $ =~ /(\d+)/g; | |||||||||
| 6 | 1 | our $DEBUG = 0; | |||||||||
| 7 | |||||||||||
| 8 | 1 | require XSLoader; | |||||||||
| 9 | 1 | XSLoader::load('Text::Darts', $VERSION); | |||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub new{ | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 12 | 0 | my $pkg = shift; | |||||||||
| 13 | 0 | my $dpi = xs_make([ grep { $_ } sort @_]); | |||||||||
| 14 | 0 | bless \$dpi, $pkg; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 0 | ▶ | sub open{ | ||||||||
|
Subroutine
open: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 18 | 0 | my $pkg = shift; | |||||||||
| 19 | 0 | my $filename = shift; | |||||||||
| 20 | 0 | ▶ | my $dpi = xs_open($filename) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | or carp __PACKAGE__, " cannot open $filename"; | ||||||||||
| 22 | 0 | bless \$dpi, $pkg; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub DESTROY{ | ||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=13.0
| |||||||||||
| 26 | 0 | ▶ | if ($DEBUG){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 1 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 0 | require Data::Dumper; | |||||||||
| 29 | 0 | local $Data::Dumper::Terse = 1; | |||||||||
| 30 | 0 | local $Data::Dumper::Indent = 0; | |||||||||
| 31 | 0 | warn "DESTROY:", Data::Dumper::Dumper($_[0]); | |||||||||
| 32 | } | ||||||||||
| 33 | 0 | xs_free(${$_[0]}); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub search{ | ||||||||
|
Subroutine
search: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | 0 | xs_search(${$_[0]}, $_[1]); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub gsub{ | ||||||||
|
Subroutine
gsub: not called CC=2 SCAR=12.2
Pod
undocumented
| |||||||||||
| 41 | 0 | my $cbstr = $_[2]; | |||||||||
| 42 | 1 | ▶ | no warnings 'uninitialized'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | 0 | ▶ | my $cb = ref $cbstr ? $cbstr : sub { $cbstr }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||
| 44 | 0 | xs_gsub(${$_[0]}, $_[1], $cb); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 1 | ▶ | if ($0 eq __FILE__){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | ▶ | sub say { print @_, "\n" }; | ||||||||
|
Subroutine
say: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | 0 | my @a = ("ALGOL", "ANSI", "ARCO", "ARPA", "ARPANET", "ASCII"); | |||||||||
| 50 | 0 | my %a = map { $_ => lc $_ } @a; | |||||||||
| 51 | 0 | my $da = __PACKAGE__->new(@a); | |||||||||
| 52 | 0 | ▶ | say $da->gsub("I don't like ALGOL at all!", sub{"<$_[0]>"}); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 53 | 0 | say $da->gsub("I don't like nomatch at all!"); | |||||||||
| 54 | 0 | say $da->gsub("I don't like ALGOL at all!", \%a); | |||||||||
| 55 | 0 | ▶ | if (@ARGV){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | $da = __PACKAGE__->open(shift); | |||||||||
| 57 | say $da->gsub("The quick brown fox jumps over the black lazy dog", | ||||||||||
| 58 | 0 | ▶ | sub{"<$_[0]>"}); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 59 | } | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 1 | 1; | |||||||||
| 63 | __END__ | ||||||||||