sandcrawler has asked for the wisdom of the Perl Monks concerning the following question:
Good day Monks!
I guess work's just got my head so clouded now that I can't read between the lines of what the tutorials are trying to tell me so forgive me if this is a dumb question.
I'm using XML::Simple 2.18 with Perl 5.8.8.
I'm trying to read a conf file, perform some stuff, and then in the conf file keep track of the last time I executed my code.
My XML looks like
Can't use string ("1") as a HASH ref while "strict refs" in use at line foo
Thanks in advance for the forthcoming enlightenment!
Kevin
I'm using XML::Simple 2.18 with Perl 5.8.8.
I'm trying to read a conf file, perform some stuff, and then in the conf file keep track of the last time I executed my code.
My XML looks like
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;
Can't use string ("1") as a HASH ref while "strict refs" in use at line foo
Thanks in advance for the forthcoming enlightenment!
Kevin
|
---|
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 |
Back to
Seekers of Perl Wisdom