/[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

Annotation of /cvs-head/script/pod

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (hide annotations)
Tue May 9 11:29:45 2000 UTC (24 years ago) by cvs2svn
File size: 2978 byte(s)
This commit was generated by cvs2svn to compensate for changes in r10,
which included commits to RCS files with non-trunk default branches.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26