| 1 | package Magrathea::API::Abbreviation; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use 5.10.0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use parent qw{ Exporter }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Text::Autoformat; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our @EXPORT_OK = qw{ abbreviate }; | |||||||||
| 12 | |||||||||||
| 13 | sub abbreviate($) | ||||||||||
| 14 | 0 | ▶ | { | ||||||||
|
Subroutine
abbreviate: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 15 | 0 | my $check = shift; | |||||||||
| 16 | 0 | local $_; | |||||||||
| 17 | 0 | my $wanted = autoformat $check, { | |||||||||
| 18 | case => 'highlight' | ||||||||||
| 19 | }; | ||||||||||
| 20 | 0 | $wanted =~ s/\s*$//; | |||||||||
| 21 | 0 | study $wanted; | |||||||||
| 22 | 0 | ▶ | while (<DATA>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | chomp; | |||||||||
| 24 | 0 | s/#.*//; | |||||||||
| 25 | 0 | ▶ | next if /^$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | my ($key, $val) = split /\t/; | |||||||||
| 27 | 0 | $wanted =~ s/\b$key\b/$val./g; | |||||||||
| 28 | } | ||||||||||
| 29 | 0 | $wanted =~ s/\band\b/&/g; | |||||||||
| 30 | 0 | $wanted =~ s/\.\.$/./; | |||||||||
| 31 | 0 | return $wanted; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | __DATA__ | ||||||||||