Skip to content

Commit

Permalink
Move xmlopts to a data structure instead of in the XMLout call
Browse files Browse the repository at this point in the history
Just a bit cleaner
  • Loading branch information
afresh1 committed Aug 13, 2012
1 parent d5970e6 commit 4362abc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions rt-ticket-dumper
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ my %queues;
my %lut;
my %users;

my %xmlopts = (
RootName => 'Ticket',
NoAttr => 1,
SuppressEmpty => 1,
XMLDecl => '<?xml version="1.0" encoding="UTF-8"?>',
GroupTags => {
CustomFields => 'CustomField',
Transactions => 'Transaction',
Attachments => 'Attachment',
},
);

my %user_types = map { $_ => 1 } qw(
Owner
Creator
Expand Down Expand Up @@ -222,12 +234,6 @@ sub export_ticket {

my $filename = sprintf "Ticket_%05d.xml", $data->{id};
open my $fh, '>', $filename or die $!;
print $fh XMLout(
$data,
RootName => 'Ticket',
NoAttr => 1,
SuppressEmpty => '',
XMLDecl => '<?xml version="1.0" encoding="UTF-8"?>',
);
print $fh XMLout( $data, %xmlopts );
close $fh;
}

0 comments on commit 4362abc

Please sign in to comment.