1 |
#!/bin/sh -- # -*- perl -*- -w |
2 |
eval 'exec perl -S $0 "$@"' |
3 |
if 0; |
4 |
|
5 |
use strict; |
6 |
|
7 |
use Config; |
8 |
use File::Basename qw(fileparse); |
9 |
|
10 |
my($file, $path) = fileparse($0); |
11 |
$file =~ s!\.PL$!!i; |
12 |
chdir($path) or die "Couldn't chdir to `$path': $!\n"; |
13 |
|
14 |
print "Extracting $file\n"; |
15 |
|
16 |
open(OUT, "> $file") or die "Couldn't create `$file': $!\n"; |
17 |
print OUT "$Config{'startperl'} -w\n"; |
18 |
while (<DATA>) { |
19 |
print OUT |
20 |
} |
21 |
close(OUT) or die "Couldn't close `$file': $!\n"; |
22 |
|
23 |
chmod(0755, $file) or die "Couldn't chmod 744 on `$file': $!\n"; |
24 |
|
25 |
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; |
26 |
|
27 |
__END__ |
28 |
######################### -*- Mode: Perl -*- ######################### |
29 |
## |
30 |
## $Basename: pod.PL $ |
31 |
## $Revision: 1.6 $ |
32 |
## |
33 |
## Author : Ulrich Pfeifer |
34 |
## Created On : Mon Dec 16 09:46:40 1996 |
35 |
## |
36 |
## Last Modified By : Ulrich Pfeifer |
37 |
## Last Modified On : Sun Nov 22 18:44:35 1998 |
38 |
## |
39 |
## Copyright (c) 1996-1997, Ulrich Pfeifer |
40 |
## |
41 |
## |
42 |
###################################################################### |
43 |
|
44 |
eval 'exec perl -S $0 "$@"' |
45 |
if 0; |
46 |
|
47 |
|
48 |
use strict; |
49 |
|
50 |
|
51 |
package Foo; |
52 |
|
53 |
use WAIT::Parse::Pod; |
54 |
use strict; |
55 |
use vars qw(@ISA); |
56 |
|
57 |
@ISA = qw (WAIT::Parse::Pod); |
58 |
|
59 |
# ANSI color stuff snarfed from Term::ANSI_Color by Zenin (zenin@best.com) |
60 |
|
61 |
sub GREEN () { return "\e[32m"} |
62 |
sub BLUE () { return "\e[34m"} |
63 |
sub RED () { return "\e[31m"} |
64 |
sub BOLD () { return "\e[1m" } |
65 |
sub REVERSE () { return "\e[7m" } |
66 |
sub UNDERLINE () { return "\e[4m" } |
67 |
sub BLACK () { return "\e[30m"} |
68 |
sub YELLOW () { return "\e[33m"} |
69 |
sub MAGENTA () { return "\e[35m"} |
70 |
sub CYAN () { return "\e[36m"} |
71 |
sub WHITE () { return "\e[37m"} |
72 |
|
73 |
sub onBLACK () { return "\e[40m"} |
74 |
sub onRED () { return "\e[41m"} |
75 |
sub onGREEN () { return "\e[42m"} |
76 |
sub onYELLLOW () { return "\e[43m"} |
77 |
sub onBLUE () { return "\e[44m"} |
78 |
sub onMAGENTA () { return "\e[45m"} |
79 |
sub onCYAN () { return "\e[46m"} |
80 |
sub onWHITE () { return "\e[47m"} |
81 |
sub BLINK () { return "\e[5m" } |
82 |
sub CLEAR () { return "\e[0m" } |
83 |
|
84 |
sub output { |
85 |
my $self = shift; |
86 |
my $out = $self->{OUTPUT}; |
87 |
|
88 |
while (@_) { |
89 |
my $tags = shift; |
90 |
my $text = shift; |
91 |
if ($tags->{_b}) { |
92 |
$out->print(BOLD); |
93 |
} elsif ($tags->{_i}) { |
94 |
$out->print(UNDERLINE); |
95 |
} elsif ($tags->{_c}) { |
96 |
$out->print(BLUE); |
97 |
} |
98 |
$out->print($text, CLEAR); |
99 |
} |
100 |
} |
101 |
|
102 |
package main; |
103 |
use IO::File; |
104 |
use Config; |
105 |
|
106 |
sub try { |
107 |
my $pod = shift; |
108 |
|
109 |
for ('', qw(.pod .pm)) { |
110 |
return "$pod$_" if -f "$pod$_"; |
111 |
} |
112 |
} |
113 |
|
114 |
sub locate { |
115 |
my $pod = shift; |
116 |
my $result; |
117 |
|
118 |
return $result if $result = try($pod); |
119 |
$pod =~ s{::}{/}g; |
120 |
for ("$Config{privlibexp}/pod", @INC) { |
121 |
return $result if $result = try("$_/$pod"); |
122 |
} |
123 |
} |
124 |
|
125 |
my ($pod) = @ARGV; |
126 |
|
127 |
my $file = locate($pod); |
128 |
die "Could not locate '$pod'" unless $file; |
129 |
|
130 |
my $in = new IO::File "<$file"; |
131 |
die "Could not open '$file': $!" unless $in; |
132 |
my $out = new IO::File "|less -r"; |
133 |
die "Could not run 'less': $!" unless $out; |
134 |
undef $/; |
135 |
|
136 |
my $text = <$in>; |
137 |
my $parser = new Foo; |
138 |
$parser->{OUTPUT} = $out; |
139 |
|
140 |
$parser->tag($text) |
141 |
|
142 |
|
143 |
__END__ |
144 |
## ################################################################### |
145 |
## pod |
146 |
## ################################################################### |
147 |
|
148 |
=head1 NAME |
149 |
|
150 |
bibdb - generate an WAIT index for bibdb records |
151 |
|
152 |
=head1 SYNOPSIS |
153 |
|
154 |
B<pod> F<file> |
155 |
|
156 |
=head1 DESCRIPTION |
157 |
|
158 |
Pretty prints POD documentation on terminals. Finds pod in modules |
159 |
as well as F<.pod>files. |
160 |
|
161 |
=head1 EXAMPLES |
162 |
|
163 |
pod IO::File |
164 |
pod IO/File |
165 |
|
166 |
yield the same result. |
167 |
|
168 |
=head1 AUTHOR |
169 |
|
170 |
Ulrich Pfeifer E<lt>F<pfeifer@ls6.informatik.uni-dortumund.de>E<gt> |