Debian Codegraph @

bin/pman

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/env perl
2 # pman -- show a module's man page
3
4 # ------ pragmas
5 use strict;
6 use warnings;
7 use pmtools;
8
9 our $VERSION = '2.1.0';
10
11 # ------ define variables
12 my $module; # module name
13 my $pager; # $ENV{PAGER} - pager program
14 my $path; # path for pod2text
15
16 BEGIN { $^W = 1 }
17 BEGIN { die "usage: $0 module ...\n" unless @ARGV }
18
19 use FindBin qw($Bin);
20
21 unless ($pager = $ENV{PAGER}) {
22 require Config;
23 $pager = $Config::Config{"pager"} || "more";
24 }
25
26 for $module (@ARGV) {
27 $module =~ s#::#/#gmsx;
28 my $found = 0;
29 my $iter = pmtools::new_pod_iterator($module);
30
31 while (my $pod = $iter->()) {
•32 next if $pod =~ /\bperl-base\b/;
33 if (-s $pod) {
34 $path = $pod;
35 $found++;
36 last;
37 }
38 }
39
40 if (!$found) {
41 next;
42 }
43 system "$^X -S pod2text $path | $pager";
44 }
45
46 exit(0);
47
48 __END__
49
50 =head1 NAME
51
52 pman - show a module's man page
53
54 =head1 DESCRIPTION
55
56 Send a module's pod through pod2text and your pager.
57
58 This is mostly here for people too lazy to type
59
60 $ pod2text `pmpath CGI` | $PAGER
61
62 =head1 EXAMPLES
63
64 $ pman CGI
65 $ pman Curses
66
67 Or running under different versions of Perl:
68
69 $ oldperl -S pman CGI
70 $ filsperl -S pman Threads
71
72 =head1 SEE ALSO
73
74 pod2text(1), perlpod(1), pod2man(1), pod2html(1).
75
76 =head1 AUTHORS and COPYRIGHTS
77
78 Copyright (C) 1999 Tom Christiansen.
79
80 Copyright (C) 2006-2014, 2018 Mark Leighton Fisher.
81
82 =head1 LICENSE
83
84 This is free software; you can redistribute it and/or modify it
85 under the terms of either:
86 (a) the GNU General Public License as published by the Free
87 Software Foundation; either version 1, or (at your option) any
88 later version, or
89 (b) the Perl "Artistic License".
90 (This is the Perl 5 licensing scheme.)
91
92 Please note this is a change from the
93 original pmtools-1.00 (still available on CPAN),
94 as pmtools-1.00 were licensed only under the
95 Perl "Artistic License".