sandcrawler has asked for the wisdom of the Perl Monks concerning the following question:
DATE above should be epoch time. my simplified perl is<conf> <box1> <username>me</username> <password>secret</password> </box1> <box2> <username>me</username> <password>secret</password> </box2> <lastRun>DATE</lastRun> </conf>
My code runs fine up till I try to write out the update. I get#!/usr/bin/perl use strict; use XML::Simple; use Data::Dumper; my $xmlConf = "file.xml"; my $conf = new XML::Simple(NoAttr => 1, KeyAttr => [], ForceArray => [ +qw(box1 box2)], KeepRoot => 1, SearchPath => "." ); my $confIn = $conf->XMLin("$xmlConf"); my $confOut = $conf->XMLout($confIn, OutputFile => $xmlConf); print "Box 1: Username - $confIn->{conf}->{Box1}[0]->{username}, Passw +ord - $confIn->{conf}->{Box1}[0]->{password}\n"; print "Box 2: Username - $confIn->{conf}->{Box2}[0]->{username}, Passw +ord - $confIn->{conf}->{Box2}[0]->{password}\n"; my $epoch = time(); $confOut->{conf}->{lastRun} = $epoch;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yet another xml::simple question
by kyle (Abbot) on Jan 26, 2009 at 21:37 UTC | |
by sandcrawler (Initiate) on Jan 26, 2009 at 21:45 UTC | |
by sandcrawler (Initiate) on Jan 26, 2009 at 21:54 UTC | |
by toolic (Bishop) on Jan 26, 2009 at 22:07 UTC | |
|
Re: Yet another xml::simple question
by Anonymous Monk on Jan 26, 2009 at 23:08 UTC | |
|
Re: Yet another xml::simple question
by saberworks (Curate) on Jan 27, 2009 at 18:03 UTC |