/[wait]/cvs-head/script/pod
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /cvs-head/script/pod

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Fri Apr 28 15:40:52 2000 UTC (24 years ago) by ulpfr
File size: 3022 byte(s)
Initial revision

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

Properties

Name Value
cvs2svn:cvs-rev 1.1
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26