Commits

Toby Inkster committed ee26104 Merge

pull from shlomif

  • Participants
  • Parent commits c074f38, ef9b688

Comments (0)

Files changed (2)

             }
             if ( $@ =~ /^UNTESTED (\S*)/ ) {
                 warn "Note: libxml2 $1 was not tested with this XML::LibXML version.\n"
-#                 warn <<UNTESTED;
+#                 warn <<"UNTESTED";
 # WARNING!
 # The installed version of libxml2 was not tested with this version of XML::LibXML.
 
                 warn "\nusing fallback values for LIBS and INC\n";
                 $config{LIBS} = '-L/usr/local/lib -L/usr/lib -lxml2 -lm';
                 $config{INC} = '-I/usr/local/include -I/usr/include';
-                print <<OPT;
+                print <<"OPT";
 options:
   LIBS='$config{LIBS}'
   INC='$config{INC}'
                          [0,7,2,0],
                          [0,7,3,1],
                         );
-        print <<GDOME;
+        print <<"GDOME";
 
 GDOME Support (experimental):
    XML::LibXML can parse into XML::GDOME DOMs if libgdome is installed.
 # -------------------------------------------------------------------------- #
 # test if the libraries are really installed!
 unless (have_library("xml2") or have_library("libxml2")) {
-    print STDERR <<DEATH;
+    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 
     my $str = shift->SUPER::manifypods(@_);
 #    warn $str;
 #    $str =~ s/^manifypods : pure_all (.*)$/manifypods : pure_all docs $1/m;
-    $str .= <<EOF;
+    $str .= <<"EOF";
 
 docs-fast :
 \t\@$^X -pi~ -e 's{<edition>[0-9.]*</edition>}{<edition>'"\$(VERSION)"'</edition>}' docs/libxml.dbk
 }
 
 sub xsystem {
-    my $command = shift;
+    my $command_aref = shift;
     if ($DEBUG) {
-        print $command, "\n";
-        if (system($command) != 0) {
-            die "system call to '$command' failed";
+        print "@$command_aref\n";
+        if ((system { $command_aref->[0] } @$command_aref) != 0) {
+            die "system call to '@$command_aref' failed";
         }
         return 1;
     }
     open(OLDERR, ">&STDERR");
     open(STDOUT, ">$DEVNULL");
     open(STDERR, ">$DEVNULL");
-    my $retval = system($command);
+    my $retval = (system { $command_aref->[0] } @$command_aref);
     open(STDOUT, ">&OLDOUT");
     open(STDERR, ">&OLDERR");
     if ($retval != 0) {
-        die "system call to '$command' failed";
+        die "system call to '@$command_aref' failed";
     }
     return 1;
 }
     {
         open(my $cfile, '>', 'Conftest.xs') 
             or die "Cannot write to file Conftest.xs: $!";
-        print {$cfile} <<EOT;
+        print {$cfile} <<"EOT";
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 EOT
         print {$cfile} $src;
-        print {$cfile} <<EOT;
+        print {$cfile} <<"EOT";
 
 MODULE = Conftest          PACKAGE = Conftest
 
     {
         open(my $cfile, ">test.pl") 
             or die "Cannot write to file test.pl: $!";
-        print {$cfile} <<EOT;
+        print {$cfile} <<"EOT";
 use Test; BEGIN { plan tests => 1; } END { ok(\$loaded) }
 use Conftest; \$loaded++;
 EOT
         close($cfile);
     }
     my $quote = $is_Win32 ? '"' : "'";
-    xsystem("$^X Makefile.PL "
-        . join(' ', map { "${quote}$_=$config{$_}${quote}" } keys %config)
+    xsystem([$^X, 'Makefile.PL',
+        (map { "$_=$config{$_}" } keys %config),
+        ]
     );
 
     my $def_opt = defined($opt) ? $opt : '';
     # libraries to include do not belong here!
     # I would assume a user to set OTHERLDFLAGS in the %config if they are
     # really required. if done so, we don't have to pass them here ...
-    xsystem("$Config{make} test ${quote}OTHERLDFLAGS=${def_opt}${quote}");
+    xsystem([$Config{make}, 'test', "OTHERLDFLAGS=${def_opt}"]);
 } # end try_link0
 
 sub try_link {

File lib/XML/LibXML/NodeList.pm

 sub foreach {
     my $self = CORE::shift;
     my $sub  = CORE::shift;
-    $self->map($sub);
+
+    foreach my $item (@$self)
+    {
+        local $_ = $item;
+        $sub->($item);
+    }
+
     return wantarray ? @$self : $self;
 }
 
 =head2 foreach($coderef)
 
 Inspired by perl's foreach loop. Executes the coderef on each item in
-the list. Similar to C<map>, but instead returning the list of values
+the list. Similar to C<map>, but instead of returning the list of values
 returned by $coderef, returns the original NodeList.
 
 =head2 reduce($coderef, $init)