Skip to content
Snippets Groups Projects
Commit 1737cbac authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

switch to Syntax::Keyword::Try

parent d98d4df7
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ package AccountManager::Metadata;
use Mojo::Base -base;
use English qw(-no_match_vars);
use Syntax::Keyword::Try;
use XML::LibXML qw(:libxml);
sub new {
......@@ -13,8 +14,11 @@ sub new {
die "non-readable file $args{file}" unless -r $args{file};
my $doc;
eval { $doc = XML::LibXML->load_xml(location => $args{file}); };
die "Failed to parse file: $EVAL_ERROR" if $EVAL_ERROR;
try {
$doc = XML::LibXML->load_xml(location => $args{file});
} catch($error) {
die "Failed to parse file: $error";
}
my $root = $doc->documentElement();
my $type = $root->nodeName();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment