XML::Simple XMLout
bkiahg
created: 2004-06-14 10:41:58
Good Morning Wise Monks,

I'm having a bit of XML::Simple problems. I keep getting an error 'Unrecognised option: NoAttr at C:\web\paging\pref2.cgi line 58'. It says that for every option, no matter which I use. I'm on a windows 2000 box running ActivePerl-5.8.0.806-MSWin32-x86. Here's the code.
#! C:\perl\bin\perl.exe

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use XML::Simple;

my $path = "C:\\web\\paging\\user_pref";


# New cgi

# Some Security Holes Plugged
$CGI::DISABLE_UPLOADS = 1;          # Disable uploads
$CGI::POST_MAX        = 1024; # limit posts to 1K max

my $q = new CGI;


# Get and untaint data
my $enter_submits = $q->param('enter_submits');
if ( $enter_submits =~ /^([yes|no]+)$/ )  {$enter_submits = $1}
else  {
	print "Content-type: text/html\n\n";
	print "Only yes and no are legal options!";
	exit;
}


###########################
# Update user preferences #
###########################


my $xs = new XML::Simple;
my $User_Preferences = {
      'logdir'        => '/var/log/foo/',
      'debugfile'     => '/tmp/foo.debug',
      'server'        => {
          'sahara'        => {
              'osversion'     => '2.6',
              'osname'        => 'solaris',
              'address'       => [ '10.0.0.101', '10.0.1.101' ]
          },
          'gobi'          => {
              'osversion'     => '6.5',
              'osname'        => 'irix',
              'address'       => '10.0.0.102'
          },
          'kalahari'      => {
              'osversion'     => '2.0.34',
              'osname'        => 'linux',
              'address'       => [ '10.0.0.103', '10.0.1.103' ]
          }
      }
  };
$xs->XMLout($User_Preferences, AttrIndent => 1, NoAttr => 1, OutputFile => "$path\\$ENV{'LOGON_USER'}.xml");


# print webpage .....
Any help would be greatly appreciated.

Update: Figured it out. Was reading the wrong documentation. Got the right docs from activestate and viole!
Re: XML::Simple XMLout
created: 2004-06-14 10:54:57
You may be using an older version of XML::Simple. What version are you using?

Wonko

Re^2: XML::Simple XMLout
created: 2004-06-14 10:59:34
1.06. Going to try and update to 2.01.

perlmonks.org content © perlmonks.org and bkiahg, Wonko the sane

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03