File: debbugs.patch

package info (click to toggle)
libxml-perl 0.08-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 492 kB
  • ctags: 245
  • sloc: perl: 1,961; xml: 301; sh: 31; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,724 bytes parent folder | download | duplicates (4)
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
Author: Ardo van Rangelrooij <ardo@debian.org>
Description:
  * lib/XML/PatAct/ToObjects.pm: applied two patches by Adam Heath which are
    needed for a rewrite of 'debbugs' 
    (closes: Bug#174315)
  * lib/XML/PatAct/ToObjects.pm: applied another patch from Adam Heath
    which is needed for the new version of 'debbugs'
    (closes: Bug#174434)


--- a/lib/XML/PatAct/ToObjects.pm
+++ b/lib/XML/PatAct/ToObjects.pm
@@ -176,6 +176,8 @@ sub start_element {
 
 	if ($action->{Make} eq 'HASH') {
 	    push @{$self->{Parents}}, { @args };
+	} elsif ($action->{Make} eq 'ARRAY') {
+	    push @{$self->{Parents}}, [ @args ];
 	} else {
 	    my $is_defined = 0;
 	    #eval "\$is_defined = defined %{$action->{Make}" . "::}";
@@ -253,9 +255,16 @@ sub end_element {
     if ($action->{FieldIsArray}) {
 	push @{$self->{Parents}[-1]{$action->{Field}}}, $value;
     } elsif (defined $action->{Field}) {
-	$self->{Parents}[-1]{$action->{Field}} = $value;
+	my $field = $action->{Field};
+	$field =~ s/%\{($name_re)\}/$element->{Attributes}{$1}/ge;
+	$self->{Parents}[-1]{$field} = $value;
     } else {
-	push @{$self->{Parents}[-1]{Contents}}, $value;
+	my $ref = ref($self->{Parents}[-1]);
+	if ($ref eq 'ARRAY') {
+	    push @{$self->{Parents}[-1]}, $value;
+	} else {
+	    push @{$self->{Parents}[-1]{Contents}}, $value;
+	}
     }
 }
 
@@ -293,7 +302,7 @@ sub _parse_action {
 	    $action->{Make} = shift @$source;
 	} elsif ($option eq '-args') {
 	    my $args = shift @$source;
-	    $args =~ s/%\{($name_re)\}/(\$element->{Attributes}{'$1'})/g;
+	    $args =~ s/%\{($name_re)\}/\$element->{Attributes}{'$1'}/g;
 	    $action->{Args} = $args;
 	} elsif ($option eq '-field') {
 	    $action->{Field} = shift @$source;