3 #=======================================================================
5 # File ID: c3b793a4-6225-11e1-bae9-37679d2dbe43
9 # ©opyleft 2012– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 3 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
32 $progname =~ s/^.*\/(.*?)$/$1/;
33 our $VERSION = '0.00';
35 Getopt
::Long
::Configure
('bundling');
38 'debug' => \
$Opt{'debug'},
39 'help|h' => \
$Opt{'help'},
40 'verbose|v+' => \
$Opt{'verbose'},
41 'version' => \
$Opt{'version'},
43 ) || die("$progname: Option error. Use -h for help.\n");
45 $Opt{'debug'} && ($Debug = 1);
46 $Opt{'help'} && usage
(0);
47 if ($Opt{'version'}) {
52 my $slurp = join('', <>);
54 $slurp =~ s/(<wpt\b.*?<\/wpt>)/process_wpt
($1)/gse
;
59 my ($name, $cmt, $desc) = ('', '', '');
60 $txt =~ /<name>(.*?)<\/name
>/ && ($name = $1);
61 $txt =~ /<cmt>(.*?)<\/cmt
>/ && ($cmt = $1);
62 $txt =~ /<desc>(.*?)<\/desc
>/ && ($desc = $1);
63 if ($desc eq $cmt || $desc eq $name) {
64 $txt =~ s/<desc>.*<\/desc>.*?</</s
;
67 $txt =~ s/<cmt>.*<\/cmt>.*?</</s
;
73 # Print program version {{{
74 print("$progname v$VERSION\n");
80 # Send the help message to stdout {{{
83 if ($Opt{'verbose'}) {
89 Usage: $progname [options] [file [files [...]]]
91 Remove <desc> from <wpt> if it's identical to <cmt> or <name>, and <cmt>
92 if it's identical to <name>.
99 Increase level of verbosity. Can be repeated.
101 Print version information.
103 Print debugging messages.
111 # Print a status message to stderr based on verbosity level {{{
112 my ($verbose_level, $Txt) = @_;
114 if ($Opt{'verbose'} >= $verbose_level) {
115 print(STDERR
"$progname: $Txt\n");
122 # Print a debugging message {{{
124 my @call_info = caller;
125 chomp(my $Txt = shift);
126 my $File = $call_info[1];
128 $File =~ s
#^.*/(.*?)$#$1#;
129 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
136 # Plain Old Documentation (POD) {{{
146 [options] [file [files [...]]]
156 =item B<-h>, B<--help>
158 Print a brief help summary.
160 =item B<-v>, B<--verbose>
162 Increase level of verbosity. Can be repeated.
166 Print version information.
170 Print debugging messages.
180 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
184 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
185 This is free software; see the file F<COPYING> for legalese stuff.
189 This program is free software: you can redistribute it and/or modify it
190 under the terms of the GNU General Public License as published by the
191 Free Software Foundation, either version 3 of the License, or (at your
192 option) any later version.
194 This program is distributed in the hope that it will be useful, but
195 WITHOUT ANY WARRANTY; without even the implied warranty of
196 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
197 See the GNU General Public License for more details.
199 You should have received a copy of the GNU General Public License along
201 If not, see L<http://www.gnu.org/licenses/>.
209 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :