~ubuntu-branches/ubuntu/trusty/pdl/trusty

« back to all changes in this revision

Viewing changes to debian/patches/70_upstream_pdldoc_apropos.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Nick Ellery
  • Date: 2008-11-05 04:46:08 UTC
  • mfrom: (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20081105044608-1q5jtyin3fnca0bs
Tags: 1:2.4.3-8ubuntu1
* Merge from debian unstable, remaining changes (LP: #297050):
  - Enabled NAN support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 70_upstream_pdldoc_apropos.dpatch by Henning Glawe <glaweh@debian.org>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Backport from upstream cvs: make apropos function in pdldoc work with perl 5.10
 
6
 
 
7
@DPATCH@
 
8
diff -urNad pdl-2.4.3~/Doc/Doc/Perldl.pm pdl-2.4.3/Doc/Doc/Perldl.pm
 
9
--- pdl-2.4.3~/Doc/Doc/Perldl.pm        2004-03-18 07:49:04.000000000 +0100
 
10
+++ pdl-2.4.3/Doc/Doc/Perldl.pm 2008-09-22 00:17:40.235509207 +0200
 
11
@@ -40,7 +40,7 @@
 
12
 
 
13
 use PDL::Doc;
 
14
 use IO::File;
 
15
-use Pod::Text;
 
16
+use Pod::PlainText;
 
17
 
 
18
 $PDL::onlinedoc = undef;
 
19
 $PDL::onlinedoc = new PDL::Doc (FindStdFile());
 
20
@@ -48,23 +48,6 @@
 
21
 use PDL::Config;
 
22
 my $bvalflag = $PDL::Config{WITH_BADVAL} || 0;
 
23
 
 
24
-# pod commands are stripped from the ref string before printing.
 
25
-# How we do this depends on the version of Pod::Text installed.
 
26
-#
 
27
-# I'm guessing the difference in behaviour is between versions
 
28
-# 1 and 2 of Pod::Text (it's certainly true for 
 
29
-# version 1.0203 (perl5.005_03) and 2.03 (perl 5.6.0))
 
30
-#
 
31
-# version 1:
 
32
-#  we use a private routine from Pod::Text
 
33
-#  (prepare_for_output) in printmatch() in order
 
34
-#  to strip away pod directives from the ref
 
35
-#  string
 
36
-#
 
37
-# version 2: (Thanks to Tim Jenness)
 
38
-#  create an object and use the interpol() method
 
39
-#
 
40
-
 
41
 # Find std file
 
42
 
 
43
 sub FindStdFile {
 
44
@@ -97,9 +80,6 @@
 
45
        || 72;
 
46
 }
 
47
 
 
48
-# the $^W assignment stops Pod::Text::fill() from 
 
49
-# generating "Use of uninitialised values" errors
 
50
-#
 
51
 sub printmatch {
 
52
     my @match = @_;
 
53
     if (@match) {
 
54
@@ -113,58 +93,34 @@
 
55
 # for the given matches
 
56
 #
 
57
 sub format_ref {
 
58
-    my @match = @_;
 
59
-    my @text = ();
 
60
+  my @match = @_;
 
61
+  my @text = ();
 
62
 
 
63
-    # XXX this is NASTY
 
64
-    my $width = screen_width()-17;
 
65
-    if ( $Pod::Text::VERSION < 2 ) {
 
66
-       $Pod::Text::indent = 0;
 
67
-       $Pod::Text::SCREEN = $width;
 
68
-       local $^W = 0;
 
69
-       for my $m (@match) { 
 
70
-           $_ = $m->[1]{Ref} || 
 
71
-               ( (defined $m->[1]{CustomFile})
 
72
-                 ? "[No ref avail. for `".$m->[1]{CustomFile}."']"
 
73
-                 : "[No reference available]"
 
74
-                 );
 
75
-         Pod::Text::prepare_for_output(); # adds a '\n' to $_
 
76
-           $_ = Pod::Text::fill $_; # try and get `nice' wrapping 
 
77
-           s/\n*$//; # remove last new lines (so substitution doesn't append spaces at end of text)
 
78
-           s/\n/\n                /g;
 
79
-           my $name = $m->[0];
 
80
-           if ( length($name) > 15 ) { 
 
81
-               push @text, sprintf "%s ...\n                %s\n", $name, $_; 
 
82
-           } else {
 
83
-               push @text, sprintf "%-15s %s\n", $name, $_; 
 
84
-           }
 
85
-       }
 
86
-    } else {
 
87
-       my $parser = new Pod::Text( width => $width, indent => 0, sentence => 0 );
 
88
-       
 
89
-       for my $m (@match) { 
 
90
-           my $ref = $m->[1]{Ref} || 
 
91
-               ( (defined $m->[1]{CustomFile})
 
92
-                 ? "[No ref avail. for `".$m->[1]{CustomFile}."']"
 
93
-                 : "[No reference available]"
 
94
-                 );
 
95
+  my $width = screen_width()-17;
 
96
+  my $parser = new Pod::PlainText( width => $width, indent => 0, sentence => 0 );
 
97
 
 
98
-           $ref = $parser->interpolate( $ref );
 
99
-           $ref = $parser->reformat( $ref );
 
100
-           
 
101
-           # remove last new lines (so substitution doesn't append spaces at end of text)
 
102
-           $ref =~ s/\n*$//; 
 
103
-           $ref =~ s/\n/\n                /g;
 
104
+  for my $m (@match) { 
 
105
+    my $ref = $m->[1]{Ref} || 
 
106
+      ( (defined $m->[1]{CustomFile})
 
107
+        ? "[No ref avail. for `".$m->[1]{CustomFile}."']"
 
108
+        : "[No reference available]"
 
109
+     );
 
110
 
 
111
-           my $name = $m->[0];
 
112
-           if ( length($name) > 15 ) { 
 
113
-               push @text, sprintf "%s ...\n                %s\n", $name, $ref; 
 
114
-           } else {
 
115
-               push @text, sprintf "%-15s %s\n", $name, $ref; 
 
116
-           }
 
117
-       }
 
118
+    $ref = $parser->interpolate( $ref );
 
119
+    $ref = $parser->reformat( $ref );
 
120
+
 
121
+    # remove last new lines (so substitution doesn't append spaces at end of text)
 
122
+    $ref =~ s/\n*$//;
 
123
+    $ref =~ s/\n/\n                /g;
 
124
+
 
125
+    my $name = $m->[0];
 
126
+    if ( length($name) > 15 ) { 
 
127
+      push @text, sprintf "%s ...\n                %s\n", $name, $ref;
 
128
+    } else {
 
129
+      push @text, sprintf "%-15s %s\n", $name, $ref;
 
130
     }
 
131
-    return wantarray ? @text : $text[0];
 
132
+  }
 
133
+  return wantarray ? @text : $text[0];
 
134
 
 
135
 } # sub: format_ref()
 
136