【发布时间】:2015-10-14 10:29:14
【问题描述】:
我正在尝试在 xdp 文件末尾附加时间戳。我正在使用XML::Twig。在运行脚本时,时间戳 (<testing>4619314911532861</testing>) 会在末尾添加,但输出会出现在 STDOUT 而不是 testdata.xdp。我错过了什么?
代码:
#!/usr/bin/perl
use strict;
use warnings;
use XML::Twig;
my $twig=XML::Twig->new(pretty_print => 'indented');
my $file = 'testdata.xdp';
$twig->parsefile_inplace($file, '.bak');
my $root= $twig->root;
my @children= $root->children;
foreach my $child (@children){
my $eblg= new XML::Twig::Elt( 'testing', localtime);
$eblg->paste( 'last_child', $child);
}
$twig->flush;
【问题讨论】:
标签: perl perl-module xml-twig xdp-pdf