File: use-3-form-open.diff

package info (click to toggle)
libxml-parser-perl 2.44-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,272 kB
  • sloc: xml: 3,937; perl: 1,953; makefile: 27; ansic: 27
file content (46 lines) | stat: -rw-r--r-- 1,204 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
Description: use 3 form for open()
Author: Xavier Guimard <yadd@debian.org>
Bug-Debian: https://bugs.debian.org/923223
Forwarded: https://github.com/chorny/XML-Parser/issues/8
Last-Update: 2019-02-27

--- a/Expat/Expat.pm
+++ b/Expat/Expat.pm
@@ -86,7 +86,11 @@
   }
 
   local(*ENC);
+  if($file eq '-') {
   open(ENC, $file) or croak("Couldn't open encmap $file:\n$!\n");
+  } else {
+  open(ENC, '<', $file) or croak("Couldn't open encmap $file:\n$!\n");
+  }
   binmode(ENC);
   my $data;
   my $br = sysread(ENC, $data, -s $file);
@@ -492,7 +496,11 @@
   my $self = shift;
   croak "Parser has already been used" if $self->{_State_};
   local(*FILE);
+  if ($_[0] eq '-') {
   open(FILE, $_[0]) or  croak "Couldn't open $_[0]:\n$!";
+  } else {
+  open(FILE, '<', $_[0]) or  croak "Couldn't open $_[0]:\n$!";
+  }
   binmode(FILE);
   my $ret = $self->parse(*FILE);
   close(FILE);
--- a/Parser.pm
+++ b/Parser.pm
@@ -216,7 +216,11 @@
   my $self = shift;
   my $file = shift;
   local(*FILE);
+  if ($file eq '-') {
   open(FILE, $file) or  croak "Couldn't open $file:\n$!";
+  } else {
+  open(FILE, '<', $file) or  croak "Couldn't open $file:\n$!";
+  }
   binmode(FILE);
   my @ret;
   my $ret;