| 1 | # -*- Mode: Perl -*- | ||||||||||||||||||||||||||||||||||||
| 2 | # $Basename: WAIT.pm $ | ||||||||||||||||||||||||||||||||||||
| 3 | # $Revision: 1.6 $ | ||||||||||||||||||||||||||||||||||||
| 4 | # Author : Ulrich Pfeifer | ||||||||||||||||||||||||||||||||||||
| 5 | # Created On : Fri Jan 31 11:30:46 1997 | ||||||||||||||||||||||||||||||||||||
| 6 | # Last Modified By: Ulrich Pfeifer | ||||||||||||||||||||||||||||||||||||
| 7 | # Last Modified On: Thu Mar 23 21:19:20 2000 | ||||||||||||||||||||||||||||||||||||
| 8 | # Language : CPerl | ||||||||||||||||||||||||||||||||||||
| 9 | # Update Count : 145 | ||||||||||||||||||||||||||||||||||||
| 10 | # Status : Unknown, Use with caution! | ||||||||||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||||||||||
| 12 | # (C) Copyright 1997, Ulrich Pfeifer, all rights reserved. | ||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | package CPAN::WAIT; | ||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use ExtUtils::MakeMaker; # MM->catfile | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||
| 19 | # try to avoid 'use'ing CPAN.pm | ||||||||||||||||||||||||||||||||||||
| 20 | # code stolen from CPAN::Config::load ; | ||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||
| 22 | 1 | eval {require CPAN::Config;}; # We eval because of some | |||||||||||||||||||||||||||||||||||
| 23 | # MakeMaker problems | ||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | unless ($CPAN::dot_cpan++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 25 | 1 | unshift @INC, MM->catdir($ENV{HOME},".cpan"); | |||||||||||||||||||||||||||||||||||
| 26 | 1 | eval {require CPAN::MyConfig;}; # where you can override | |||||||||||||||||||||||||||||||||||
| 27 | # system wide settings | ||||||||||||||||||||||||||||||||||||
| 28 | 1 | shift @INC; | |||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||
| 33 | 1 | require WAIT::Client; | |||||||||||||||||||||||||||||||||||
| 34 | 1 | require FileHandle; | |||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use vars qw($VERSION $DEBUG $TIMEOUT); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||
| 37 | # $Format: "\$\V\E\R\S\I\O\N = '$ModuleVersion$';"$ MM_Unix bug | ||||||||||||||||||||||||||||||||||||
| 38 | 1 | $VERSION = '0.27'; | |||||||||||||||||||||||||||||||||||
| 39 | 1 | $TIMEOUT = 20; # Set this to some larger value if you | |||||||||||||||||||||||||||||||||||
| 40 | # have a slow connection. | ||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub _open_connection () { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_open_connection: not called CC=19 SCAR=59.4
| |||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ($host, $port, $con); | |||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||
| 45 | # Make sure that there is a wait server to try | ||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | unless ($CPAN::Config->{'wait_list'}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 47 | 0 | $CPAN::Config->{'wait_list'} = ['wait://ls6.informatik.uni-dortmund.de']; | |||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||
| 50 | # Try direct connection | ||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $server; | |||||||||||||||||||||||||||||||||||
| 52 | SERVER: | ||||||||||||||||||||||||||||||||||||
| 53 | 0 | for $server (@{$CPAN::Config->{'wait_list'}}) { | |||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | warn "CPAN::WAIT $VERSION checking $server\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ($server =~ m(^wait://([^:]+)(?::(\d+))?)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | ($host, $port) = ($1, $2 || 1404); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$2 || 1404
MC/DC0%0/1
$2 || 1404
$2
Truth table0%0/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||
| 57 | # Constructor is inherited from Net::NNTP | ||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $con = WAIT::Client->new($host, Port => $port, Timeout => $TIMEOUT) | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$DEBUG and $DEBUG =~ /force proxy/
MC/DC0%0/2
$DEBUG and $DEBUG =~ /force proxy/
$DEBUG
$DEBUG =~ /force proxy/
Truth table0%0/3
A and B
A= $DEBUGB= $DEBUG =~ /force proxy/
| |||||||||||||||||||||||||||||||||||||
| 59 | unless $DEBUG and $DEBUG =~ /force proxy/; | ||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | last SERVER if $con; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||
| 64 | # Try connection via an http proxy | ||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | unless ($con) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | warn "Could not connect to the WAIT server at $host port $port\n" | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$DEBUG and $DEBUG =~ /force proxy/
MC/DC0%0/2
$DEBUG and $DEBUG =~ /force proxy/
$DEBUG
$DEBUG =~ /force proxy/
Truth table0%0/3
A and B
A= $DEBUGB= $DEBUG =~ /force proxy/
| |||||||||||||||||||||||||||||||||||||
| 67 | unless $DEBUG and $DEBUG =~ /force proxy/; | ||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($CPAN::Config->{'http_proxy'}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 70 | 0 | print "Trying your http proxy $CPAN::Config->{'http_proxy'}\n"; | |||||||||||||||||||||||||||||||||||
| 71 | SERVER: | ||||||||||||||||||||||||||||||||||||
| 72 | 0 | for $server (@{$CPAN::Config->{'wait_list'}}) { | |||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($server =~ m(^wait://([^:]+)(?::(\d+))?)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | ($host, $port) = ($1, $2 || 1404); | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$2 || 1404
MC/DC0%0/1
$2 || 1404
$2
Truth table0%0/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||
| 75 | $con = WAIT::Client::HTTP->new($host, | ||||||||||||||||||||||||||||||||||||
| 76 | Port => $port, | ||||||||||||||||||||||||||||||||||||
| 77 | 0 | Proxy => $CPAN::Config->{'http_proxy'}, | |||||||||||||||||||||||||||||||||||
| 78 | Timeout => $TIMEOUT); | ||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | last SERVER if $con; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | warn "No luck with your proxy either. Giving up\n" | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 83 | unless $con; | ||||||||||||||||||||||||||||||||||||
| 84 | } else { | ||||||||||||||||||||||||||||||||||||
| 85 | 0 | warn "You did not tell the CPAN module about an http proxy.\n" . | |||||||||||||||||||||||||||||||||||
| 86 | "I could use such a beast instead of a direct connection.\n"; | ||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||
| 90 | # We had no luck. | ||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | warn "No searching available!\n" unless $con; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||
| 93 | 0 | return $con; | |||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||
| 96 | 1 | my $con; | |||||||||||||||||||||||||||||||||||
| 97 | # Temporary file for retrieved documents | ||||||||||||||||||||||||||||||||||||
| 98 | 1 | my $tmp = MM->catfile($CPAN::Config->{'cpan_home'}, 'w4c.pod'); | |||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||
| 100 | # run a search | ||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub wq { | ||||||||||||||||||||||||||||||||||
|
Subroutine
wq: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 103 | 0 | my $result; | |||||||||||||||||||||||||||||||||||
| 104 | 0 | local ($") = ' '; | |||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $con ||= _open_connection || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$con ||= &_open_connection() || (return)
&_open_connection() || (return)
MC/DC0%0/2
$con ||= &_open_connection() || (return)
$con
&_open_connection()
Truth table0%0/3
A ||= B
A= $conB= &_open_connection()
| |||||||||||||||||||||||||||||||||||||
| 107 | 0 | print "Searching for '@_'\n"; | |||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | unless ($result = $con->search(@_)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 109 | 0 | print "Your query contains a syntax error.\n"; | |||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->wh('wq'); | |||||||||||||||||||||||||||||||||||
| 111 | } else { | ||||||||||||||||||||||||||||||||||||
| 112 | 0 | print $con->message; | |||||||||||||||||||||||||||||||||||
| 113 | 0 | print @{$result}; | |||||||||||||||||||||||||||||||||||
| 114 | 0 | print "Type 'wr <number>' or 'wd <number>' to examine the results\n"; | |||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||
| 116 | 0 | $result; | |||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||
| 119 | # display hit record | ||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub wr { | ||||||||||||||||||||||||||||||||||
|
Subroutine
wr: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 122 | 0 | my $hit = shift; | |||||||||||||||||||||||||||||||||||
| 123 | 0 | my $result; | |||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (@_ or !$hit) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ or not $hit
MC/DC0%0/2
@_ or not $hit
@_
not $hit
Truth table0%0/3
A or not(B)
A= @_B= not $hit
| |||||||||||||||||||||||||||||||||||||
| 126 | 0 | print "USAGE: wr <hit-number>\n"; | |||||||||||||||||||||||||||||||||||
| 127 | } else { | ||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $con ||= _open_connection || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$con ||= &_open_connection() || (return)
&_open_connection() || (return)
MC/DC0%0/2
$con ||= &_open_connection() || (return)
$con
&_open_connection()
Truth table0%0/3
A ||= B
A= $conB= &_open_connection()
| |||||||||||||||||||||||||||||||||||||
| 129 | 0 | print "fetching info on hit number $hit\n"; | |||||||||||||||||||||||||||||||||||
| 130 | 0 | $result = $con->info($hit); | |||||||||||||||||||||||||||||||||||
| 131 | 0 | print @$result; | |||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||
| 133 | 0 | $result; | |||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||
| 136 | # display hit document | ||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub wd { | ||||||||||||||||||||||||||||||||||
|
Subroutine
wd: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 139 | 0 | my $hit = shift; | |||||||||||||||||||||||||||||||||||
| 140 | 0 | my $result; | |||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if (@_ or !$hit) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ or not $hit
MC/DC0%0/2
@_ or not $hit
@_
not $hit
Truth table0%0/3
A or not(B)
A= @_B= not $hit
| |||||||||||||||||||||||||||||||||||||
| 143 | 0 | print "USAGE: wd <hit-number>\n"; | |||||||||||||||||||||||||||||||||||
| 144 | 0 | return; | |||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $con ||= _open_connection || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$con ||= &_open_connection() || (return)
&_open_connection() || (return)
MC/DC0%0/2
$con ||= &_open_connection() || (return)
$con
&_open_connection()
Truth table0%0/3
A ||= B
A= $conB= &_open_connection()
| |||||||||||||||||||||||||||||||||||||
| 147 | 0 | print "Get hit number $hit ..."; | |||||||||||||||||||||||||||||||||||
| 148 | 0 | my $text = $con->get($hit); | |||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | my $lines = ($text)?@$text:'no'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 150 | 0 | print " done\nGot $lines lines\nRunning perldoc on it ...\n"; | |||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||
| 152 | # perldoc does not read STDIN; so we need a temp file | ||||||||||||||||||||||||||||||||||||
| 153 | { | ||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $fh = new FileHandle ">$tmp"; | |||||||||||||||||||||||||||||||||||
| 155 | 0 | $fh->print(@{$text}); | |||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||
| 158 | # is system available every were ?? | ||||||||||||||||||||||||||||||||||||
| 159 | system $^X, '-S', 'perldoc', $tmp | ||||||||||||||||||||||||||||||||||||
| 160 | and warn "Could not run '$^X -S perldoc $tmp': $?\n" | ||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | and system $Config{'pager'}, $tmp | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
system $^X, "-S", "perldoc", $tmp and warn "Could not run '$^X -S perldoc ${tmp}': $?\n" and system $Config{"pager"}, $tmp and warn qq[Could not run '$Config{"pager"} ${tmp}': $?\n]
system $^X, "-S", "perldoc", $tmp and warn "Could not run '$^X -S perldoc ${tmp}': $?\n" and system $Config{"pager"}, $tmp
system $^X, "-S", "perldoc", $tmp and warn "Could not run '$^X -S perldoc ${tmp}': $?\n"
MC/DC0%0/2
system $^X, "-S", "perldoc", $tmp and warn "Could not run '$^X -S perldoc ${tmp}': $?\n" and system $Config{"pager"}, $tmp and warn qq[Could not run '$Config{"pager"} ${tmp}': $?\n]
system $^X, "-S", "perldoc", $tmp
system $Config{"pager"}, $tmp
Truth table0%0/3
A and B
A= system $^X, "-S", "perldoc", $tmpB= system $Config{"pager"}, $tmp
| |||||||||||||||||||||||||||||||||||||
| 162 | and warn "Could not run '$Config{'pager'} $tmp': $?\n" | ||||||||||||||||||||||||||||||||||||
| 163 | and print @$text; | ||||||||||||||||||||||||||||||||||||
| 164 | 0 | $text; | |||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub wl { | ||||||||||||||||||||||||||||||||||
|
Subroutine
wl: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 169 | 0 | my $hits = shift; | |||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 172 | 0 | print "USAGE: wl <maximum-hit-count>\n"; | |||||||||||||||||||||||||||||||||||
| 173 | 0 | return; | |||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | $con ||= _open_connection || return; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$con ||= &_open_connection() || (return)
&_open_connection() || (return)
MC/DC0%0/2
$con ||= &_open_connection() || (return)
$con
&_open_connection()
Truth table0%0/3
A ||= B
A= $conB= &_open_connection()
| |||||||||||||||||||||||||||||||||||||
| 176 | 0 | print "Setting maximum hit count to $hits\n"; | |||||||||||||||||||||||||||||||||||
| 177 | 0 | $con->hits($hits); | |||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||
| 180 | 1 | my %HELP = | |||||||||||||||||||||||||||||||||||
| 181 | ( | ||||||||||||||||||||||||||||||||||||
| 182 | 'h' => q{ | ||||||||||||||||||||||||||||||||||||
| 183 | 'wh' displays a short summary of commands available via the WAIT | ||||||||||||||||||||||||||||||||||||
| 184 | plugin. | ||||||||||||||||||||||||||||||||||||
| 185 | 'wh <command>' displays information about a the command given as argument | ||||||||||||||||||||||||||||||||||||
| 186 | }, | ||||||||||||||||||||||||||||||||||||
| 187 | 'q' => q{ | ||||||||||||||||||||||||||||||||||||
| 188 | Here are some query examples: | ||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||
| 190 | information retrieval free text query | ||||||||||||||||||||||||||||||||||||
| 191 | information or retrieval same as above | ||||||||||||||||||||||||||||||||||||
| 192 | des=information retrieval `information' must be in the description | ||||||||||||||||||||||||||||||||||||
| 193 | des=(information retrieval) one of them in description | ||||||||||||||||||||||||||||||||||||
| 194 | des=(information or retrieval) same as above | ||||||||||||||||||||||||||||||||||||
| 195 | des=(information and retrieval) both of them in description | ||||||||||||||||||||||||||||||||||||
| 196 | des=(information not retrieval) `information' in description and | ||||||||||||||||||||||||||||||||||||
| 197 | `retrieval' not in description | ||||||||||||||||||||||||||||||||||||
| 198 | des=(information system*) wild-card search | ||||||||||||||||||||||||||||||||||||
| 199 | au=ilia author names may be misspelled | ||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||
| 201 | You can build arbitary boolean combination of the above examples. | ||||||||||||||||||||||||||||||||||||
| 202 | The following fields are known: | ||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||
| 204 | 'synopsis', 'name', 'bugs', 'author', 'example', 'description', | ||||||||||||||||||||||||||||||||||||
| 205 | 'environment' | ||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||
| 207 | Field names may be abbreviated. | ||||||||||||||||||||||||||||||||||||
| 208 | }, | ||||||||||||||||||||||||||||||||||||
| 209 | 'r' => q{ | ||||||||||||||||||||||||||||||||||||
| 210 | 'wr <hit-number>' displays the record of the selected hit. Records look | ||||||||||||||||||||||||||||||||||||
| 211 | like this: | ||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||
| 213 | source authors/id/CHIPS/perl5.003_24.tar.gz | ||||||||||||||||||||||||||||||||||||
| 214 | headline perl - Practical Extraction and Report Language | ||||||||||||||||||||||||||||||||||||
| 215 | size 12786 | ||||||||||||||||||||||||||||||||||||
| 216 | docid data/perl/pod/perl.pod | ||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||
| 218 | 'source' is the patch relative to http://www.perl.org/CPAN/. | ||||||||||||||||||||||||||||||||||||
| 219 | 'headline' is the contents of the 'NAME' section of the POD document | ||||||||||||||||||||||||||||||||||||
| 220 | 'size' is the size of the POD document (not the size of the tar archive)! | ||||||||||||||||||||||||||||||||||||
| 221 | 'docid' is the path the POS document is stored in. It should be the | ||||||||||||||||||||||||||||||||||||
| 222 | path in the tar archive minus the version number + a 'data' | ||||||||||||||||||||||||||||||||||||
| 223 | prefix. | ||||||||||||||||||||||||||||||||||||
| 224 | }, | ||||||||||||||||||||||||||||||||||||
| 225 | 'l' => q{ | ||||||||||||||||||||||||||||||||||||
| 226 | Since answers to queries are sorted by decreasing probability of relevance, | ||||||||||||||||||||||||||||||||||||
| 227 | you will probably be interested only in the first few hits. To limit the amout | ||||||||||||||||||||||||||||||||||||
| 228 | of network traffic, the WAIT server only returns the best 10 hits per default. | ||||||||||||||||||||||||||||||||||||
| 229 | You can change this limit with 'wl <number>'. | ||||||||||||||||||||||||||||||||||||
| 230 | }, | ||||||||||||||||||||||||||||||||||||
| 231 | 'd' => q{ | ||||||||||||||||||||||||||||||||||||
| 232 | The 'wd <hit-number>' command retrieves the POD document form the | ||||||||||||||||||||||||||||||||||||
| 233 | server and stores it in the file 'w2c' in your CPAN directory. Then it | ||||||||||||||||||||||||||||||||||||
| 234 | runs 'perlpod' on it. If you have problems, check if you local | ||||||||||||||||||||||||||||||||||||
| 235 | 'perlpod' works with absolute path names. Older versions are know to | ||||||||||||||||||||||||||||||||||||
| 236 | fail. Also try to avoid fetching of large documents like 'perlfunc.pod'. | ||||||||||||||||||||||||||||||||||||
| 237 | Use 'wr <hit-number>' to see how large the documents are before fetching | ||||||||||||||||||||||||||||||||||||
| 238 | the actually if you have a slow connection. | ||||||||||||||||||||||||||||||||||||
| 239 | }, | ||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | sub wh { | ||||||||||||||||||||||||||||||||||
|
Subroutine
wh: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 245 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ($cmd and $cmd =~ /(\w)$/) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cmd and $cmd =~ /(\w)$/
MC/DC0%0/2
$cmd and $cmd =~ /(\w)$/
$cmd
$cmd =~ /(\w)$/
Truth table0%0/3
A and B
A= $cmdB= $cmd =~ /(\w)$/
| |||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | print $HELP{$1} || "No help for 'w$1' yet.\n"; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$HELP{$1} || "No help for 'w$1' yet.\n"
MC/DC0%0/1
$HELP{$1} || "No help for 'w$1' yet.\n"
$HELP{$1}
Truth table0%0/2
A
A= $HELP{$1}
| |||||||||||||||||||||||||||||||||||||
| 249 | } else { | ||||||||||||||||||||||||||||||||||||
| 250 | 0 | print qq[ | |||||||||||||||||||||||||||||||||||
| 251 | Available commands: | ||||||||||||||||||||||||||||||||||||
| 252 | wq query search the WAIT4CPAN server | ||||||||||||||||||||||||||||||||||||
| 253 | wr hit-number display search result record | ||||||||||||||||||||||||||||||||||||
| 254 | wd hit-number fetch the document and run perldoc on it | ||||||||||||||||||||||||||||||||||||
| 255 | wl count limit search to <count> hits | ||||||||||||||||||||||||||||||||||||
| 256 | wh command displays help on command if available | ||||||||||||||||||||||||||||||||||||
| 257 | ]; | ||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||
| 259 | 0 | 1; | |||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||
| 262 | 1 | ▶ | END { | ||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||
| 263 | 1 | ▶ | unlink $tmp if -e $tmp; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||
| 266 | 1 | 1; | |||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||
| 268 | __DATA__ | ||||||||||||||||||||||||||||||||||||