File: consumer_newline.patch

package info (click to toggle)
libxml-sax-writer-perl 0.50-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 144 kB
  • ctags: 66
  • sloc: perl: 494; makefile: 42
file content (50 lines) | stat: -rw-r--r-- 1,701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Author: Florian Ragwitz <rafl@debian.org>
Description: trailing newline for HandleConsumer and FileConsumer
--- libxml-sax-writer-perl.orig/t/10consumers.t
+++ libxml-sax-writer-perl/t/10consumers.t
@@ -71,8 +71,8 @@
 my $cnt2 = <FH2>;
 close FH2;
 
-ok($cnt1 eq 'FILE ONE FILE ONE', 'file content (1)');
-ok($cnt2 eq 'FILE TWO FILE TWO', 'file content (2)');
+ok($cnt1 eq "FILE ONE FILE ONE\n", 'file content (1)');
+ok($cnt2 eq "FILE TWO FILE TWO\n", 'file content (2)');
 
 
 ##
--- libxml-sax-writer-perl.orig/Writer.pm
+++ libxml-sax-writer-perl/Writer.pm
@@ -97,7 +97,7 @@
             $ref eq 'GLOB'                                or
             UNIVERSAL::isa(\$self->{Output}, 'GLOB')      or
             UNIVERSAL::isa($self->{Output}, 'IO::Handle')) {
-        $self->{Consumer} = XML::SAX::Writer::HandleConsumer->new($self->{Output});
+        $self->{Consumer} = XML::SAX::Writer::HandleConsumer->new($self->{Output}, $self);
     }
     elsif (not $ref) {
         $self->{Consumer} = XML::SAX::Writer::FileConsumer->new($self->{Output});
@@ -312,7 +312,11 @@
 #-------------------------------------------------------------------#
 # finalize
 #-------------------------------------------------------------------#
-sub finalize { return 0 }
+sub finalize {
+    my $fh = ${$_[0]};
+    print $fh "\n";
+    return 0
+}
 #-------------------------------------------------------------------#
 
 
@@ -347,7 +351,9 @@
 # finalize
 #-------------------------------------------------------------------#
 sub finalize {
-    close ${$_[0]};
+    my $fh = ${$_[0]};
+    print $fh "\n";
+    close $fh;
     return 0;
 }
 #-------------------------------------------------------------------#