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