I am working on a webapp using Perl Dancer Framework. I am using XML::Twig in lib/myapp.pm
file but it seems to be causing a problem for me:
package map;
use Dancer ':syntax';
use LWP::Simple;
use XML::Twig;
our $VERSION = '0.1';
get '/' => sub {
template 'index';
};
post '/' => sub {
my $id = params -> {id};
my $ls = params -> {list};
my @as = split /\,/, $ls;
foreach my $a (@as){
#assemble the epost URL
my $db = 'gene';
my $base = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/';
my $url = $base . "esummary.fcgi?db=$db&id=$a";
my $docsums = get($url);
#parse the record
my $t= XML::Twig->new(twig_roots => {
'DocumentSummary' => \&summary
});
$t->parse($docsums);
}
};
true;
The error it gives is:
Runtime Error runtime error Can't use an undefined value as a HASH reference at /Library/Perl/5.18/Dancer/Route/Registry.pm line 125