Shlomi Fish avatar Shlomi Fish committed 0672bc7

Get rid of more trailing space.

Comments (0)

Files changed (5)

         $xml2cfg = $libprefix . '/bin/' . $xml2cfg;
     }
 
-    # if a user defined INC and LIBS on the command line we must not 
+    # if a user defined INC and LIBS on the command line we must not
     # override them
     if ( not defined $config{LIBS} and not defined $config{INC} ) {
         print "running xml2-config...";
                     "  - don't report errors!\n".
                     "  - don't send patches!\n\n".
                     "Check the README file for more information on versions\n".
-                    "that are tested with XML::LibXML\n\n"; 
+                    "that are tested with XML::LibXML\n\n";
             exit 0 unless $FORCE; # 0 recommended by http://cpantest.grango.org (Notes for CPAN Authors)
             }
             if ( $@ =~ /^UNTESTED (\S*)/ ) {
     print STDERR <<"DEATH";
 libxml2, zlib, and/or the Math library (-lm) have not been found.
 Try setting LIBS and INC values on the command line
-Or get libxml2 from 
+Or get libxml2 from
   http://xmlsoft.org/
 If you install via RPMs, make sure you also install the -devel
 RPMs, as this is where the headers (.h files) are.
     }
     chdir(".testlink");
     {
-        open(my $cfile, '>', 'Conftest.xs') 
+        open(my $cfile, '>', 'Conftest.xs')
             or die "Cannot write to file Conftest.xs: $!";
         print {$cfile} <<"EOT";
 #ifdef __cplusplus
         close($cfile);
     }
     {
-        open(my $cfile, '>', 'Conftest.pm') 
+        open(my $cfile, '>', 'Conftest.pm')
             or die "Cannot write to file Conftest.pm: $!";
         print {$cfile} <<'EOT';
 package Conftest;
         close($cfile);
     }
     {
-        open (my $cfile, '>', 'Makefile.PL') 
+        open (my $cfile, '>', 'Makefile.PL')
             or die "Cannot write to file Makefile.PL: $!";
         print {$cfile} <<'EOT';
 use ExtUtils::MakeMaker;
         close($cfile);
     }
     {
-        open(my $cfile, ">test.pl") 
+        open(my $cfile, ">test.pl")
             or die "Cannot write to file test.pl: $!";
         print {$cfile} <<"EOT";
 use Test; BEGIN { plan tests => 1; } END { ok(\$loaded) }
 XMLPREFIX=$YOURLIBXMLPREFIX parameter to Makefile.PL determining the correct
 libxml2 version in use. e.g.
 
->  perl Makefile.PL XMLPREFIX=/usr/brand-new 
+>  perl Makefile.PL XMLPREFIX=/usr/brand-new
 
 will ask '/usr/brand-new/bin/xml2-config' about your real libxml2
 configuration.
 Additionally I received the following Note from Rozi Kovesdi:
 
 > Here is my report if someone else runs into the same problem:
-> 
+>
 > Finally I am done with installing all the libraries and XML Perl
 > modules
-> 
+>
 > The combination that worked best for me was:
 > gcc
 > GNU make
-> 
+>
 > Most importantly - before trying to install Perl modules that depend on
 > libxml2:
-> 
+>
 > must set SHLIB_PATH  to include  the path to  libxml2 shared library
-> 
+>
 > assuming that you used the default:
-> 
+>
 > export  SHLIB=/usr/local/lib
-> 
+>
 > also, make sure that the config  files have execute permission:
-> 
+>
 > /usr/local/bin/xml2-config
 > /usr/local/bin/xslt-config
-> 
+>
 > they did not have +x after they were installed by 'make install'
 > and it took me a while to realize that this was my problem
-> 
+>
 > or one can use:
-> 
+>
 > perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'
 
 
                         <funcsynopsisinfo>my $node_2 = $map->item(2);</funcsynopsisinfo>
                     </funcsynopsis>
 
-                    <para>Returns the node with the index of the argument 
+                    <para>Returns the node with the index of the argument
                     (starting from 0)</para>
                 </listitem>
             </varlistentry>
                         <funcsynopsisinfo>$map->setNamedItem($new_node)</funcsynopsisinfo>
                     </funcsynopsis>
 
-                    <para>Sets the node with the same name as 
-                    <literal>$new_node</literal> to 
+                    <para>Sets the node with the same name as
+                    <literal>$new_node</literal> to
                     <literal>$new_node</literal>.</para>
                 </listitem>
             </varlistentry>
                         <funcsynopsisinfo>$map->removeNamedItem($name)</funcsynopsisinfo>
                     </funcsynopsis>
 
-                    <para>Remove the item with the name 
+                    <para>Remove the item with the name
                     <literal>$name</literal>.</para>
                 </listitem>
             </varlistentry>

example/xmllibxmldocs.pl

         }
         # close the file
         $self->{OFILE}->close();
+
+        # Strip trailing space.
+        my $text = _slurp($dir.$filename);
+        $text =~ s/[ \t]+$//gms;
+
+        open my $out, '>', $dir.$filename
+            or die "Cannot open $dir$filename for writing.";
+        print {$out} $text;
+        close ($out);
+
     }
 }
 
+sub _slurp
+{
+    my $filename = shift;
+
+    open my $in, '<', $filename
+        or die "Cannot open '$filename' for slurping - $!";
+
+    local $/;
+    my $contents = <$in>;
+
+    close($in);
+
+    return $contents;
+}
+
 # ------------------------------------------------------------------------- #
 # dump_text
 # ------------------------------------------------------------------------- #

t/style-trailing-space.t

 my $finder = Test::TrailingSpace->new(
    {
        root => '.',
-       filename_regex => qr/\.(?:t|pm|pl|xs|c|h|txt)\z/,
+       filename_regex => qr/(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z/,
    },
 );
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.