I'm just trying eval for the first time, and get a compilation error for the following piece of code:
my $dom;
eval {
$dom = $PRSR->load_xml(location => $fullpathname, no_blanks => 1);
}
my $dtlDocType = getObjectType($dom); # <----- the error occurs here
It says "Global symbol $dtlDocType requires explicit package name". When I remove the eval and let the line setting $dom stay without a block, it works. Initializing $dom in the first line to anything doesn't make any difference.
What is the problem?
eval { ... }
需要使用分号。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.