bkiahg has asked for the wisdom of the Perl Monks concerning the following question:

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, OutputFil +e => "$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!

Replies are listed 'Best First'.
Re: XML::Simple XMLout
by Wonko the sane (Curate) on Jun 14, 2004 at 14:54 UTC
    You may be using an older version of XML::Simple. What version are you using?

    Wonko

      1.06. Going to try and update to 2.01.