1 |
wakaba |
1.1 |
use strict;
|
2 |
|
|
use vars qw(%PROP %SET %SET_ALIAS $VERSION);
|
3 |
|
|
$VERSION=do{my @r=(q$Revision: 1.2 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
|
4 |
|
|
|
5 |
|
|
$PROP{module_name} = 'FooScript';
|
6 |
|
|
|
7 |
|
|
sub header () {
|
8 |
|
|
<<"EOH";
|
9 |
|
|
## This is auto-generated (at @{[ sprintf '%04d-%02d-%02dT%02d:%02d:%02dZ', (gmtime)[5]+1900, (gmtime)[4]+1, (gmtime)[3,2,1,0] ]}). Do not edit by hand!
|
10 |
|
|
use strict;
|
11 |
|
|
|
12 |
|
|
package Char::InSet::$PROP{module_name};
|
13 |
|
|
use Exporter;
|
14 |
|
|
use vars qw(\@EXPORT_OK \@ISA \$VERSION);
|
15 |
|
|
\@ISA = qw(Exporter);
|
16 |
|
|
\$VERSION = '$PROP{version}';
|
17 |
|
|
EOH
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
sub table () {
|
21 |
|
|
my $r = '';
|
22 |
|
|
my @set;
|
23 |
|
|
for (sort keys %SET) {
|
24 |
|
|
my @aline;
|
25 |
|
|
$SET{$_} =~ s{^#\+(\w+)$}{
|
26 |
|
|
push @aline, qq(\&In$PROP{module_name}$1.); ''
|
27 |
|
|
}mge;
|
28 |
|
|
$SET{$_} =~ s{^#.+$}{}mg;
|
29 |
|
|
$SET{$_} =~ tr/\x09\x0A\x0D\x20//d;
|
30 |
|
|
push @set, [qq(In$PROP{module_name}$_) =>
|
31 |
|
|
join "\n", qq(sub In$PROP{module_name}$_ {),
|
32 |
|
|
(@aline), q(<<EOH;),
|
33 |
|
|
(map {sprintf '%04X', $_} sort {$a <=> $b}
|
34 |
|
|
map {ord $_} split //, $SET{$_}),
|
35 |
|
|
q(EOH), q(})
|
36 |
|
|
];
|
37 |
|
|
}
|
38 |
|
|
for (sort keys %SET_ALIAS) {
|
39 |
|
|
push @set, [qq(In$PROP{module_name}$_) => qq(\*In$PROP{module_name}$_ = \\&In$PROP{module_name}$SET_ALIAS{$_};)];
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
$r = qq(\@EXPORT_OK = qw(@{[map {$_->[0]} @set]});\n\n);
|
43 |
|
|
$r .= join '', map {$_->[1]."\n\n"} @set;
|
44 |
|
|
$r;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
sub footer () {
|
48 |
|
|
my $r = <<EOH;
|
49 |
|
|
=head1 NAME
|
50 |
|
|
|
51 |
|
|
$PROP{module_name}.pm --- @{[ $PROP{script_name} || $PROP{module_name} ]} character sets for C<\\p{In$PROP{module_name}HogeHoge}> regexps
|
52 |
|
|
|
53 |
|
|
@{[$PROP{pod_description}? "=head1 DESCRIPTION
|
54 |
|
|
|
55 |
|
|
$PROP{pod_description}":'']}
|
56 |
|
|
@{[$PROP{pod_example}? "=head1 EXAMPLE
|
57 |
|
|
|
58 |
|
|
$PROP{pod_example}":'']}
|
59 |
|
|
@{[$PROP{pod_license}? "=head1 LICENSE
|
60 |
|
|
|
61 |
|
|
$PROP{pod_license}":"Copyright @{[(gmtime)[5]+1900]} $PROP{author_name} <$PROP{author_mail}>
|
62 |
|
|
|
63 |
|
|
This library and the library generated by it is free software;
|
64 |
|
|
you can redistribute them and/or modify them under the same
|
65 |
|
|
terms as Perl itself.
|
66 |
|
|
"]}
|
67 |
|
|
@{[$PROP{pod_see_also}? "=head1 SEE ALSO
|
68 |
|
|
|
69 |
|
|
$PROP{pod_see_also}":'']}
|
70 |
|
|
=cut
|
71 |
|
|
|
72 |
|
|
1;
|
73 |
|
|
### $PROP{module_name}.pm ends here
|
74 |
|
|
EOH
|
75 |
|
|
$r;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
sub print_module () {
|
79 |
|
|
no warnings;
|
80 |
|
|
print &header.&table.&footer;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
=head1 NAME
|
84 |
|
|
|
85 |
|
|
mkpm.pl --- Char::InSet::Han modules generating library
|
86 |
|
|
|
87 |
|
|
=head1 LICENSE
|
88 |
|
|
|
89 |
|
|
Copyright 2002 Wakaba <w@suika.fam.cx>
|
90 |
|
|
|
91 |
|
|
This library and the library generated by it is free software;
|
92 |
|
|
you can redistribute them and/or modify them under the same
|
93 |
|
|
terms as Perl itself.
|
94 |
|
|
|
95 |
|
|
=cut
|
96 |
|
|
|
97 |
|
|
1; ## $Date: 2002/08/16 06:50:16 $
|
98 |
|
|
### mkpm.pl ends here
|