summaryrefslogtreecommitdiffstats
path: root/mdkonline.pm
diff options
context:
space:
mode:
Diffstat (limited to 'mdkonline.pm')
-rw-r--r--mdkonline.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/mdkonline.pm b/mdkonline.pm
index 361ad0e0..48b9fb4d 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -30,7 +30,7 @@ use common;
use ugtk2;
our @ISA = qw(Exporter);
-our @EXPORT = qw(fork_exec get_banner get_stale_upgrade_filename);
+our @EXPORT = qw(fork_exec get_banner get_stale_upgrade_filename xml2perl);
our $version = 2.67;
@@ -80,4 +80,19 @@ sub is_running {
$found;
}
+# callers need to require XML::Simple
+sub xml2perl {
+ my ($res) = @_;
+ my $ref = eval { XML::Simple->new->XMLin($res->{_content}) };
+ if (my $err = $@) {
+ warn ">> XML error: $err\n";
+ $ref = {
+ code => 1,
+ message => $err,
+ };
+ }
+ $ref;
+}
+
+
1;