bkiahg has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be greatly appreciated.#! 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 .....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple XMLout
by Wonko the sane (Curate) on Jun 14, 2004 at 14:54 UTC | |
by bkiahg (Pilgrim) on Jun 14, 2004 at 14:59 UTC |