line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Strfname; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
35936
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
require 5.006; |
5
|
|
|
|
|
|
|
require Exporter; |
6
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @EXPORT @EXPORT_OK @ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
336
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.13'; |
9
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
@EXPORT = @EXPORT_OK = qw(strfname); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub strfname { |
13
|
28
|
|
|
28
|
0
|
18208
|
my $format = shift; |
14
|
28
|
|
|
|
|
178
|
my %t = ( '%' => '%' ); |
15
|
|
|
|
|
|
|
|
16
|
28
|
|
|
|
|
88
|
foreach my $a (0..$#_) { |
17
|
196
|
|
66
|
|
|
751
|
my $def = defined $_[$a] && $_[$a] ne ''; |
18
|
196
|
|
66
|
|
|
822
|
$t{qw(l f m p s g a b c d e)[$a]} = $def && $_[$a]; |
19
|
196
|
|
66
|
|
|
1240
|
$t{qw(L F M _ _ _ A B C D E)[$a]} = $def && substr($_[$a], 0, 1) . '.'; |
20
|
196
|
|
66
|
|
|
1320
|
$t{qw(T S I _ _ _ 1 2 3 4 5)[$a]} = $def && substr($_[$a], 0, 1); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
28
|
|
|
|
|
119
|
local $^W; |
24
|
28
|
100
|
|
|
|
174
|
$format =~ s/%([^lfmpsgxsabcdeLFMABCDETSI12345%]*)(.)/($_ = $t{$2}) && "$1$_"/ge; |
|
90
|
|
|
|
|
567
|
|
25
|
28
|
|
|
|
|
272
|
return $format; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
__END__ |